Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@

# /src/blog/example/*

.cache
.cache

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
82 changes: 82 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"watch:sass": "npm run sass:compressed -- --watch",
"watch:postcss": "npm run postcss -- --watch",
"build": "npm run sass:compressed && npm run postcss && npm run minify:js && eleventy && npm run prettify:html",
"start": "npm-run-all sass:compressed postcss --parallel watch:*",
"start": "npm-run-all --parallel watch:eleventy",
"dev": "npm run watch",
"test:highlightjs-lines": "node ./lib/highlightjs-lines.test.js",
"test": "node --test"
Expand All @@ -34,6 +34,8 @@
"devDependencies": {
"@11ty/eleventy": "^3.1.1",
"@11ty/eleventy-plugin-rss": "^2.0.4",
"@playwright/test": "^1.53.1",
"@types/node": "^24.0.7",
"autoprefixer": "^10.4.21",
"postcss": "^8.5.5",
"postcss-cli": "^11.0.1",
Expand Down
35 changes: 35 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { defineConfig, devices } from '@playwright/test';

const localhost = "http://localhost:8080"

export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [['html', { open: 'never' }]],
use: {
baseURL: localhost,
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Webkit'] },
},
],
webServer: {
command: 'npm start',
url: localhost,
reuseExistingServer: !process.env.CI,
},
});
4 changes: 2 additions & 2 deletions src/_includes/sections/hero.njk
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
<ul class="title-action__group">
<li data-animation="left-show" data-delay="2">
<a href="./assets/Curriculum Vitae.pdf"
aria-label="Open PDF of my Curriculum Vitae"
aria-label="Download my Curriculum Vitae"
target="_blank"
rel="noopener noreferrer"
class="title-action">
class="title-action" download>
<svg fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
Expand Down
20 changes: 20 additions & 0 deletions tests/landing-page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/EmptyWork/);
});

test('find a curriculum vitae and download', async ({ page }) => {
test.setTimeout(0);

await page.goto('/');

const downloadPromise = page.waitForEvent('download');
await page.getByRole('link', { name: 'Download my Curriculum Vitae' }).click();
const download = await downloadPromise;

const fileName = download.suggestedFilename();
expect(fileName).toMatch(/\.pdf$/);

});