Skip to content

Commit

Permalink
Merge pull request #57 from nash1111/issue-52-2
Browse files Browse the repository at this point in the history
feat: add playwright
  • Loading branch information
nash1111 authored Jun 5, 2024
2 parents 4e0d9cd + 7427308 commit bf0b58c
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/commit-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
git config user.email github-actions[bot]@users.noreply.github.com
git add .
git commit -m 'chore: update currentIssues.json lastUpdated.ts' --allow-empty
git config pull.rebase false
git pull origin ${{ env.branch }}
git push origin ${{ env.branch }}
env:
GH_TOKEN: ${{ secrets.BLOG_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Update test-results

on:
pull_request:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
update-test-results:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v1
- name: Extract branch name
id: extract_branch
run: |
echo "branch=${{ github.head_ref }}" >> $GITHUB_ENV
- name: Checkout to branch
run: |
git checkout ${{ env.branch }}
git config --global url."https://${{ secrets.BLOG_TOKEN }}:[email protected]/".insteadOf "https://github.com/"
- name: Install dependencies
run: bun install

- name: Start server
run: |
bun run dev &
echo $! > server.pid
- name: Wait for server to start
run: sleep 10

- name: Run Playwright tests
run: bunx playwright install --with-deps && bunx playwright test

- name: Stop server
run: kill $(cat server.pid)

- name: Check diff
id: diff
run: |
git add -N .
git diff --name-only --exit-code test-results/
continue-on-error: true
- name: Commit & Push
run: |
set -x
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git add .
git commit -m 'chore: update test-results' --allow-empty
git config pull.rebase false
git pull origin ${{ env.branch }}
git push origin ${{ env.branch }}
env:
GH_TOKEN: ${{ secrets.BLOG_TOKEN }}
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@babylonjs/core": "^7.4.0",
"@babylonjs/loaders": "^7.4.0",
"@mdx-js/rollup": "^3.0.1",
"@playwright/test": "^1.44.1",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.6",
Expand All @@ -35,6 +36,7 @@
"isbot": "^4.1.0",
"lucide-react": "^0.372.0",
"miniflare": "^3.20240404.0",
"playwright": "^1.44.1",
"postcss": "^8.4.38",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion public/lastUpdated.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const lastUpdated = "2024-06-05T08:06:56";
export const lastUpdated = "2024-06-05T14:42:37";
1 change: 1 addition & 0 deletions server.pid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1834
4 changes: 4 additions & 0 deletions test-results/.last-run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"status": "passed",
"failedTests": []
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions tests/task.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test } from '@playwright/test';

test.describe('/task page', () => {
test('should render without crashing', async ({ page }) => {
await page.goto('http://localhost:5173/task');
await page.screenshot({ path: `test-results/screenshots/screenshot-${Date.now()}.png` });
});
});

0 comments on commit bf0b58c

Please sign in to comment.