diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ad11ad..58b1295 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,11 +19,11 @@ jobs: run: npx playwright install --with-deps - name: Run ESLint run: npm run lint - # - name: Run Playwright tests - # run: npx playwright test - # - uses: actions/upload-artifact@v4 - # if: always() - # with: - # name: playwright-report - # path: playwright-report/ - # retention-days: 30 + - name: Run Playwright tests + run: npx playwright test + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/tests/list-stuff-page.spec.ts b/tests/list-stuff-page.spec.ts new file mode 100644 index 0000000..0733c28 --- /dev/null +++ b/tests/list-stuff-page.spec.ts @@ -0,0 +1,20 @@ +import { test, expect } from '@playwright/test'; + +test.use({ + storageState: 'john-auth.json', +}); + +test('test', async ({ page }) => { + await page.goto('http://localhost:3000/list'); + await expect(page.getByRole('navigation')).toBeVisible(); + await page.getByRole('heading', { name: 'Stuff' }).click(); + await expect(page.getByRole('cell', { name: 'Name' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Quantity' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Condition' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Actions' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Basket' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Bicycle' })).toBeVisible(); + await expect(page.getByRole('link', { name: 'Add Stuff' })).toBeVisible(); + await expect(page.getByRole('link', { name: 'List Stuff' })).toBeVisible(); + await expect(page.getByRole('button', { name: 'john@foo.com' })).toBeVisible(); +});