From b8beb189dc82e65189a952dbc52dde90706446b9 Mon Sep 17 00:00:00 2001 From: Luciano Oliveira <12519008+luciano-work@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:00:36 -0300 Subject: [PATCH] test: remove menu navigation click Some tests fail when going to the table page and trying to click on the components menu. This happens because, when you go to the table page, the menu is already open, and if you try to click it again, the menu gets hidden. --- tests-e2e/table.e2e.spec.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests-e2e/table.e2e.spec.ts b/tests-e2e/table.e2e.spec.ts index d12f100..59b137e 100644 --- a/tests-e2e/table.e2e.spec.ts +++ b/tests-e2e/table.e2e.spec.ts @@ -2,31 +2,26 @@ import { test, expect, Page } from '@playwright/test'; test.beforeEach(async ({ page }) => { await page.goto('/components/table', { waitUntil: 'networkidle' }); - await page.getByRole('navigation').locator('div').filter({ hasText: 'Components' }).nth(3).click(); - await page.getByRole('link', { name: 'Table' }).click(); }); async function checkTableRowCount(page: Page, filterSelector: string, value: string, expectedRowCount: number) { await page.locator(filterSelector).selectOption(value); - await expect(page.locator('table tbody tr')).toHaveCount(expectedRowCount, { timeout: 5000 }); } async function checkCellInRow(page: Page, cellContent: string, expectedRowIndex: number) { - const rows = await page.locator('table tbody tr'); + const rows = page.locator('table tbody tr'); const cellTexts = await rows.nth(expectedRowIndex).locator('td').allTextContents(); expect(cellTexts).toContain(cellContent); } test('check user filter updates table', async ({ page }) => { await page.fill('input[name="search"]', 'john'); - await expect(page.locator('table tbody tr')).toHaveCount(2); }); test('check user filter empty restores table', async ({ page }) => { await page.fill('input[name="search"]', ''); - await expect(page.locator('table tbody tr')).toHaveCount(8); }); @@ -45,12 +40,10 @@ test('check user status filter updates table', async ({ page }) => { test('check user order filter - newest first', async ({ page }) => { await page.locator('select[name="order"]').selectOption('1'); - await checkCellInRow(page, 'emmawilson', 0); }); test('check user order filter - oldest first', async ({ page }) => { await page.locator('select[name="order"]').selectOption('2'); - await checkCellInRow(page, 'johndoe', 0); });