-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
854ca59
commit d784c2c
Showing
8 changed files
with
201 additions
and
239 deletions.
There are no files selected for viewing
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
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
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,19 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { BASE_URL, loadTestImage } from './utils' | ||
|
||
test.describe('Loading images', () => { | ||
test('loads a test image', async ({ page }) => { | ||
await page.goto(BASE_URL) | ||
|
||
await loadTestImage(page) | ||
|
||
expect(await page.waitForSelector('canvas')).toBeTruthy() | ||
expect(await page.$$('canvas')).toHaveLength(1) | ||
expect( | ||
await page.textContent('text=/matrix size: 207 x 256 x 215, voxelsize: 0.74 x 0.74 x 0.74/i'), | ||
).toBeTruthy() | ||
|
||
await loadTestImage(page) | ||
expect(await page.$$('canvas')).toHaveLength(2) | ||
}) | ||
}) |
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,79 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { BASE_URL, loadTestImage } from './utils' | ||
|
||
test.describe('Menu', () => { | ||
test('displays home screen', async ({ page }) => { | ||
await page.goto(BASE_URL) | ||
|
||
expect(await page.textContent('text=/Home/i')).toBeTruthy() | ||
expect(await page.textContent('text=/Add Image/i')).toBeTruthy() | ||
expect(await page.textContent('text=/View/i')).toBeTruthy() | ||
expect(await page.textContent('text=/Bookmarklet/i')).toBeTruthy() | ||
expect(await page.textContent('text=/Drop Files to load images/i')).toBeTruthy() | ||
}) | ||
|
||
test('menubar updates with loading images', async ({ page }) => { | ||
await page.goto(BASE_URL) | ||
|
||
// initially only these menu items are visible | ||
expect(await page.textContent('text=/Home/i')).toBeTruthy() | ||
expect(await page.textContent('text=/Add Image/i')).toBeTruthy() | ||
expect(await page.textContent('text=/View/i')).toBeTruthy() | ||
|
||
// initially these menu items do not exist | ||
expect(await page.$('text=/ColorScale/i')).toBeNull() | ||
expect(await page.$('text=/Overlay/i')).toBeNull() | ||
expect(await page.$('text=/Header/i')).toBeNull() | ||
expect(await page.$('text=/Select/i')).toBeNull() | ||
|
||
// load an image | ||
await loadTestImage(page) | ||
expect(await page.waitForSelector('canvas')).toBeTruthy() | ||
expect( | ||
await page.textContent('text=/matrix size: 207 x 256 x 215, voxelsize: 0.74 x 0.74 x 0.74/i'), | ||
).toBeTruthy() | ||
|
||
// after loading an image these are visible | ||
expect(await page.textContent('text=/Home/i')).toBeTruthy() | ||
expect(await page.textContent('text=/Add Image/i')).toBeTruthy() | ||
expect(await page.textContent('text=/View/i')).toBeTruthy() | ||
expect(await page.textContent('text=/ColorScale/i')).toBeTruthy() | ||
expect(await page.textContent('text=/Overlay/i')).toBeTruthy() | ||
expect(await page.textContent('text=/Header/i')).toBeTruthy() | ||
|
||
// the select menu item is only visible after loading 2 images | ||
expect(await page.$('text=/Select/i')).toBeNull() | ||
await loadTestImage(page) | ||
expect(await page.textContent('text=/Select/i')).toBeTruthy() | ||
}) | ||
|
||
test('loads an image and checks the menu bar', async ({ page }) => { | ||
await page.goto(BASE_URL) | ||
|
||
await loadTestImage(page) | ||
|
||
expect(await page.waitForSelector('canvas')).toBeTruthy() | ||
expect(await page.$$('canvas')).toHaveLength(1) | ||
expect( | ||
await page.textContent('text=/matrix size: 207 x 256 x 215, voxelsize: 0.74 x 0.74 x 0.74/i'), | ||
).toBeTruthy() | ||
|
||
const menuBar = ['Home', 'Add Image', 'View', 'ColorScale', 'Overlay', 'Header'] | ||
for (const item of menuBar) { | ||
expect(await page.textContent(`text=/${item}/i`)).toBeTruthy() | ||
} | ||
}) | ||
|
||
test('opens the example image via the menu bar', async ({ page }) => { | ||
await page.goto(BASE_URL) | ||
|
||
await page.click('data-testid=menu-item-dropdown-Add Image') | ||
await page.click('text=/Example Image/i') | ||
|
||
expect(await page.waitForSelector('canvas')).toBeTruthy() | ||
expect(await page.$$('canvas')).toHaveLength(1) | ||
expect( | ||
await page.textContent('text=/matrix size: 207 x 256 x 215, voxelsize: 0.74 x 0.74 x 0.74/i'), | ||
).toBeTruthy() | ||
}) | ||
}) |
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,33 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { BASE_URL, loadTestSurfImage, loadTestSurfOverlay } from './utils' | ||
|
||
test.describe('Loading meshes', () => { | ||
test('loads a test surface', async ({ page }) => { | ||
await page.goto(BASE_URL) | ||
|
||
await loadTestSurfImage(page) | ||
await page.waitForTimeout(1000) // wait time to work around a bug | ||
|
||
expect(await page.waitForSelector('canvas')).toBeTruthy() | ||
expect(await page.$$('canvas')).toHaveLength(1) | ||
|
||
await loadTestSurfImage(page) | ||
expect(await page.$$('canvas')).toHaveLength(2) | ||
|
||
expect(await page.textContent('text=/Number of Points: 40962/i')).toBeTruthy() | ||
}) | ||
|
||
test('loads a test surface and overlay', async ({ page }) => { | ||
await page.goto(BASE_URL) | ||
|
||
await loadTestSurfImage(page) | ||
|
||
await page.waitForTimeout(1000) // duplicated code to work around a bug | ||
await loadTestSurfImage(page) // duplicated code to work around a bug | ||
|
||
await loadTestSurfOverlay(page, 'curv') | ||
|
||
await page.waitForTimeout(1000) // duplicated code to work around a bug | ||
await loadTestSurfOverlay(page, 'curv') // duplicated code to work around a bug | ||
}) | ||
}) |
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
Oops, something went wrong.