Skip to content

Commit

Permalink
added UI test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich committed Jul 31, 2024
1 parent 4512932 commit 32e5dbf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/eslint": "^9.6.0",
"@types/node": "^22.0.0",
"autoprefixer": "^10.4.19",
"daisyui": "^4.12.10",
"eslint": "^9.0.0",
Expand Down
17 changes: 14 additions & 3 deletions tests/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import { expect, test } from '@playwright/test';
import { readFile } from 'fs/promises';

test('home page has expected h1', async ({ page }) => {
await page.goto('/');
await expect(page.locator('h1')).toBeVisible();
const reportFile = await readFile('src/lib/logs.json', 'utf-8');
const report: { name: string }[] = JSON.parse(reportFile);

test('Verify that report is not empty', () => {
expect(report.length).toBeGreaterThan(0);
});

report.forEach(({ name }) => {
test(`Verifying that ${name} status is visible`, async ({ page }) => {
await page.goto('/');

await expect(page.getByText(name)).toBeVisible();
});
});

0 comments on commit 32e5dbf

Please # to comment.