chore: working pattern for debugging e2e and int

This commit is contained in:
James
2024-04-02 10:01:47 -04:00
parent 73a555788d
commit d387f9f1fa
4 changed files with 4 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ import type { GeneratedTypes } from './sdk/types.js'
import { createTestHooks } from '../testHooks.js' import { createTestHooks } from '../testHooks.js'
import { PayloadTestSDK } from './sdk/index.js' import { PayloadTestSDK } from './sdk/index.js'
import startMemoryDB from './startMemoryDB.js'
type Args = { type Args = {
dirname: string dirname: string
@@ -29,6 +30,8 @@ export async function initPayloadE2ENoConfig<T extends GeneratedTypes<T>>({
process.env.PORT = String(port) process.env.PORT = String(port)
const serverURL = `http://localhost:${port}` const serverURL = `http://localhost:${port}`
await startMemoryDB()
// @ts-expect-error // @ts-expect-error
const app = nextImport({ const app = nextImport({
dev: true, dev: true,

View File

@@ -16,7 +16,7 @@ const customJestConfig = {
}, },
reporters: ['default', ['github-actions', { silent: false }], 'summary'], reporters: ['default', ['github-actions', { silent: false }], 'summary'],
testEnvironment: 'node', testEnvironment: 'node',
globalSetup: path.resolve(dirname, 'setup.ts'), globalSetup: path.resolve(dirname, './helpers/startMemoryDB.ts'),
testMatch: ['<rootDir>/**/*int.spec.ts'], testMatch: ['<rootDir>/**/*int.spec.ts'],
testTimeout: 90000, testTimeout: 90000,
transform: { transform: {

View File

@@ -1,9 +1,4 @@
import { defineConfig } from '@playwright/test' import { defineConfig } from '@playwright/test'
import path from 'path'
import { fileURLToPath } from 'url'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
export const EXPECT_TIMEOUT = 45000 export const EXPECT_TIMEOUT = 45000
export const POLL_TOPASS_TIMEOUT = EXPECT_TIMEOUT * 4 // That way expect.poll() or expect().toPass can retry 4 times. 4x higher than default expect timeout => can retry 4 times if retryable expects are used inside export const POLL_TOPASS_TIMEOUT = EXPECT_TIMEOUT * 4 // That way expect.poll() or expect().toPass can retry 4 times. 4x higher than default expect timeout => can retry 4 times if retryable expects are used inside
@@ -18,7 +13,6 @@ export default defineConfig({
trace: 'retain-on-failure', trace: 'retain-on-failure',
video: 'retain-on-failure', video: 'retain-on-failure',
}, },
globalSetup: path.resolve(dirname, 'setup.js'),
expect: { expect: {
timeout: EXPECT_TIMEOUT, timeout: EXPECT_TIMEOUT,
}, },