Skip to content

Commit

Permalink
Fix the workspaces context menu flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Apr 14, 2024
1 parent dc354b3 commit 0c3ad46
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions galata/test/documentation/workspaces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ test.describe('Workspaces sidebar', () => {

await page.launcher.waitFor();

// Force the kernel sidebar to "empty" state to avoid flaky snapshots;
// mocking the kernel session state does not help here, possibly due to
// concurrent test execution, so we manipulate the DOM directly.
const kernelsSection = page.locator('[aria-label="Kernels Section"]');
for (const buttonName of ['collapse-expand', 'switch-view']) {
const button = kernelsSection.locator(
`.jp-ToolbarButton[data-jp-item-name="${buttonName}"]`
);
if (await button.isVisible()) {
await button.evaluate(node => (node.style.display = 'none'));
}
}
const button = kernelsSection.locator('.jp-RunningSessions-shutdownAll');
await button.evaluate(
node => ((node as HTMLButtonElement).disabled = true)
);

expect(
await page.screenshot({ clip: { y: 0, x: 0, width: 400, height: 420 } })
).toMatchSnapshot('workspaces_sidebar.png');
Expand Down

0 comments on commit 0c3ad46

Please sign in to comment.