-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #812 from finos/phosphor-puppeteer
Add puppeteer tests for `perspective-phosphor`
- Loading branch information
Showing
15 changed files
with
294 additions
and
16 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
packages/perspective-phosphor/config/jest.integration.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const config = require("@finos/perspective-test/jest.config"); | ||
|
||
module.exports = Object.assign({}, config, { | ||
roots: ["./js"], | ||
rootDir: "../test/integration" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
transform: { | ||
".js$": "@finos/perspective-test/src/js/transform.js" | ||
}, | ||
rootDir: "../test/unit/" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/perspective-phosphor/test/integration/css/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
margin: 0; | ||
padding: 0; | ||
overflow: hidden; | ||
} | ||
|
||
#container{ | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
100 changes: 100 additions & 0 deletions
100
packages/perspective-phosphor/test/integration/csv/superstore.csv
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
packages/perspective-phosphor/test/integration/html/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- | ||
Copyright (c) 2017, the Perspective Authors. | ||
This file is part of the Perspective library, distributed under the terms of | ||
the Apache License 2.0. The full license can be found in the LICENSE file. | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="perspective-phosphor.js"></script> | ||
<script src="perspective-viewer-hypergrid.js"></script> | ||
|
||
<link rel='stylesheet' href="index.css"> | ||
<link rel='stylesheet' href="material.css"> | ||
</head> | ||
<body> | ||
<perspective-viewer style="display: none;"></perspective-viewer> | ||
<div id="container"></div> | ||
|
||
</body> | ||
</html> |
118 changes: 118 additions & 0 deletions
118
packages/perspective-phosphor/test/integration/js/workspace.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (c) 2019, the Perspective Authors. | ||
* | ||
* This file is part of the Perspective library, distributed under the terms of | ||
* the Apache License 2.0. The full license can be found in the LICENSE file. | ||
* | ||
*/ | ||
|
||
const utils = require("@finos/perspective-test"); | ||
const path = require("path"); | ||
|
||
const TEST_ROOT = path.join(__dirname, "..", "..", ".."); | ||
const PATHS = [ | ||
path.join(TEST_ROOT, "dist", "umd"), | ||
path.join(TEST_ROOT, "dist", "themes"), | ||
path.join(TEST_ROOT, "test", "integration", "html"), | ||
path.join(TEST_ROOT, "test", "integration", "css"), | ||
path.join(TEST_ROOT, "test", "integration", "csv") | ||
]; | ||
|
||
utils.with_server({paths: PATHS}, () => { | ||
describe.page( | ||
"index.html", | ||
() => { | ||
test.capture( | ||
"simple perspective workspace", | ||
async page => { | ||
const container = await page.$("#container"); | ||
await page.evaluate(async node => { | ||
const workspace = new window.PerspectivePhosphor.PerspectiveWorkspace({node}); | ||
const widget = new window.PerspectivePhosphor.PerspectiveWidget(); | ||
widget.viewer.setAttribute("id", "viewer"); | ||
workspace.addViewer(widget); | ||
|
||
const response = await fetch("superstore.csv"); | ||
widget.load(await response.text()); | ||
}, container); | ||
|
||
await page.waitFor(() => { | ||
const elem = document.getElementById("viewer"); | ||
return elem.view !== undefined; | ||
}); | ||
await page.waitForSelector("#viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 30000} | ||
); | ||
|
||
test.capture( | ||
"perspective workspace and duplicate view", | ||
async page => { | ||
const container = await page.$("#container"); | ||
await page.evaluate(async node => { | ||
const workspace = new window.PerspectivePhosphor.PerspectiveWorkspace({node}); | ||
const widget = new window.PerspectivePhosphor.PerspectiveWidget(); | ||
|
||
widget.viewer.setAttribute("id", "viewer"); | ||
|
||
workspace.addViewer(widget); | ||
const response = await fetch("superstore.csv"); | ||
const data = await response.text(); | ||
widget.load(data); | ||
|
||
workspace.dockpanel.duplicate(widget); | ||
}, container); | ||
|
||
await page.waitFor(() => { | ||
const elem = document.getElementById("viewer"); | ||
return elem.view !== undefined; | ||
}); | ||
|
||
await page.waitForSelector("#viewer:not([updating])"); | ||
}, | ||
// fail_on_errors = false because of hypergrid bug that causes errors when multiple grids are rendered | ||
{wait_for_update: false, timeout: 60000, fail_on_errors: false} | ||
); | ||
|
||
test.skip( | ||
"perspective workspace and master view", | ||
async page => { | ||
const container = await page.$("#container"); | ||
await page.evaluate(async node => { | ||
const workspace = new window.PerspectivePhosphor.PerspectiveWorkspace({node}); | ||
window.workspace = workspace; | ||
const widget = new window.PerspectivePhosphor.PerspectiveWidget(); | ||
|
||
widget.viewer.setAttribute("id", "viewer"); | ||
|
||
workspace.addViewer(widget); | ||
const response = await fetch("superstore.csv"); | ||
const data = await response.text(); | ||
widget.load(data); | ||
|
||
workspace.dockpanel.duplicate(widget); | ||
}, container); | ||
|
||
await page.waitFor(() => { | ||
const elem = document.getElementById("viewer"); | ||
return elem.view !== undefined; | ||
}); | ||
|
||
await page.evaluate(() => { | ||
const widget = window.workspace.dockpanel.widgets().next(); | ||
widget.restore({ | ||
"row-pivots": ["Segment"], | ||
columns: ["Profit"] | ||
}); | ||
window.workspace.makeMaster(widget); | ||
window.workspace.setRelativeSizes([1, 2]); | ||
}); | ||
await page.waitForSelector("perspective-viewer:not([updating])"); | ||
}, | ||
{wait_for_update: false, timeout: 60000, fail_on_errors: false} | ||
); | ||
}, | ||
{root: TEST_ROOT} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"__GIT_COMMIT__": "61e4a83125c8a5406fead71a83bf430f279815a7", | ||
"index.html/perspective workspace and master view": "8c6165a59ac1e0e02e619021751df3c3", | ||
"index.html/simple perspective workspace": "2aec2b4d01494380ba6e1bdb08365ade", | ||
"index.html/perspective workspace and duplicate view": "ac0cb35d961f86aede74d9ee566f1f5c" | ||
} |
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...ective-phosphor/test/js/dockpanel.spec.js → ...e-phosphor/test/unit/js/dockpanel.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ective-phosphor/test/js/workspace.spec.js → ...e-phosphor/test/unit/js/workspace.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters