Skip to content

Commit

Permalink
Merge pull request #2380 from finos/release-fixes-252
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
texodus authored Oct 8, 2023
2 parents 542c37a + 95131c4 commit 51234a2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
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.

0 comments on commit 51234a2

Please sign in to comment.