|
1 | 1 | import { test, expect } from '@playwright/test'; |
2 | 2 |
|
| 3 | +async function dismissGuidelineModal(page: import('@playwright/test').Page) { |
| 4 | + const guidelineModal = page.locator('#guidelineModal'); |
| 5 | + await page.locator('#guidelineModalConfirm').click({ timeout: 2000 }).catch(() => { |
| 6 | + // The modal may not render for every sample transition. |
| 7 | + }); |
| 8 | + await expect(guidelineModal).toBeHidden(); |
| 9 | +} |
| 10 | + |
3 | 11 | test.describe('Annotation list routing', () => { |
4 | 12 | test('shows task info card above filters for selected task', async ({ page }) => { |
5 | 13 | await page.goto('/pages/annotation/annotation-list.html?role=annotator&task_id=TASK-015-A2&run_type=dry_run&task_type=single_sentence_va_scoring'); |
@@ -366,22 +374,20 @@ test.describe('Annotation list routing', () => { |
366 | 374 |
|
367 | 375 | await page.locator('#sampleRows tr', { hasText: 'A2-003' }).first().click(); |
368 | 376 | await expect(page).toHaveURL(/\/pages\/annotation\/annotation-workspace\.html\?/); |
369 | | - |
370 | | - const guidelineModalConfirm = page.locator('#guidelineModalConfirm'); |
371 | | - if (await guidelineModalConfirm.isVisible()) { |
372 | | - await guidelineModalConfirm.click(); |
373 | | - } |
| 377 | + await dismissGuidelineModal(page); |
374 | 378 |
|
375 | 379 | // A2-003 has pre-saved VA values — submit directly |
376 | 380 | await page.locator('#submitBtn').click(); |
377 | 381 | await page.waitForTimeout(500); |
378 | 382 |
|
379 | 383 | // A2-004 and A2-005 are todo (va: null) — must select VA values before submitting |
| 384 | + await dismissGuidelineModal(page); |
380 | 385 | await page.locator('input[name="va_valence"][value="5"]').check(); |
381 | 386 | await page.locator('input[name="va_arousal"][value="5"]').check(); |
382 | 387 | await page.locator('#submitBtn').click(); |
383 | 388 | await page.waitForTimeout(500); |
384 | 389 |
|
| 390 | + await dismissGuidelineModal(page); |
385 | 391 | await page.locator('input[name="va_valence"][value="5"]').check(); |
386 | 392 | await page.locator('input[name="va_arousal"][value="5"]').check(); |
387 | 393 | await page.locator('#submitBtn').click(); |
|
0 commit comments