Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added integration screenshot tests for more d3fc charts #117

Merged
merged 2 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions packages/perspective-viewer-d3fc/test/html/scatter.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
<!--

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>

<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<script src="perspective.view.js"></script>
<script src="d3fc.plugin.js"></script>

<link rel='stylesheet' href="demo.css">

</head>
<body>

<perspective-viewer
view="d3_y_line"
columns='["Sales"]'>

</perspective-viewer>

<script>

var xhr = new XMLHttpRequest();
xhr.open('GET', 'superstore.csv', true);
xhr.onload = function () {
document.getElementsByTagName('perspective-viewer')[0].load(xhr.response);
}
xhr.send(null);

</script>

</body>
</html>
<!--

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>

<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<script src="perspective.view.js"></script>
<script src="d3fc.plugin.js"></script>

<link rel='stylesheet' href="demo.css">
</head>
<body>

<perspective-viewer view="{view-name}" row-pivots='["Date"]' column-pivots='[]' filters='[]'
sort='[]' columns='["Open","Price","High","Low"]'
aggregates='{"Date":"distinct count","Change%":"sum","High":"sum","Low":"sum","Open":"sum","Price":"sum","Vol.":"sum"}'>

</perspective-viewer>

<script>

var xhr = new XMLHttpRequest();
xhr.open('GET', 'shares.csv', true);
xhr.onload = function () {
document.getElementsByTagName('perspective-viewer')[0].load(xhr.response);
}
xhr.send(null);

</script>

</body>
</html>
5,277 changes: 5,277 additions & 0 deletions packages/perspective-viewer-d3fc/test/html/shares.csv

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<!--

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>

<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<script src="perspective.view.js"></script>
<script src="d3fc.plugin.js"></script>

<link rel='stylesheet' href="demo.css">

</head>
<body>

<perspective-viewer
view="d3_y_bar"
columns='["Sales"]'>

</perspective-viewer>

<script>

var xhr = new XMLHttpRequest();
xhr.open('GET', 'superstore.csv', true);
xhr.onload = function () {
document.getElementsByTagName('perspective-viewer')[0].load(xhr.response);
}
xhr.send(null);

</script>

</body>
</html>
<!--
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>
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<script src="perspective.view.js"></script>
<script src="d3fc.plugin.js"></script>
<link rel='stylesheet' href="demo.css">
</head>
<body>
<perspective-viewer
view="{view-name}"
columns='{columns}'>
</perspective-viewer>
<script>
var xhr = new XMLHttpRequest();
xhr.open('GET', 'superstore.csv', true);
xhr.onload = function () {
document.getElementsByTagName('perspective-viewer')[0].load(xhr.response);
}
xhr.send(null);
</script>
</body>
</html>
77 changes: 77 additions & 0 deletions packages/perspective-viewer-d3fc/test/html/themed-template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!--

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>

<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<script src="perspective.view.js"></script>
<script src="d3fc.plugin.js"></script>

<link rel='stylesheet' href="demo.css">

<style>
perspective-viewer {
--active-column--background: none;
--select--background-color: none;
--column-drop-container--background: none;
background-color: #2a2c2f;
color: #cfd8dc;
--plugin--background: #2f3136;
--column-drop-label--color: #666;
--column--border-color: #3b3f46;
--column-drop-target--background: #135d78;
--active-column-selector--color: #22a0ce;
--column_type-float--color: #22a0ce;
--column_type-string--color: #ff8888;
--psp-text-field--border-color: #22a0ce;
--button-hover--color: #22a0ce;
--d3fc-legend-text: #bbbbbb;
--d3fc-axis--ticks: #bbbbbb;
--d3fc-axis--lines: #555555;
--d3fc-tooltip--background: #333333;
--d3fc-tooltip--color: #cfd8dc;
--d3fc-series: #d62728;
--d3fc-series-1: #d62728;
--d3fc-series-2: #9467bd;
--d3fc-series-3: #8c564b;
--d3fc-series-4: #e377c2;
--d3fc-series-5: #7f7f7f;
--d3fc-series-6: #bcbd22;
--d3fc-series-7: #17becf;
--d3fc-series-8: #0366d6;
--d3fc-series-9: #ff7f0e;
--d3fc-series-10: #2ca02c;
--warning--color: #333;
}

</style>
</head>
<body>

<perspective-viewer
view="{view-name}"
columns='{columns}'>

</perspective-viewer>

<script>

var xhr = new XMLHttpRequest();
xhr.open('GET', 'superstore.csv', true);
xhr.onload = function () {
document.getElementsByTagName('perspective-viewer')[0].load(xhr.response);
}
xhr.send(null);

</script>

</body>
</html>
26 changes: 26 additions & 0 deletions packages/perspective-viewer-d3fc/test/js/area.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/******************************************************************************
*
* 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.
*
*/

const path = require("path");

const utils = require("@jpmorganchase/perspective-viewer/test/js/utils.js");
const simple_tests = require("@jpmorganchase/perspective-viewer/test/js/simple_tests.js");

const {withTemplate} = require("./simple-template");
withTemplate("area", "d3_y_area");

utils.with_server({}, () => {
describe.page(
"area.html",
() => {
simple_tests.default();
},
{reload_page: false, root: path.join(__dirname, "..", "..")}
);
});
22 changes: 22 additions & 0 deletions packages/perspective-viewer-d3fc/test/js/bar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const path = require("path");
const utils = require("@jpmorganchase/perspective-viewer/test/js/utils.js");
const simple_tests = require("@jpmorganchase/perspective-viewer/test/js/simple_tests.js");

const {withTemplate} = require("./simple-template");

withTemplate("bar", "d3_y_bar");
withTemplate("bar-x", "d3_x_bar");
withTemplate("bar-themed", "d3_y_bar", {template: "themed-template"});

utils.with_server({}, () => {
describe.page(
"bar.html",
Expand All @@ -20,4 +26,20 @@ utils.with_server({}, () => {
},
{root: path.join(__dirname, "..", "..")}
);

describe.page(
"bar-x.html",
() => {
simple_tests.default();
},
{root: path.join(__dirname, "..", "..")}
);

describe.page(
"bar-themed.html",
() => {
simple_tests.default();
},
{root: path.join(__dirname, "..", "..")}
);
});
35 changes: 35 additions & 0 deletions packages/perspective-viewer-d3fc/test/js/candlestick.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/******************************************************************************
*
* 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.
*
*/

const path = require("path");

const utils = require("@jpmorganchase/perspective-viewer/test/js/utils.js");

const {withTemplate} = require("./simple-template");
withTemplate("candlestick", "d3_candlestick", {template: "shares-template"});

utils.with_server({}, () => {
describe.page(
"candlestick.html",
() => {
test.capture("filter by a single instrument.", async page => {
const viewer = await page.$("perspective-viewer");
await page.evaluate(element => element.setAttribute("filters", '[["Name", "==", "BARC"]]'), viewer);
});

test.capture("filter to date range.", async page => {
const viewer = await page.$("perspective-viewer");
await page.shadow_click("perspective-viewer", "#config_button");
await page.evaluate(element => element.setAttribute("column-pivots", '["Name"]'), viewer);
await page.evaluate(element => element.setAttribute("filters", '[["Date", ">", "2019-01-01"]]'), viewer);
});
},
{reload_page: false, root: path.join(__dirname, "..", "..")}
);
});
Loading