Skip to content

Commit

Permalink
use whole shell for list view comparasion
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-i committed Jul 4, 2023
1 parent 69399ec commit 0aba3c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
20 changes: 3 additions & 17 deletions ui-tests/helpers/SchedulerHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,6 @@ export class SchedulerHelper {
return this.page.locator(this.filebrowserMenuItemSelector);
}

/**
* Notebook jobs panel selector
*/
get jobsPanelSelector() {
return '#notebook-jobs-panel';
}

/**
* Notebook jobs panel locator
*/
get jobsPanelLocator() {
return this.page.locator(this.jobsPanelSelector);
}

/**
* Notebook jobs panel selector
*/
Expand All @@ -77,9 +63,9 @@ export class SchedulerHelper {
}

/**
* Wait until there is no "Loading ..." inner text on the page
* Wait until there is no inner text on the page
*/
waitForLoading() {
this.page.waitForFunction(() => !document.documentElement.innerText.includes("Loading"));
waitTextGone(str: string) {
this.page.waitForFunction(() => !document.documentElement.innerText.includes(str));
}
}
10 changes: 5 additions & 5 deletions ui-tests/tests/jupyter_scheduler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.describe('Jupyter Scheduler integration tests for JupyterLab', () => {
await page.click('button:has-text("Rename")');
await createJobButton.click();

await page.waitForFunction(() => !document.documentElement.innerText.includes("Loading …"));
await schedulerHelper.waitTextGone("Loading …");
expect(await page.screenshot()).toMatchSnapshot(createViewSnapshot);
});

Expand All @@ -63,7 +63,7 @@ test.describe('Jupyter Scheduler integration tests for JupyterLab', () => {
expect(await righClickMenu.screenshot()).toMatchSnapshot(righClickMenuSnapshot);

await createJobItem.click();
schedulerHelper.waitForLoading();
schedulerHelper.waitTextGone("Loading …");
const createViewSnapshot = 'create-view-empty.png';
await page.sidebar.close(await page.sidebar.getTabPosition('filebrowser') ?? undefined);
expect(await page.screenshot()).toMatchSnapshot(createViewSnapshot);
Expand All @@ -77,7 +77,7 @@ test.describe('Jupyter Scheduler integration tests for JupyterLab', () => {
await page.click('.jp-DirListing-item[data-file-type="notebook"]', { button : 'right'});
const createJobItem = schedulerHelper.filebrowserMenuItemLocator;
await createJobItem.click();
schedulerHelper.waitForLoading();
schedulerHelper.waitTextGone("Loading");

await page.fill('input[name=jobName]', 'MyTestJob');
await page.click('button:has-text("Create")');
Expand All @@ -86,7 +86,7 @@ test.describe('Jupyter Scheduler integration tests for JupyterLab', () => {
await page.sidebar.close(await page.sidebar.getTabPosition('filebrowser') ?? undefined);
const timeStamp = schedulerHelper.timestampLocator
const listViewSnapshot = 'list-view-in-progress.png';
const jobsPanel = schedulerHelper.jobsPanelLocator;
await expect(jobsPanel).toHaveScreenshot(listViewSnapshot, {mask: [timeStamp], maskColor: "white"});
const labShell = page.locator('#main.jp-LabShel');
await expect(labShell).toHaveScreenshot(listViewSnapshot, {mask: [timeStamp], maskColor: "white"});
});
});

0 comments on commit 0aba3c5

Please sign in to comment.