MY QUALITY - First iteration
This commit is contained in:
@@ -14,18 +14,23 @@ test('MAI CALL happy path: create → claim → resolve', async ({ page, context
|
||||
// Use a unique description so the test can find its own card in the queue.
|
||||
const desc = `E2E ${Date.now()} — ruído anormal no posto`;
|
||||
|
||||
// ── 0. Badge in to a workstation (the request posto now comes from the
|
||||
// operator's active session, not a per-request dropdown) ────────────
|
||||
await page.goto('/');
|
||||
const requestBtn = page.getByTestId('btn-request-maintenance');
|
||||
if (!(await requestBtn.isVisible().catch(() => false))) {
|
||||
// No active session yet → pick the first workstation in the badge-in panel.
|
||||
await page.getByTestId('badge-in-station').first().click();
|
||||
await expect(requestBtn).toBeVisible({ timeout: 15_000 });
|
||||
}
|
||||
|
||||
// ── 1. Operator creates a request ────────────────────────────────────────
|
||||
await page.goto('/maintenance/new');
|
||||
|
||||
// Wait for workstation options to load (select is disabled while loading)
|
||||
await expect(page.locator('#workstation')).toBeEnabled({ timeout: 15_000 });
|
||||
|
||||
// Select the first real workstation
|
||||
const firstOpt = page.locator('#workstation option:not([value=""])').first();
|
||||
const wsValue = await firstOpt.getAttribute('value');
|
||||
await page.selectOption('#workstation', wsValue!);
|
||||
await requestBtn.click();
|
||||
await page.waitForURL('**/maintenance/new**');
|
||||
|
||||
// The workstation is shown read-only from the session; just describe + submit.
|
||||
await page.fill('#description', desc);
|
||||
await expect(page.locator('button[type=submit]')).toBeEnabled({ timeout: 15_000 });
|
||||
await page.click('button[type=submit]');
|
||||
|
||||
// ── 2. Wait for the sync to complete ─────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user