|
| 1 | +import { expect, test } from './workflow_fixture.js'; |
| 2 | +import { |
| 3 | + getSlimSelectValues, |
| 4 | + selectSlimSelect, |
| 5 | + waitModalClosed, |
| 6 | + waitPageLoading |
| 7 | +} from '../utils.js'; |
| 8 | +import { createDataset } from './dataset_utils.js'; |
| 9 | +import { waitTasksSuccess } from './workflow_task_utils.js'; |
| 10 | + |
| 11 | +test('Workflow type filters selection in images status modal', async ({ page, workflow }) => { |
| 12 | + await page.waitForURL(workflow.url); |
| 13 | + await waitPageLoading(page); |
| 14 | + |
| 15 | + test.slow(); |
| 16 | + const modal = page.locator('.modal.show'); |
| 17 | + |
| 18 | + /** @type {string} */ |
| 19 | + let zarrDir; |
| 20 | + await test.step('Create test dataset', async () => { |
| 21 | + const dataset = await createDataset(page, workflow.projectId); |
| 22 | + zarrDir = dataset.zarrDir; |
| 23 | + }); |
| 24 | + |
| 25 | + await test.step('Open workflow page and configure tasks', async () => { |
| 26 | + await page.goto(workflow.url); |
| 27 | + await waitPageLoading(page); |
| 28 | + await workflow.addTask('create_ome_zarr_compound'); |
| 29 | + await workflow.addTask('cellpose_segmentation'); |
| 30 | + await workflow.addTask('MIP_compound'); |
| 31 | + await workflow.selectTask('create_ome_zarr_compound'); |
| 32 | + await page.getByRole('textbox', { name: 'Image Dir' }).fill(zarrDir); |
| 33 | + await page.getByRole('spinbutton', { name: 'Num Images' }).fill('2'); |
| 34 | + await page.getByRole('button', { name: 'Save changes' }).click(); |
| 35 | + await expect(page.getByRole('button', { name: 'Save changes' })).toBeDisabled(); |
| 36 | + }); |
| 37 | + |
| 38 | + await test.step('Run workflow', async () => { |
| 39 | + await page.getByRole('button', { name: 'Run workflow' }).click(); |
| 40 | + await modal.waitFor(); |
| 41 | + await modal.getByRole('button', { name: 'Run' }).click(); |
| 42 | + await modal.getByRole('button', { name: 'Confirm' }).click(); |
| 43 | + await waitModalClosed(page); |
| 44 | + await waitTasksSuccess(page); |
| 45 | + }); |
| 46 | + |
| 47 | + await test.step('Open cellpose_segmentation images modal', async () => { |
| 48 | + await page.getByLabel('Done images').first().click(); |
| 49 | + await modal.waitFor(); |
| 50 | + await expect(modal.getByLabel('Selector for type 3D')).toBeEnabled(); |
| 51 | + await expect(modal.getByText('Total results: 4')).toBeVisible(); |
| 52 | + await selectSlimSelect(page, modal.getByLabel('Selector for type 3D'), 'False'); |
| 53 | + await modal.getByRole('button', { name: 'Apply' }).click(); |
| 54 | + await expect(modal.getByText('Total results: 2')).toBeVisible(); |
| 55 | + await modal.getByRole('button', { name: 'Close' }).click(); |
| 56 | + await waitModalClosed(page); |
| 57 | + }); |
| 58 | + |
| 59 | + await test.step('Open MIP_compound images modal', async () => { |
| 60 | + await page.getByLabel('Done images').nth(1).click(); |
| 61 | + await modal.waitFor(); |
| 62 | + await expect(modal.getByLabel('Selector for type 3D')).toHaveClass(/ss-disabled/); |
| 63 | + await expect(modal.getByText('Total results: 2')).toBeVisible(); |
| 64 | + const selectedValues = await getSlimSelectValues( |
| 65 | + page, |
| 66 | + modal.getByLabel('Selector for type 3D') |
| 67 | + ); |
| 68 | + expect(selectedValues).toEqual(['True']); |
| 69 | + }); |
| 70 | +}); |
0 commit comments