Skip to content

Commit

Permalink
fixed configuration test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsingal committed Oct 18, 2023
1 parent 6752389 commit d1184c7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
jobs:
test_setup:
name: Test setup
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
preview_url: ${{ steps.waitForVercelPreviewDeployment.outputs.url }}
steps:
Expand All @@ -19,16 +19,16 @@ jobs:
needs: test_setup
name: Test
timeout-minutes: 60
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: '.nvmrc'
- name: Install dependencies
run: yarn
run: yarn install --immutable
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
run: yarn playwright install --with-deps chromium firefox webkit
- name: Run Playwright tests
run: yarn playwright test
env:
Expand Down
33 changes: 21 additions & 12 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,43 @@ import { defineConfig, devices } from '@playwright/test';
/**
* See https://playwright.dev/docs/test-configuration.
*/
const PORT = process.env.PORT || 3000;

export default defineConfig({
testDir: 'tests',
outputDir: 'test-results',
timeout: 60000,
globalTimeout: 60000,
expect: {
timeout: 60000,
},
/* Run your local dev server before starting the tests */
webServer: process.env.CI
? undefined
: {
command: process.env.CI ? 'yarn build && yarn start' : 'yarn dev',
url: `http://localhost:${PORT}`,
reuseExistingServer: !process.env.CI,
timeout: 300000,
},
/* Run tests in files in parallel */
fullyParallel: true,
fullyParallel: !process.env.CI,
/* 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: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: [['list'], ['html', { open: 'never' }]],
/* 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: 'http://127.0.0.1:3000',
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000',
baseURL: process.env.CI ? process.env.PLAYWRIGHT_TEST_BASE_URL : `http://localhost:${PORT}`,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
navigationTimeout: 60000,
},

/* Configure projects for major browsers */
Expand Down Expand Up @@ -67,12 +84,4 @@ export default defineConfig({
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
webServer: {
// command: process.env.CI ? 'yarn build && yarn start' : 'yarn dev',
command: 'yarn dev',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
});

0 comments on commit d1184c7

Please sign in to comment.