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

Fix tests #2380

Merged
merged 1 commit into from
Oct 8, 2023
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
2 changes: 2 additions & 0 deletions examples/blocks/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const gists = [
"olympics",
"editable",
"file",
"magic",
"nypd",
];

const lis = [];
Expand Down
3 changes: 3 additions & 0 deletions rust/perspective-viewer/src/less/viewer.less
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@
list-style: none;
flex-direction: column;
flex: 1;

// Needs 2 because it must take precedence over teh chart legend.
z-index: 2;
}

select {
Expand Down
14 changes: 7 additions & 7 deletions rust/perspective-viewer/test/js/column_settings/datagrid.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
compareNodes,
getEventListener,
} from "@finos/perspective-test";

import { expect, test } from "@playwright/test";

let runTests = (title: string, beforeEachAndLocalTests: () => void) => {
Expand All @@ -24,14 +25,17 @@ let runTests = (title: string, beforeEachAndLocalTests: () => void) => {
test("Clicking edit button toggles sidebar", async ({ page }) => {
let view = new PspViewer(page);
await view.openSettingsPanel();
let editBtn = view.dataGrid.regularTable.editBtnRow.first();
let editBtn = view.dataGrid.regularTable.editBtnRow
.locator("th.psp-menu-enabled span")
.first();
await editBtn.click();
await view.columnSettingsSidebar.container.waitFor();
await editBtn.click();
await view.columnSettingsSidebar.container.waitFor({
state: "hidden",
});
});

test("Toggling a column in the sidebar highlights in the plugin", async ({
page,
}) => {
Expand Down Expand Up @@ -140,7 +144,6 @@ let runTests = (title: string, beforeEachAndLocalTests: () => void) => {
expect(name).toBeTruthy();
let td = await table.getFirstCellByColumnName(name);
await td.waitFor();
page.evaluate((name) => console.log(name), name);

// text style
await view.columnSettingsSidebar.openTab("style");
Expand All @@ -149,18 +152,15 @@ let runTests = (title: string, beforeEachAndLocalTests: () => void) => {
.locator("input[type=checkbox]:not(:disabled)")
.first();
let tdStyle = await td.evaluate((node) => {
console.log(node.innerHTML, node.style.cssText);
return node.style.cssText;
});
let listener = await getEventListener(
page,
"perspective-column-style-change"
);
await checkbox.waitFor();
await checkbox.click({ timeout: 100 });
await checkbox.click();
expect(await listener()).toBe(true);
let newStyle = await td.evaluate((node) => {
console.log(node.innerHTML, node.style.cssText);
return node.style.cssText;
});
expect(tdStyle).not.toBe(newStyle);
Expand All @@ -173,7 +173,7 @@ let runTests = (title: string, beforeEachAndLocalTests: () => void) => {
let table = view.dataGrid.regularTable;

let col = await view.getOrCreateColumnByType("string");
await col.editBtn.click({ timeout: 100 });
await col.editBtn.click();
let name = await col.name.innerText();
expect(name).toBeTruthy();
let td = await table.getFirstCellByColumnName(name);
Expand Down
16 changes: 9 additions & 7 deletions rust/perspective-viewer/test/js/migrate_viewer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,21 @@ test.describe("Migrate Viewer", () => {
test.describe("Viewer config migrations", () => {
for (const [name, old, current] of TESTS) {
test(`Migrate '${name}'`, async ({ page }) => {
expect(convert(old, { replace_defaults: true })).toEqual(
current
);
const converted = convert(JSON.parse(JSON.stringify(old)), {
replace_defaults: true,
});
expect(converted).toEqual(current);
});
}
});

test.describe("migrate", async () => {
for (const [name, old, current] of TESTS) {
// NOTE: these tests were previously skipped.
test.skip(`restore '${name}'`, async ({ page }) => {
const converted = convert(JSON.parse(JSON.stringify(old)));
test(`restore '${name}'`, async ({ page }) => {
const converted = convert(JSON.parse(JSON.stringify(old)), {
replace_defaults: true,
});
const config = await page.evaluate(async (old) => {
const viewer = document.querySelector("perspective-viewer");
await viewer.getTable();
Expand All @@ -320,8 +323,7 @@ test.describe("Migrate Viewer", () => {
current
);

const contents = get_contents(page);

const contents = await get_contents(page);
await compareContentsToSnapshot(contents, [
`migrate-restore-${name}.txt`,
]);
Expand Down
5 changes: 4 additions & 1 deletion tools/perspective-test/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const DEVICE_OPTIONS = {
"--font-render-hinting=none",
'--proxy-server="direct://"',
"--proxy-bypass-list=*",
"--js-flags=--expose-gc",
],
},
},
Expand Down Expand Up @@ -162,7 +163,9 @@ export default defineConfig({
use: {
viewport: { width: 1280, height: 720 },
actionTimeout: 0,
trace: "on-first-retry",
trace: "retain-on-failure",
screenshot: "only-on-failure",
video: "retain-on-failure",
},
globalSetup: RUN_JUPYTERLAB
? require.resolve(
Expand Down
Binary file modified tools/perspective-test/results.tar.gz
Binary file not shown.