-
Notifications
You must be signed in to change notification settings - Fork 5
feat : configure playwright e2e testing and integrate into CI #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,3 +27,27 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - run: pnpm typecheck | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - run: pnpm test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - run: pnpm build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| e2e: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AUTH_SECRET: some-dummy-secret-for-ci | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AUTH_TRUST_HOST: "true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TURSO_DATABASE_URL: file:local.db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: pnpm/action-setup@v6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - uses: actions/setup-node@v6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| node-version: 24 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cache: pnpm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - run: pnpm install --frozen-lockfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install Playwright Chromium Browser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: pnpm exec playwright install --with-deps chromium | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run E2E Smoke Tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: pnpm test:e2e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+53
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win Add artifact upload for Playwright test results. When E2E tests fail in CI, the HTML report and traces are essential for debugging. Without artifact upload, these files are lost when the job completes. 📦 Proposed addition - name: Run E2E Smoke Tests
run: pnpm test:e2e
+
+ - name: Upload Playwright Report
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: playwright-report
+ path: playwright-report/
+ retention-days: 30📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.25.2)[warning] 38-38: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [warning] 31-54: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) [error] 38-38: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 40-40: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 42-42: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,8 @@ | |
|
|
||
| # testing | ||
| /coverage | ||
|
|
||
| /playwright-report | ||
| /test-results | ||
| # next.js | ||
| /.next/ | ||
| /out/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { test, expect } from "@playwright/test"; | ||
|
|
||
| test("should load app, click analyze on default snippet, and render call graph nodes", async ({ page }) => { | ||
| // 1. Visit the app in English locale | ||
| await page.goto("/en/app"); | ||
|
|
||
| // 2. Locate the textarea for code input and verify it is visible | ||
| const textarea = page.locator("textarea"); | ||
| await expect(textarea).toBeVisible(); | ||
|
|
||
| // 3. Click the "Analyze" button (using the default Python sample code) | ||
| const analyzeBtn = page.getByRole("button", { name: /^Analyze$/ }); | ||
| await expect(analyzeBtn).toBeEnabled(); | ||
| await analyzeBtn.click(); | ||
|
|
||
| // 4. Assert that the React Flow workspace container is rendered | ||
| const reactFlow = page.locator(".react-flow"); | ||
| await expect(reactFlow).toBeVisible(); | ||
|
|
||
| // 5. Assert that we successfully render 6 nodes (1 file container + 5 defined functions) | ||
| const nodes = page.locator(".react-flow__node"); | ||
| await expect(nodes).toHaveCount(6); | ||
|
|
||
| // 6. Verify key node labels contain our function names and container file | ||
| await expect(page.locator(".react-flow__node", { hasText: "snippet.py" })).toBeVisible(); | ||
| await expect(page.locator(".react-flow__node", { hasText: "main" })).toBeVisible(); | ||
| await expect(page.locator(".react-flow__node", { hasText: "clean" })).toBeVisible(); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { defineConfig, devices } from "@playwright/test"; | ||
|
|
||
| export default defineConfig({ | ||
| testDir: "./e2e", | ||
| fullyParallel: true, | ||
| forbidOnly: !!process.env.CI, | ||
| retries: process.env.CI ? 2 : 0, | ||
| workers: process.env.CI ? 1 : undefined, | ||
| reporter: "html", | ||
| webServer: { | ||
| command: "pnpm dev", | ||
| url: "http://localhost:3000", | ||
| reuseExistingServer: !process.env.CI, | ||
| stdout: "ignore", | ||
| stderr: "pipe", | ||
| env: { | ||
| AUTH_TRUST_HOST: "true", | ||
| AUTH_SECRET: "some-dummy-secret-for-e2e", | ||
| }, | ||
| }, | ||
| use: { | ||
| baseURL: "http://localhost:3000", | ||
| trace: "on", | ||
| }, | ||
| projects: [ | ||
| { | ||
| name: "chromium", | ||
| use: { ...devices["Desktop Chrome"] }, | ||
| }, | ||
| ], | ||
| }); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: DataDave-Dev/weftmap
Length of output: 1256
🏁 Script executed:
Repository: DataDave-Dev/weftmap
Length of output: 1653
🏁 Script executed:
Repository: DataDave-Dev/weftmap
Length of output: 46
🏁 Script executed:
Repository: DataDave-Dev/weftmap
Length of output: 228
🏁 Script executed:
Repository: DataDave-Dev/weftmap
Length of output: 46
🏁 Script executed:
Repository: DataDave-Dev/weftmap
Length of output: 2565
🏁 Script executed:
Repository: DataDave-Dev/weftmap
Length of output: 238
🏁 Script executed:
# Read full src/db/index.ts to see initialization logic cat -n src/db/index.tsRepository: DataDave-Dev/weftmap
Length of output: 834
Add database migration step to E2E job before running tests.
The E2E job sets
TURSO_DATABASE_URL: file:local.dbbut does not run migrations. The application only validates the environment variable at startup and does not automatically initialize the database—thedrizzle/schema.sqlmigration file exists but is never executed in CI. Addpnpm db:pushbeforepnpm test:e2eto ensure tables exist when E2E tests run.🤖 Prompt for AI Agents