Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
403 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'npm' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' | ||
groups: | ||
lint: | ||
patterns: | ||
- 'prettier*' | ||
- 'eslint*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
cache: pnpm | ||
- run: pnpm install | ||
- run: pnpm exec playwright install --with-deps | ||
- run: pnpm exec playwright test | ||
env: | ||
GITHUB_ACCESS_TOKEN: ${{ secrets.BLOG_GH_ACCESS_TOKEN }} | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-screenshots | ||
path: playwright-screenshots/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { defineConfig, devices } from '@playwright/test' | ||
|
||
const PORT = process.env.PORT || 3000 | ||
const baseURL = `http://localhost:${PORT}` | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: process.env.CI ? 'github' : 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
baseURL, | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: 'pnpm dev', | ||
url: baseURL, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test('has the correct title', async ({ page }) => { | ||
await page.goto('/') | ||
await expect(page).toHaveTitle('timomeh.de') | ||
}) | ||
|
||
test('shows years', async ({ page }) => { | ||
await page.goto('/') | ||
|
||
await expect( | ||
page.getByRole('heading', { name: '2024', exact: true }), | ||
).toBeVisible() | ||
await expect( | ||
page.getByRole('heading', { name: '2023', exact: true }), | ||
).toBeVisible() | ||
await expect( | ||
page.getByRole('heading', { name: '2022', exact: true }), | ||
).toBeVisible() | ||
}) | ||
|
||
test('lists articles', async ({ page }) => { | ||
await page.goto('/') | ||
await expect(page.getByRole('article')).not.toHaveCount(0) | ||
expect( | ||
page.getByRole('article', { name: /How to Build a Blog/ }), | ||
).toBeDefined() | ||
}) | ||
|
||
test('lists all tags', async ({ page }) => { | ||
await page.goto('/') | ||
await expect(page.getByRole('navigation').getByRole('link')).not.toHaveCount( | ||
0, | ||
) | ||
}) | ||
|
||
test('has an active everything tag by default', async ({ page }) => { | ||
await page.goto('/') | ||
await expect( | ||
page.getByRole('navigation').getByRole('link').first(), | ||
).toHaveText('Everything') | ||
await expect( | ||
page.getByRole('navigation').getByRole('link').first(), | ||
).toHaveAttribute('data-current', 'true') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
test('navigates from home to about', async ({ page }) => { | ||
await page.goto('/') | ||
|
||
await page.click('text=Timo Mämecke') | ||
await expect(page).toHaveTitle('Hi, I’m Timo 👋 | timomeh.de') | ||
expect( | ||
page.getByRole('heading', { level: 1, name: 'Hi, I’m Timo 👋' }), | ||
).toBeDefined() | ||
|
||
expect(page.url()).toMatch(/\/about$/) | ||
}) | ||
|
||
test('navigates from a post back', async ({ page }) => { | ||
await page.goto('/about') | ||
|
||
await page.getByRole('link', { name: /Back$/ }).click() | ||
await expect(page).toHaveTitle('timomeh.de') | ||
expect(new URL(page.url()).pathname).toBe('/') | ||
}) | ||
|
||
test('renders the about page', async ({ page }) => { | ||
await page.goto('/about') | ||
await page.waitForLoadState('networkidle') | ||
await page.screenshot({ | ||
fullPage: true, | ||
path: 'playwright-screenshots/about.png', | ||
timeout: 60_000, | ||
}) | ||
}) | ||
|
||
test('renders the feeds page', async ({ page }) => { | ||
await page.goto('/feeds') | ||
await page.waitForLoadState('networkidle') | ||
await page.screenshot({ | ||
fullPage: true, | ||
path: 'playwright-screenshots/feeds.png', | ||
timeout: 60_000, | ||
}) | ||
}) | ||
|
||
test('renders the imprint page', async ({ page }) => { | ||
await page.goto('/impressum') | ||
await page.waitForLoadState('networkidle') | ||
await page.screenshot({ | ||
fullPage: true, | ||
path: 'playwright-screenshots/impressum.png', | ||
timeout: 60_000, | ||
}) | ||
}) |
Oops, something went wrong.