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

More robust galata/UI tests #15355

Merged
merged 2 commits into from
Nov 28, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions galata/src/helpers/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ export class ActivityHelper {
return activeTab === name;
} else {
const tab = await this.getTab(name);
return (
(tab &&
(await tab.evaluate((tab: Element) =>
tab.classList.contains('jp-mod-current')
))) ??
false
);
if (!tab) {
return false;
}
const classes = ((await tab.getAttribute('class')) ?? '').split(' ');
return classes.includes('jp-mod-current');
}
}

Expand Down
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();
});
});
});