mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 14:56:17 -04:00
refactor(CI): run e2e against built app and no longer vercel (#610)
This commit is contained in:
parent
f035f485c0
commit
18dd1400bd
4 changed files with 20 additions and 17 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -31,6 +31,4 @@ jobs:
|
||||||
run: pnpm typecheck
|
run: pnpm typecheck
|
||||||
|
|
||||||
- name: Build the app
|
- name: Build the app
|
||||||
env:
|
|
||||||
NODE_OPTIONS: --max-old-space-size=4096
|
|
||||||
run: pnpm build
|
run: pnpm build
|
||||||
|
|
13
.github/workflows/e2e-tests.yml
vendored
13
.github/workflows/e2e-tests.yml
vendored
|
@ -1,13 +1,13 @@
|
||||||
name: E2E tests
|
name: E2E tests
|
||||||
on: [deployment_status]
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
if: github.event.deployment_status.state == 'success'
|
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
BASE_URL: ${{ github.event.deployment_status.target_url }}
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
shard: [1/3, 2/3, 3/3]
|
shard: [1/3, 2/3, 3/3]
|
||||||
|
@ -28,6 +28,9 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Build app
|
||||||
|
run: pnpm build
|
||||||
|
|
||||||
- name: Restore Playwright browsers from cache
|
- name: Restore Playwright browsers from cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -21,11 +21,12 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && NODE_OPTIONS=--max_old_space_size=4096 vite build",
|
||||||
"preview": "vite preview --port 5050",
|
"preview": "vite preview --port 5050",
|
||||||
"test": "npm run test:unit",
|
"test": "npm run test:unit",
|
||||||
"test:unit": "vitest --environment jsdom",
|
"test:unit": "vitest --environment jsdom",
|
||||||
"test:e2e": "playwright test",
|
"test:e2e": "playwright test",
|
||||||
|
"test:e2e:dev": "BASE_URL=http://localhost:5173 NO_WEB_SERVER=true playwright test",
|
||||||
"coverage": "vitest run --coverage",
|
"coverage": "vitest run --coverage",
|
||||||
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
|
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
|
||||||
"lint": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore",
|
"lint": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore",
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { defineConfig, devices } from '@playwright/test';
|
||||||
|
|
||||||
const isCI = !!process.env.CI;
|
const isCI = !!process.env.CI;
|
||||||
const baseUrl = process.env.BASE_URL || 'http://localhost:5050';
|
const baseUrl = process.env.BASE_URL || 'http://localhost:5050';
|
||||||
|
const useWebServer = process.env.NO_WEB_SERVER !== 'true';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See https://playwright.dev/docs/test-configuration.
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
|
@ -52,13 +53,13 @@ export default defineConfig({
|
||||||
|
|
||||||
/* Run your local dev server before starting the tests */
|
/* Run your local dev server before starting the tests */
|
||||||
|
|
||||||
...(isCI
|
...(useWebServer
|
||||||
? {}
|
&& {
|
||||||
: {
|
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run preview',
|
command: 'npm run preview',
|
||||||
url: 'http://127.0.0.1:5050',
|
url: 'http://127.0.0.1:5050',
|
||||||
reuseExistingServer: true,
|
reuseExistingServer: !isCI,
|
||||||
},
|
},
|
||||||
}),
|
}
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue