Skip to content

Commit

Permalink
Improve kernel test robustness now that tests run faster:
Browse files Browse the repository at this point in the history
- do not check text immediately as the kernel needs to connect first
- quality of life: instead of using nth selector, use proper category
  selectors which helps when testing with more kernels installed
  • Loading branch information
krassowski committed Nov 5, 2023
1 parent 753afa4 commit 654dfac
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions galata/test/jupyterlab/kernel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ test.describe('Kernel', () => {
page
.getByRole('tabpanel', { name: 'Launcher' })
.waitFor({ state: 'detached' }),
page.getByTitle('Python 3 (ipykernel)').nth(1).click()
page
.locator('[data-category="Notebook"][title="Python 3 (ipykernel)"]')
.click()
]);

await expect.soft(page.locator('.jp-Dialog')).toHaveCount(0);
Expand Down Expand Up @@ -112,14 +114,16 @@ test.describe('Kernel', () => {
page
.getByRole('tabpanel', { name: 'Launcher' })
.waitFor({ state: 'detached' }),
page.getByTitle('Python 3 (ipykernel)').nth(2).click()
page
.locator('[data-category="Console"][title="Python 3 (ipykernel)"]')
.click()
]);

await expect.soft(page.locator('.jp-Dialog')).toHaveCount(0);

await expect(page.getByTitle('Change kernel for Console 1')).toHaveText(
'Python 3 (ipykernel) | Idle'
);
await page
.getByTitle('Change kernel for Console 1')
.getByText('Python 3 (ipykernel) | Idle')
.waitFor();
});

test('Should ask for kernel when creating console from menu', async ({
Expand All @@ -132,9 +136,10 @@ test.describe('Kernel', () => {
.getByRole('button', { name: 'Select Kernel', exact: true })
.click();

await expect(page.getByTitle('Change kernel for Console 1')).toHaveText(
'Python 3 (ipykernel) | Idle'
);
await page
.getByTitle('Change kernel for Console 1')
.getByText('Python 3 (ipykernel) | Idle')
.waitFor();
});
});
});

0 comments on commit 654dfac

Please sign in to comment.