chore(e2e): optimize variable and timeout

This commit is contained in:
Rain 2023-11-01 12:00:28 +08:00
parent 3b2ad2fa9f
commit 6449e2fdb8
4 changed files with 8 additions and 4 deletions

View File

@ -56,11 +56,15 @@ jobs:
${{ runner.os }}-yarn- ${{ runner.os }}-yarn-
- run: yarn install - run: yarn install
- run: yarn build - name: yarn build
run: yarn build
env:
__E2E__: true
- run: npx playwright install --with-deps - run: npx playwright install --with-deps
- name: Test with postgres - name: Test with postgres
run: yarn test:e2e run: yarn test:e2e
env: env:
__E2E__: true
LOGGER_LEVEL: error LOGGER_LEVEL: error
DB_DIALECT: postgres DB_DIALECT: postgres
DB_HOST: postgres DB_HOST: postgres

View File

@ -36,7 +36,7 @@ export function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: boolean
define: { define: {
'process.env.NODE_ENV': JSON.stringify('production'), 'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.__TEST__': false, 'process.env.__TEST__': false,
'process.env.__E2E__': false, 'process.env.__E2E__': process.env.__E2E__ ? true : false,
}, },
build: { build: {
minify: false, minify: false,

View File

@ -304,7 +304,7 @@ export async function buildPluginClient(cwd: string, userConfig: UserConfig, sou
define: { define: {
'process.env.NODE_ENV': JSON.stringify('production'), 'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.__TEST__': false, 'process.env.__TEST__': false,
'process.env.__E2E__': false, 'process.env.__E2E__': process.env.__E2E__ ? true : false,
}, },
logLevel: 'warn', logLevel: 'warn',
build: { build: {

View File

@ -1,7 +1,7 @@
import { defineConfig, devices } from '@playwright/test'; import { defineConfig, devices } from '@playwright/test';
export default defineConfig({ export default defineConfig({
timeout: process.env.CI ? 5 * 60 * 1000 : 60 * 1000, timeout: process.env.CI ? 60 * 1000 : 30 * 1000,
// Look for test files in the "tests" directory, relative to this configuration file. // Look for test files in the "tests" directory, relative to this configuration file.
testDir: 'packages', testDir: 'packages',