ci: Enable Playwright tests in PRs (#17238)

This commit is contained in:
shortstacked
2025-07-16 09:05:11 +01:00
committed by GitHub
parent 4bba13ccb8
commit e63ae55a0c
15 changed files with 436 additions and 267 deletions

View File

@@ -1,6 +1,9 @@
import type { CurrentsConfig } from '@currents/playwright';
export const config: CurrentsConfig = {
const config: CurrentsConfig = {
recordKey: process.env.CURRENTS_RECORD_KEY ?? '',
projectId: process.env.CURRENTS_PROJECT_ID ?? 'I0yzoc',
};
// eslint-disable-next-line import-x/no-default-export
export default config;

View File

@@ -1,6 +1,18 @@
import { request } from '@playwright/test';
import { ApiHelpers } from './services/api-helper';
import { createN8NStack } from 'n8n-containers/n8n-test-container-creation';
async function pullImagesForCI() {
console.log(`🔄 Pulling images for ${process.env.N8N_DOCKER_IMAGE}...`);
const stack = await createN8NStack({
postgres: true,
});
console.log(`🔄 Images pulled for ${process.env.N8N_DOCKER_IMAGE}...`);
await stack.stop();
}
async function globalSetup() {
console.log('🚀 Starting global setup...');
@@ -9,6 +21,9 @@ async function globalSetup() {
const n8nBaseUrl = process.env.N8N_BASE_URL;
if (!n8nBaseUrl) {
console.log('⚠️ N8N_BASE_URL environment variable is not set, skipping database reset');
if (process.env.CI) {
await pullImagesForCI();
}
return;
}

View File

@@ -1,7 +1,10 @@
/* eslint-disable import-x/no-default-export */
import { currentsReporter } from '@currents/playwright';
import type { Project } from '@playwright/test';
import { defineConfig } from '@playwright/test';
import currentsConfig from './currents.config';
/*
* Mode-based Test Configuration
*
@@ -105,6 +108,7 @@ export default defineConfig({
['html', { open: 'never' }],
['json', { outputFile: 'test-results.json' }],
['blob'],
currentsReporter(currentsConfig),
]
: [['html']],