-
Notifications
You must be signed in to change notification settings - Fork 19
E2e tests init #316
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
Merged
Merged
E2e tests init #316
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
7dfd7cf
feat: base config
rin-st 50eca98
feat: working versions
rin-st 03e42e9
feat: register test
rin-st 2ffb577
refactor: basic spec
rin-st 4c81d50
chore: try to test
rin-st 58c118b
fix: check database setup
rin-st e457eaf
feat: copy seed data
rin-st 4d7746f
chore: mock fb envs
rin-st 0079ec4
chore: handle firebase
rin-st a39fbc9
fix: uncomment browsers
rin-st 32c220c
fix: synpress
rin-st 15c61aa
chore: xvfb
rin-st f2b0fd3
fix: rename cache folder
rin-st 936b681
fix: playwright xvfb
rin-st 0a55ab5
fix: -a flag
rin-st 0c27b78
chore: another try
rin-st c9a4f25
feat: comment duplicate
rin-st 1239234
feat: test with results
rin-st 63a60f6
fix: remove redundant scripts
rin-st 54ef264
fix: name
rin-st 5750e47
fix: rename script
rin-st 5be2fb8
chore: broken test
rin-st 0786252
fix: return working version
rin-st 4a2c746
Merge branch 'main' of github.com:BuidlGuidl/SpeedRunEthereum-v2 into…
rin-st c6585bd
Merge branch 'main' into e2e-tests-init
technophile-04 1bc0c72
fix: review
rin-st 33bd897
feat: readme testing section
rin-st edbabc5
set NEXT_AUTH envs in each setp
technophile-04 0e5a6cc
Revert "set NEXT_AUTH envs in each setp"
technophile-04 9a1822f
Merge branch 'main' into e2e-tests-init
technophile-04 2b83845
chore: move command
rin-st 496310f
chore: install browsers and build cache commands
rin-st b652ffc
fix: nextauth vars
rin-st 1c4be91
feat: cache browsers
rin-st fac8b4e
feat: try to install only chromium
rin-st 93f5da2
fix: remove on:pr
rin-st ad00eda
fix: disable zerion in ci
rin-st d658c40
Revert "fix: remove on:pr"
rin-st File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,113 @@ | ||
| name: Playwright Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| workflow_dispatch: # Allow manual trigger | ||
|
|
||
| jobs: | ||
| E2e_tests: | ||
| timeout-minutes: 60 | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| CI: true | ||
| NODE_ENV: test | ||
| POSTGRES_URL: postgresql://postgres:mysecretpassword@localhost:5432/postgres | ||
| NEXTAUTH_SECRET: 1234567890 | ||
| NEXTAUTH_URL: http://localhost:3000 | ||
| ZERION_API_KEY: test_api_key_for_ci | ||
|
|
||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres:16 | ||
| env: | ||
| POSTGRES_PASSWORD: mysecretpassword | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --immutable | ||
|
|
||
| - name: Install Playwright Browsers (Chromium only) | ||
| run: cd packages/nextjs && npx playwright install chromium | ||
|
|
||
|
|
||
| - name: Setup database | ||
| run: | | ||
| cp packages/nextjs/services/database/seed.data.example.ts packages/nextjs/services/database/seed.data.ts | ||
| yarn drizzle-kit migrate | ||
| yarn db:reset | ||
| yarn db:seed | ||
| - name: Build Next.js application | ||
| run: yarn next:build | ||
| env: | ||
| FIREBASE_SERVICE_ACCOUNT_KEY: '{ | ||
| "type": "service_account", | ||
| "project_id": "your-project-id" | ||
| }' | ||
| FIREBASE_STORAGE_BUCKET: your-project-id.appspot.com | ||
|
|
||
| - name: Cache Synpress | ||
| run: | | ||
| cd packages/nextjs | ||
| xvfb-run yarn cache-synpress | ||
| env: | ||
| PLAYWRIGHT_TEST_BASE_URL: http://localhost:3000 | ||
| CI: true | ||
| continue-on-error: false | ||
|
|
||
| - name: Rename Synpress cache folder | ||
| run: | | ||
| cd packages/nextjs | ||
| mv .cache-synpress/532f685e346606c2a803 .cache-synpress/08a20e3c7fc77e6ae298 | ||
| - name: Run playwright tests | ||
| run: xvfb-run yarn next:test | ||
| env: | ||
| PLAYWRIGHT_TEST_BASE_URL: http://localhost:3000 | ||
|
|
||
| - name: List test report contents | ||
| run: | | ||
| echo "Contents of playwright-report directory:" | ||
| ls -la packages/nextjs/playwright-report/ || echo "playwright-report directory does not exist" | ||
| echo "Contents of test-results directory:" | ||
| ls -la packages/nextjs/test-results/ || echo "test-results directory does not exist" | ||
| - name: Upload test results | ||
| uses: actions/upload-artifact@v4 | ||
| if: ${{ !cancelled() }} | ||
| with: | ||
| name: playwright-report | ||
| path: packages/nextjs/playwright-report/ | ||
| retention-days: 30 | ||
| if-no-files-found: warn | ||
| compression-level: 6 | ||
| overwrite: false | ||
| include-hidden-files: false | ||
|
|
||
| - name: Upload test videos and traces | ||
| uses: actions/upload-artifact@v4 | ||
| if: failure() | ||
| with: | ||
| name: test-results | ||
| path: packages/nextjs/test-results/ | ||
| retention-days: 7 | ||
| if-no-files-found: ignore | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,62 @@ | ||
| import { defineConfig, devices } from "@playwright/test"; | ||
|
|
||
| /** | ||
| * Read environment variables from file. | ||
| * https://github.com/motdotla/dotenv | ||
| */ | ||
| // import dotenv from 'dotenv'; | ||
| // import path from 'path'; | ||
| // dotenv.config({ path: path.resolve(__dirname, '.env') }); | ||
|
|
||
| /** | ||
| * See https://playwright.dev/docs/test-configuration. | ||
| */ | ||
| export default defineConfig({ | ||
| testDir: "./test", | ||
| /* Run tests in files in parallel */ | ||
| fullyParallel: false, // Synpress requires sequential execution | ||
| /* 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: 1, // Synpress requires single worker | ||
| /* Timeout for each test */ | ||
| timeout: 60 * 1000, // 60 seconds | ||
| /* Global timeout for the whole test run */ | ||
| globalTimeout: process.env.CI ? 20 * 60 * 1000 : undefined, // 20 minutes in CI | ||
| /* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
| reporter: process.env.CI | ||
| ? [["github"], ["html", { outputFolder: "playwright-report", open: "never" }], ["list"]] | ||
| : [["html", { outputFolder: "playwright-report", open: "never" }], ["list"]], | ||
| /* 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: process.env.PLAYWRIGHT_TEST_BASE_URL || "http://localhost:3000", | ||
|
|
||
| /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
| trace: "on-first-retry", | ||
| /* Record video on failure in CI */ | ||
| // video: process.env.CI ? "retain-on-failure" : "off", | ||
| /* Take screenshot on failure */ | ||
| screenshot: "only-on-failure", | ||
| /* Action timeout */ | ||
| actionTimeout: 30 * 1000, // 30 seconds | ||
| /* Navigation timeout */ | ||
| navigationTimeout: 30 * 1000, // 30 seconds | ||
| }, | ||
|
|
||
| projects: [ | ||
| { | ||
| name: "chromium", | ||
| use: { ...devices["Desktop Chrome"] }, | ||
| }, | ||
| ], | ||
|
|
||
| /* Run your local dev server before starting the tests */ | ||
| webServer: { | ||
| command: process.env.CI ? "yarn serve" : "yarn start", | ||
| url: "http://localhost:3000", | ||
| reuseExistingServer: !process.env.CI, | ||
| }, | ||
| }); |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.