-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add e2e test for errors on Neuroglancer site (#1027)
#1025 Had to add some startup flags to chromium so that WebGL is enabled (and the Neuroglancer site actually loads). Tried with firefox and webkit as well and both worked without any extra flags.
- Loading branch information
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
frontend/packages/data-portal/e2e/pageObjects/neuroglancerPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Locator } from '@playwright/test' | ||
|
||
import { BasePage } from './basePage' | ||
|
||
/** neuroglancer-demo.appspot.com */ | ||
export class NeuroglancerPage extends BasePage { | ||
findViewer(): Locator { | ||
return this.page.locator('.neuroglancer-viewer') | ||
} | ||
|
||
findErrorText(): Locator { | ||
return this.page.getByText('Error') | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
frontend/packages/data-portal/e2e/pageObjects/singleRunPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Locator } from '@playwright/test' | ||
import { SINGLE_RUN_URL } from 'e2e/constants' | ||
|
||
import { BasePage } from './basePage' | ||
|
||
/** /runs/$id */ | ||
export class SingleRunPage extends BasePage { | ||
async goToPage() { | ||
await this.goTo(SINGLE_RUN_URL) | ||
} | ||
|
||
getPrimaryViewTomogramButton(): Locator { | ||
return this.page.locator('a:has-text("View Tomogram")') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
import { NeuroglancerPage } from './pageObjects/neuroglancerPage' | ||
import { SingleRunPage } from './pageObjects/singleRunPage' | ||
|
||
test.describe('Single run page: ', () => { | ||
let page: SingleRunPage | ||
let neuroglancerPage: NeuroglancerPage | ||
test.beforeEach(async ({ page: playwrightPage }) => { | ||
page = new SingleRunPage(playwrightPage) | ||
neuroglancerPage = new NeuroglancerPage(playwrightPage) | ||
await page.goToPage() | ||
}) | ||
|
||
/** This test ensures that the test after it is not a false negative. */ | ||
test('Invalid Neuroglancer URL results in error on Neuroglancer page', async () => { | ||
await page.goTo( | ||
(await page.getPrimaryViewTomogramButton().getAttribute('href'))!.replace( | ||
'#!', | ||
"#!'", | ||
), | ||
) | ||
|
||
await expect(neuroglancerPage.findViewer()).toBeVisible() | ||
await expect(neuroglancerPage.findErrorText()).toHaveCount(1) | ||
}) | ||
|
||
test('Neuroglancer URL does not result in error on Neuroglancer page', async () => { | ||
await page.goTo( | ||
(await page.getPrimaryViewTomogramButton().getAttribute('href'))!, | ||
) | ||
|
||
await expect(neuroglancerPage.findViewer()).toBeVisible() | ||
await expect(neuroglancerPage.findErrorText()).toHaveCount(0) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters