ci: Make pinning e2e test work locally (no-changelog) (#9954)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-07-05 16:52:12 +02:00 committed by GitHub
parent 2a2c79886d
commit bbb2296b3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 15 additions and 15 deletions

View file

@ -99,8 +99,6 @@ jobs:
runTests: false
install: false
build: pnpm build
env:
VUE_APP_MAX_PINNED_DATA_SIZE: 16384
- name: Cypress install
working-directory: cypress

View file

@ -25,9 +25,4 @@ module.exports = defineConfig({
screenshotsFolder: 'screenshots',
videosFolder: 'videos',
},
env: {
MAX_PINNED_DATA_SIZE: process.env.VUE_APP_MAX_PINNED_DATA_SIZE
? parseInt(process.env.VUE_APP_MAX_PINNED_DATA_SIZE, 10)
: 16 * 1024,
},
});

View file

@ -12,8 +12,13 @@ const workflowPage = new WorkflowPage();
const ndv = new NDV();
describe('Data pinning', () => {
const maxPinnedDataSize = 16384;
beforeEach(() => {
workflowPage.actions.visit();
cy.window().then((win) => {
win.maxPinnedDataSize = maxPinnedDataSize;
});
});
it('Should be able to pin node output', () => {
@ -139,7 +144,7 @@ describe('Data pinning', () => {
ndv.actions.pastePinnedData([
{
test: '1'.repeat(Cypress.env('MAX_PINNED_DATA_SIZE') as number),
test: '1'.repeat(maxPinnedDataSize),
},
]);
errorToast().should('contain', 'Workflow has reached the maximum allowed pinned data size');

View file

@ -13,7 +13,6 @@ function runTests(options) {
process.env.N8N_USER_FOLDER = userFolder;
process.env.E2E_TESTS = 'true';
process.env.NODE_OPTIONS = '--dns-result-order=ipv4first';
process.env.VUE_APP_MAX_PINNED_DATA_SIZE = `${16 * 1024}`;
if (options.customEnv) {
Object.keys(options.customEnv).forEach((key) => {

View file

@ -64,6 +64,7 @@ declare global {
innerWidth: number;
innerHeight: number;
preventNodeViewBeforeUnload?: boolean;
maxPinnedDataSize?: number;
featureFlags: {
override: (feature: string, value: unknown) => void;
};

View file

@ -140,6 +140,10 @@ export function usePinnedData(
}
}
function getMaxPinnedDataSize() {
return window.maxPinnedDataSize ?? MAX_PINNED_DATA_SIZE;
}
function isValidSize(data: string | object): boolean {
const targetNode = unref(node);
if (!targetNode) {
@ -154,13 +158,13 @@ export function usePinnedData(
const newPinData = { ...currentPinData, [targetNode.name]: data };
const newPinDataSize = workflowsStore.getPinDataSize(newPinData);
if (newPinDataSize > MAX_PINNED_DATA_SIZE) {
if (newPinDataSize > getMaxPinnedDataSize()) {
toast.showError(
new Error(
i18n.baseText('ndv.pinData.error.tooLarge.description', {
interpolate: {
size: toMegaBytes(newPinDataSize),
limit: toMegaBytes(MAX_PINNED_DATA_SIZE),
limit: toMegaBytes(getMaxPinnedDataSize()),
},
}),
),

View file

@ -9,9 +9,7 @@ import type { InjectionKey } from 'vue';
export const MAX_WORKFLOW_SIZE = 1024 * 1024 * 16; // Workflow size limit in bytes
export const MAX_EXPECTED_REQUEST_SIZE = 2048; // Expected maximum workflow request metadata (i.e. headers) size in bytes
export const MAX_PINNED_DATA_SIZE = import.meta.env.VUE_APP_MAX_PINNED_DATA_SIZE
? parseInt(import.meta.env.VUE_APP_MAX_PINNED_DATA_SIZE, 10)
: 1024 * 1024 * 12; // 12 MB; Workflow pinned data size limit in bytes
export const MAX_PINNED_DATA_SIZE = 1024 * 1024 * 12; // 12 MB; Workflow pinned data size limit in bytes
export const MAX_DISPLAY_DATA_SIZE = 1024 * 1024; // 1 MB
export const MAX_DISPLAY_DATA_SIZE_SCHEMA_VIEW = 1024 * 1024 * 4; // 4 MB
export const MAX_DISPLAY_ITEMS_AUTO_ALL = 250;

View file

@ -11,7 +11,6 @@ declare global {
PROD: boolean;
NODE_ENV: 'development' | 'production';
VUE_APP_URL_BASE_API: string;
VUE_APP_MAX_PINNED_DATA_SIZE: string;
};
}
@ -20,6 +19,7 @@ declare global {
REST_ENDPOINT: string;
n8nExternalHooks?: PartialDeep<ExternalHooks>;
preventNodeViewBeforeUnload?: boolean;
maxPinnedDataSize?: number;
}
namespace JSX {