Skip to content

Commit

Permalink
feat(testing): set baseURL dynamically for Playwright tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amalv committed Jan 9, 2024
1 parent b0f4a56 commit cfa3bdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ jobs:
- name: Set deploy URL
id: url
run: echo "::set-output name=DEPLOY_URL::$(cat deploy-url.txt)"
- name: Debug deploy URL
run: echo "DEPLOY_URL: ${{ steps.url.outputs.DEPLOY_URL }}"
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
Expand All @@ -83,7 +85,7 @@ jobs:
- name: Run Playwright tests
run: npx playwright test
env:
URL: ${{ steps.url.outputs.DEPLOY_URL }}
PLAYWRIGHT_TEST_BASE_URL: ${{ steps.url.outputs.DEPLOY_URL }}
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default defineConfig({
/* 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.PRODUCTION_BASE_URL || "http://localhost:5173",
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || "http://localhost:5173",

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
Expand Down

0 comments on commit cfa3bdd

Please sign in to comment.