Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/e2e-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions cypress/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
7 changes: 6 additions & 1 deletion cypress/e2e/13-pinning.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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');
Expand Down
1 change: 0 additions & 1 deletion cypress/scripts/run-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
1 change: 1 addition & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ declare global {
innerWidth: number;
innerHeight: number;
preventNodeViewBeforeUnload?: boolean;
maxPinnedDataSize?: number;
featureFlags: {
override: (feature: string, value: unknown) => void;
};
Expand Down
8 changes: 6 additions & 2 deletions packages/editor-ui/src/composables/usePinnedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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()),
},
}),
),
Expand Down
4 changes: 1 addition & 3 deletions packages/editor-ui/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/shims.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
}

Expand All @@ -20,6 +19,7 @@ declare global {
REST_ENDPOINT: string;
n8nExternalHooks?: PartialDeep<ExternalHooks>;
preventNodeViewBeforeUnload?: boolean;
maxPinnedDataSize?: number;
}

namespace JSX {
Expand Down
Loading