feat(editor): Using special env vars as feature flags in the frontend (#17355)

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Csaba Tuncsik
2025-07-17 16:06:21 +02:00
committed by GitHub
parent 5cc3b31b81
commit d36abb5a3a
13 changed files with 632 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
import 'cypress-real-events';
import type { FrontendSettings } from '@n8n/api-types';
import type { FrontendSettings, N8nEnvFeatFlags } from '@n8n/api-types';
import FakeTimers from '@sinonjs/fake-timers';
import {
@@ -115,6 +115,25 @@ Cypress.Commands.add('disableFeature', (feature: string) => setFeature(feature,
Cypress.Commands.add('enableQueueMode', () => setQueueMode(true));
Cypress.Commands.add('disableQueueMode', () => setQueueMode(false));
const setEnvFeatureFlags = (flags: N8nEnvFeatFlags) =>
cy.request('PATCH', `${BACKEND_BASE_URL}/rest/e2e/env-feature-flags`, {
flags,
});
const getEnvFeatureFlags = () =>
cy.request('GET', `${BACKEND_BASE_URL}/rest/e2e/env-feature-flags`);
// Environment feature flags commands (using E2E API)
Cypress.Commands.add('setEnvFeatureFlags', (flags: N8nEnvFeatFlags) =>
setEnvFeatureFlags(flags).then((response) => response.body.data),
);
Cypress.Commands.add('clearEnvFeatureFlags', () =>
setEnvFeatureFlags({}).then((response) => response.body.data),
);
Cypress.Commands.add('getEnvFeatureFlags', () =>
getEnvFeatureFlags().then((response) => response.body.data),
);
Cypress.Commands.add('grantBrowserPermissions', (...permissions: string[]) => {
if (Cypress.isBrowser('chrome')) {
cy.wrap(