Skip to content

Commit

Permalink
Add proper visual regression testing
Browse files Browse the repository at this point in the history
  • Loading branch information
timomeh committed Apr 2, 2024
1 parent eb124d7 commit dc08956
Show file tree
Hide file tree
Showing 59 changed files with 736 additions and 180 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,27 @@ jobs:
- run: pnpm build
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.BLOG_GH_ACCESS_TOKEN }}

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 chromium
- run: pnpm 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
36 changes: 0 additions & 36 deletions .github/workflows/playwright.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ yarn-error.log*
next-env.d.ts
/test-results/
/playwright-report/
/playwright-screenshots/
/blob-report/
/playwright/.cache/
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ Using this structure, I can subscribe to GitHub's webhooks, and revalidate only

## Stack

- Next.js
- GitHub Discussions / Octokit
- Shiki
- Remote MDX
- Tailwind CSS
- [Next.js](https://nextjs.org/)
- [GitHub Discussions](https://github.com/timomeh/timomeh.de/discussions) / Octokit
- [Shiki](https://shiki.style/)
- [next-mdx-remote](https://github.com/hashicorp/next-mdx-remote)
- [Tailwind CSS](https://tailwindcss.com/)
- [Playwright](https://playwright.dev/) & [Argos CI](https://argos-ci.com)
4 changes: 4 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const nextConfig = {
hostname: 'github.com',
pathname: '/timomeh/timomeh.de/assets/4227520/**',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
},
],
},
async rewrites() {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "next start",
"lint": "next lint",
"test": "playwright test",
"test:ui": "playwright test --ui"
"test:ui": "pnpm test -- --ui"
},
"dependencies": {
"@octokit/graphql": "8.0.1",
Expand Down Expand Up @@ -43,6 +43,7 @@
"shiki": "1.2.1"
},
"devDependencies": {
"@argos-ci/playwright": "2.0.0",
"@playwright/test": "1.42.1",
"@tailwindcss/typography": "0.5.12",
"@types/ellipsize": "0.1.3",
Expand Down
7 changes: 5 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default defineConfig({
/* 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',
reporter: [
process.env.CI ? ['github'] : ['html'],
['@argos-ci/playwright/reporter', { uploadToArgos: !!process.env.CI }],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
Expand All @@ -29,7 +32,7 @@ export default defineConfig({
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
name: 'chromium-e2e',
use: { ...devices['Desktop Chrome'] },
},
],
Expand Down
Loading

0 comments on commit dc08956

Please sign in to comment.