-
Notifications
You must be signed in to change notification settings - Fork 2
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
47 changed files
with
299 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,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: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
{ | ||
"dependencies": { | ||
"hugo-extended": "^0.125.6" | ||
}, | ||
"devDependencies": { | ||
"@playwright/test": "^1.44.0", | ||
"@types/node": "^20.12.12" | ||
}, | ||
"scripts": { | ||
"build": "hugo", | ||
"build:preview": "hugo --baseURL \"${DEPLOY_PRIME_URL:-/}\" --buildDrafts --buildFuture", | ||
"start": "hugo server --baseURL \"http://localhost:1313\"" | ||
} | ||
} |
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,88 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// require('dotenv').config(); | ||
|
||
/** | ||
* 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: 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: 'http://localhost:1313', | ||
|
||
/* 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'] }, | ||
}, | ||
{ | ||
name: 'chromium dark', | ||
use: { ...devices['Desktop Chrome'], colorScheme: 'dark' }, | ||
}, | ||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
{ | ||
name: 'webkit dark', | ||
use: { ...devices['Desktop Safari'], colorScheme: 'dark' }, | ||
}, | ||
|
||
/* Test against mobile viewports. */ | ||
{ | ||
name: 'Mobile Chrome', | ||
use: { ...devices['Pixel 5'] }, | ||
}, | ||
{ | ||
name: 'Mobile Chrome Dark', | ||
use: { ...devices['Pixel 5'], colorScheme: 'dark' }, | ||
}, | ||
{ | ||
name: 'Mobile Safari', | ||
use: { ...devices['iPhone 12'] }, | ||
}, | ||
|
||
/* Test against branded browsers. */ | ||
{ | ||
name: 'Microsoft Edge', | ||
use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
}, | ||
{ | ||
name: 'Google Chrome', | ||
use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
}, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: 'npm run start', | ||
url: 'http://localhost:1313', | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
}); |
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,15 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('has title', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle("Duncan Mackenzie"); | ||
}); | ||
|
||
test('get started link', async ({ page }) => { | ||
await page.goto('/'); | ||
// Expects page to have a heading with the name of Installation. | ||
await expect(page.getByRole('heading', { name: 'Photography Content' })).toBeVisible(); | ||
await expect(page.getByRole('heading', { name: 'Posts on Engineering Management' })).toBeVisible(); | ||
}); |
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,30 @@ | ||
import { test, expect, Page, TestInfo } from '@playwright/test'; | ||
|
||
test('Visual Diff About', async ({ page }) => { | ||
await visualDiff(page, '/about/'); | ||
}); | ||
|
||
test('Visual Diff Text and Image', async ({ page }) => { | ||
await visualDiff(page, '/blog/space-games/'); | ||
}); | ||
|
||
test('Visual Diff Sample Code', async ({ page }) => { | ||
await visualDiff(page, '/blog/image-formats/'); | ||
}); | ||
|
||
test('Visual Diff Small Album', async ({ page }) => { | ||
await visualDiff(page, '/albums/fall-trail-walk/'); | ||
}); | ||
|
||
|
||
async function visualDiff(page: Page, url: string) { | ||
await page.goto(url); | ||
|
||
// Trigger loading of all images | ||
for (const img of await page.locator('//img').all()) { | ||
await img.scrollIntoViewIfNeeded(); | ||
} | ||
|
||
// Set up listeners concurrently | ||
await expect(page).toHaveScreenshot({ fullPage: true, timeout: 10000}); | ||
} |
Binary file added
BIN
+791 KB
tests/visual.spec.ts-snapshots/Visual-Diff-About-1-Google-Chrome-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+696 KB
tests/visual.spec.ts-snapshots/Visual-Diff-About-1-Microsoft-Edge-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+241 KB
tests/visual.spec.ts-snapshots/Visual-Diff-About-1-Mobile-Chrome-Dark-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+216 KB
tests/visual.spec.ts-snapshots/Visual-Diff-About-1-Mobile-Chrome-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+206 KB
tests/visual.spec.ts-snapshots/Visual-Diff-About-1-Mobile-Safari-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+717 KB
tests/visual.spec.ts-snapshots/Visual-Diff-About-1-chromium-dark-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+691 KB
tests/visual.spec.ts-snapshots/Visual-Diff-About-1-webkit-dark-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.01 MB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-Google-Chrome-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+932 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-Microsoft-Edge-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+730 KB
...visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-Mobile-Chrome-Dark-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+631 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-Mobile-Chrome-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+548 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-Mobile-Safari-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+964 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-chromium-dark-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+932 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-chromium-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+871 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-firefox-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+693 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-webkit-dark-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+683 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Sample-Code-1-webkit-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.6 MB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-Google-Chrome-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.39 MB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-Microsoft-Edge-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+455 KB
...visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-Mobile-Chrome-Dark-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+451 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-Mobile-Chrome-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+496 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-Mobile-Safari-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.39 MB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-chromium-dark-win32.png
Oops, something went wrong.
Binary file added
BIN
+1.39 MB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-chromium-win32.png
Oops, something went wrong.
Binary file added
BIN
+1.85 MB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-firefox-win32.png
Oops, something went wrong.
Binary file added
BIN
+1.63 MB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-webkit-dark-win32.png
Oops, something went wrong.
Binary file added
BIN
+1.63 MB
tests/visual.spec.ts-snapshots/Visual-Diff-Small-Album-1-webkit-win32.png
Oops, something went wrong.
Binary file added
BIN
+822 KB
...s/visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-Google-Chrome-win32.png
Oops, something went wrong.
Binary file added
BIN
+674 KB
.../visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-Microsoft-Edge-win32.png
Oops, something went wrong.
Binary file added
BIN
+506 KB
...ual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-Mobile-Chrome-Dark-win32.png
Oops, something went wrong.
Binary file added
BIN
+420 KB
...s/visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-Mobile-Chrome-win32.png
Oops, something went wrong.
Binary file added
BIN
+372 KB
...s/visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-Mobile-Safari-win32.png
Oops, something went wrong.
Binary file added
BIN
+752 KB
...s/visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-chromium-dark-win32.png
Oops, something went wrong.
Binary file added
BIN
+674 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-chromium-win32.png
Oops, something went wrong.
Binary file added
BIN
+775 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-firefox-win32.png
Oops, something went wrong.
Binary file added
BIN
+642 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-webkit-dark-win32.png
Oops, something went wrong.
Binary file added
BIN
+634 KB
tests/visual.spec.ts-snapshots/Visual-Diff-Text-and-Image-1-webkit-win32.png
Oops, something went wrong.