Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SapiensAnatis committed Jun 29, 2024
1 parent 0878255 commit 29b034e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Website/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: PlaywrightTestConfig = {
testDir: 'tests',
snapshotPathTemplate: '{testDir}/__screenshots__/{testFilePath}/{arg}{ext}',
testMatch: /(.+\.)?(test|spec)\.[jt]s/,
timeout: 600000,
timeout: 60000,
projects: [
{
name: 'chromium',
Expand Down
4 changes: 3 additions & 1 deletion Website/tests/home.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { devices, expect, test } from '@playwright/test';

test('index page has expected h1', async ({ page }) => {
test('displays correctly', async ({ page }) => {
await page.goto('/');

await expect(page.getByRole('heading', { name: 'Dawnshard', exact: true })).toBeVisible();
Expand All @@ -12,6 +12,8 @@ test('index page has expected h1', async ({ page }) => {
test('displays correctly on mobile', async ({ page }) => {
await page.setViewportSize(devices['iPhone 13'].viewport);

await page.goto('/');

await expect(page.getByRole('heading', { name: 'Dawnshard', exact: true })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Welcome to Dawnshard' })).toBeVisible();

Expand Down
19 changes: 17 additions & 2 deletions Website/tests/news.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('displays correctly', async ({ page }) => {

await expect(page.getByRole('heading', { name: 'News' })).toBeVisible();

await expect(page).toHaveScreenshot({ fullPage: true });
await expect(page).toHaveScreenshot();
});

test('displays correctly on mobile', async ({ page }) => {
Expand All @@ -21,6 +21,21 @@ test('displays correctly on mobile', async ({ page }) => {
await page.getByRole('link', { name: 'News' }).click();

await expect(page.getByRole('heading', { name: 'News' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Game updated!' })).toBeVisible();

await expect(page).toHaveScreenshot({ fullPage: true });
await expect(page).toHaveScreenshot();
});

test('change page', async ({ page }) => {
await page.goto('/news/1');

await page.getByRole('link', { name: 'Next' }).click();

await expect(page.getByRole('heading', { name: 'News' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Paging works' })).toBeVisible();

await page.getByRole('link', { name: 'Previous' }).click();

await expect(page.getByRole('heading', { name: 'News' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Game updated!' })).toBeVisible();
});

0 comments on commit 29b034e

Please sign in to comment.