ci: Make end-to-end testing independent of development environments (no-changelog) (#4709)
* use user-folder override consistently everywhere, including for the `.cache` folder * use consistent config for e2e tesing, skipping config loading from env and config files * simplify all the cypress commands, and run all e2e tests on master
This commit is contained in:
committed by
GitHub
parent
b18ae18a6b
commit
500775de69
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { createTransport, Transporter } from 'nodemailer';
|
||||
import { ErrorReporterProxy as ErrorReporter, LoggerProxy as Logger } from 'n8n-workflow';
|
||||
import * as config from '@/config';
|
||||
import config from '@/config';
|
||||
import { MailData, SendEmailResult, UserManagementMailerImplementation } from './Interfaces';
|
||||
|
||||
export class NodeMailer implements UserManagementMailerImplementation {
|
||||
|
||||
@@ -1,28 +1,55 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable no-console */
|
||||
import convict from 'convict';
|
||||
import dotenv from 'dotenv';
|
||||
import { tmpdir } from 'os';
|
||||
import { mkdtempSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { schema } from './schema';
|
||||
|
||||
dotenv.config();
|
||||
const inE2ETests = process.env.E2E_TESTS === 'true';
|
||||
|
||||
if (inE2ETests) {
|
||||
// Skip loading config from env variables in end-to-end tests
|
||||
process.env = {
|
||||
N8N_USER_FOLDER: mkdtempSync(join(tmpdir(), 'n8n-e2e-')),
|
||||
N8N_DIAGNOSTICS_ENABLED: 'false',
|
||||
N8N_PUBLIC_API_DISABLED: 'true',
|
||||
EXTERNAL_FRONTEND_HOOKS_URLS: '',
|
||||
N8N_PERSONALIZATION_ENABLED: 'false',
|
||||
};
|
||||
} else {
|
||||
dotenv.config();
|
||||
}
|
||||
|
||||
const config = convict(schema);
|
||||
|
||||
if (inE2ETests) {
|
||||
config.set('enterprise.features.sharing', true);
|
||||
config.set('enterprise.workflowSharingEnabled', true);
|
||||
}
|
||||
|
||||
config.getEnv = config.get;
|
||||
|
||||
// Overwrite default configuration with settings which got defined in
|
||||
// optional configuration files
|
||||
if (process.env.N8N_CONFIG_FILES !== undefined) {
|
||||
const configFiles = process.env.N8N_CONFIG_FILES.split(',');
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
console.log(`\nLoading configuration overwrites from:\n - ${configFiles.join('\n - ')}\n`);
|
||||
}
|
||||
if (!inE2ETests) {
|
||||
// Overwrite default configuration with settings which got defined in
|
||||
// optional configuration files
|
||||
const { N8N_CONFIG_FILES, NODE_ENV } = process.env;
|
||||
if (N8N_CONFIG_FILES !== undefined) {
|
||||
const configFiles = N8N_CONFIG_FILES.split(',');
|
||||
if (NODE_ENV !== 'test') {
|
||||
console.log(`\nLoading configuration overwrites from:\n - ${configFiles.join('\n - ')}\n`);
|
||||
}
|
||||
|
||||
config.loadFile(configFiles);
|
||||
config.loadFile(configFiles);
|
||||
}
|
||||
}
|
||||
|
||||
config.validate({
|
||||
allowed: 'strict',
|
||||
});
|
||||
|
||||
export = config;
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default config;
|
||||
export type Config = typeof config;
|
||||
|
||||
Reference in New Issue
Block a user