chore(ci): e2e against vercel deployement (#518)

This commit is contained in:
Corentin THOMASSET 2023-06-29 20:27:35 +02:00 committed by GitHub
parent d12dd40841
commit 2e28c5073e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 42 deletions

View file

@ -1,13 +1,13 @@
name: E2E tests
on:
pull_request:
push:
branches:
- main
on: [deployment_status]
jobs:
test:
if: github.event.deployment_status.state == 'success'
timeout-minutes: 60
runs-on: ubuntu-latest
env:
BASE_URL: ${{ github.event.deployment_status.target_url }}
strategy:
matrix:
shard: [1/3, 2/3, 3/3]
@ -28,9 +28,6 @@ jobs:
- name: Install dependencies
run: pnpm install
- name: Build app
run: pnpm build
- name: Restore Playwright browsers from cache
uses: actions/cache@v3
with:

View file

@ -1,10 +1,7 @@
import { defineConfig, devices } from '@playwright/test';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
const isCI = !!process.env.CI;
const baseUrl = process.env.BASE_URL || 'http://localhost:5050';
/**
* See https://playwright.dev/docs/test-configuration.
@ -15,17 +12,17 @@ export default defineConfig({
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
forbidOnly: isCI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
retries: isCI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
workers: isCI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* 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:5050',
baseURL: baseUrl,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
@ -51,32 +48,17 @@ export default defineConfig({
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ..devices['Desktop Chrome'], channel: 'chrome' },
// },
],
/* Run your local dev server before starting the tests */
...(isCI
? {}
: {
webServer: {
command: 'npm run preview',
url: 'http://127.0.0.1:5050',
reuseExistingServer: !process.env.CI,
reuseExistingServer: true,
},
}),
});