From fb123b44afdcfaed1ccff1b9faab55eb8a866e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Fri, 15 Nov 2024 08:33:46 +0100 Subject: [PATCH] ci: Hide the github button in e2e tests (no-changelog) (#11747) --- cypress/e2e/1-workflows.cy.ts | 4 ---- cypress/e2e/17-workflow-tags.cy.ts | 2 -- cypress/e2e/19-execution.cy.ts | 1 - cypress/e2e/20-workflow-executions.cy.ts | 1 - cypress/e2e/34-template-credentials-setup.cy.ts | 1 - cypress/e2e/45-ai-assistant.cy.ts | 1 - cypress/e2e/5-ndv.cy.ts | 3 --- packages/@n8n/api-types/src/frontend-settings.ts | 3 ++- packages/cli/src/services/frontend.service.ts | 3 ++- packages/editor-ui/src/__tests__/defaults.ts | 1 + .../editor-ui/src/components/MainHeader/MainHeader.vue | 8 ++++++-- 11 files changed, 11 insertions(+), 17 deletions(-) diff --git a/cypress/e2e/1-workflows.cy.ts b/cypress/e2e/1-workflows.cy.ts index eb93c07ee6..a6683bbee4 100644 --- a/cypress/e2e/1-workflows.cy.ts +++ b/cypress/e2e/1-workflows.cy.ts @@ -23,7 +23,6 @@ describe('Workflows', () => { }); it('should create multiple new workflows using add workflow button', () => { - cy.viewport(1920, 1080); [...Array(multipleWorkflowsCount).keys()].forEach(() => { cy.visit(WorkflowsPage.url); WorkflowsPage.getters.createWorkflowButton().click(); @@ -36,7 +35,6 @@ describe('Workflows', () => { }); it('should search for a workflow', () => { - cy.viewport(1920, 1080); // One Result WorkflowsPage.getters.searchBar().type('Empty State Card Workflow'); WorkflowsPage.getters.workflowCards().should('have.length', 1); @@ -62,7 +60,6 @@ describe('Workflows', () => { }); it('should delete all the workflows', () => { - cy.viewport(1920, 1080); WorkflowsPage.getters.workflowCards().should('have.length', multipleWorkflowsCount + 1); WorkflowsPage.getters.workflowCards().each(($el) => { @@ -78,7 +75,6 @@ describe('Workflows', () => { }); it('should respect tag querystring filter when listing workflows', () => { - cy.viewport(1920, 1080); WorkflowsPage.getters.newWorkflowButtonCard().click(); cy.createFixtureWorkflow('Test_workflow_2.json', getUniqueWorkflowName('My New Workflow')); diff --git a/cypress/e2e/17-workflow-tags.cy.ts b/cypress/e2e/17-workflow-tags.cy.ts index e8dacca2b8..26ea7cbe2c 100644 --- a/cypress/e2e/17-workflow-tags.cy.ts +++ b/cypress/e2e/17-workflow-tags.cy.ts @@ -53,7 +53,6 @@ describe('Workflow tags', () => { }); it('should detach a tag inline by clicking on X on tag pill', () => { - cy.viewport(1920, 1080); wf.getters.createTagButton().click(); wf.actions.addTags(TEST_TAGS); wf.getters.nthTagPill(1).click(); @@ -74,7 +73,6 @@ describe('Workflow tags', () => { }); it('should not show non existing tag as a selectable option', () => { - cy.viewport(1920, 1080); const NON_EXISTING_TAG = 'My Test Tag'; wf.getters.createTagButton().click(); diff --git a/cypress/e2e/19-execution.cy.ts b/cypress/e2e/19-execution.cy.ts index b8b30dd7a9..5be2399253 100644 --- a/cypress/e2e/19-execution.cy.ts +++ b/cypress/e2e/19-execution.cy.ts @@ -514,7 +514,6 @@ describe('Execution', () => { }); it('should send proper payload for node rerun', () => { - cy.viewport(1920, 1080); cy.createFixtureWorkflow('Multiple_trigger_node_rerun.json', 'Multiple trigger node rerun'); workflowPage.getters.zoomToFitButton().click(); diff --git a/cypress/e2e/20-workflow-executions.cy.ts b/cypress/e2e/20-workflow-executions.cy.ts index bfa9bca1d9..5788af171c 100644 --- a/cypress/e2e/20-workflow-executions.cy.ts +++ b/cypress/e2e/20-workflow-executions.cy.ts @@ -101,7 +101,6 @@ describe('Workflow Executions', () => { }); it('should show workflow data in executions tab after hard reload and modify name and tags', () => { - cy.viewport(1920, 1080); executionsTab.actions.switchToExecutionsTab(); checkMainHeaderELements(); workflowPage.getters.saveButton().find('button').should('not.exist'); diff --git a/cypress/e2e/34-template-credentials-setup.cy.ts b/cypress/e2e/34-template-credentials-setup.cy.ts index a2f9a019f7..815f4b1ceb 100644 --- a/cypress/e2e/34-template-credentials-setup.cy.ts +++ b/cypress/e2e/34-template-credentials-setup.cy.ts @@ -182,7 +182,6 @@ describe('Template credentials setup', () => { }); it('should fill credentials from workflow editor', () => { - cy.viewport(1920, 1080); templateCredentialsSetupPage.visitTemplateCredentialSetupPage(testTemplate.id); templateCredentialsSetupPage.getters.skipLink().click(); diff --git a/cypress/e2e/45-ai-assistant.cy.ts b/cypress/e2e/45-ai-assistant.cy.ts index 7f9c79e0e6..9b50fef44a 100644 --- a/cypress/e2e/45-ai-assistant.cy.ts +++ b/cypress/e2e/45-ai-assistant.cy.ts @@ -36,7 +36,6 @@ describe('AI Assistant::enabled', () => { }); it('renders placeholder UI', () => { - cy.viewport(1920, 1080); aiAssistant.getters.askAssistantFloatingButton().should('be.visible'); aiAssistant.getters.askAssistantFloatingButton().click(); aiAssistant.getters.askAssistantChat().should('be.visible'); diff --git a/cypress/e2e/5-ndv.cy.ts b/cypress/e2e/5-ndv.cy.ts index 9ad1fceae1..96b917d4c3 100644 --- a/cypress/e2e/5-ndv.cy.ts +++ b/cypress/e2e/5-ndv.cy.ts @@ -66,7 +66,6 @@ describe('NDV', () => { }); it('should disconect Switch outputs if rules order was changed', () => { - cy.viewport(1920, 1080); cy.createFixtureWorkflow('NDV-test-switch_reorder.json', 'NDV test switch reorder'); workflowPage.actions.zoomToFit(); @@ -233,7 +232,6 @@ describe('NDV', () => { ndv.getters.outputPanel().find('[class*=_pagination]').should('exist'); }); it('should display large schema', () => { - cy.viewport(1920, 1080); cy.createFixtureWorkflow( 'Test_workflow_schema_test_pinned_data.json', 'NDV test schema view 2', @@ -720,7 +718,6 @@ describe('NDV', () => { }); it('Should open appropriate node creator after clicking on connection hint link', () => { - cy.viewport(1920, 1080); const nodeCreator = new NodeCreator(); const hintMapper = { Memory: 'AI Nodes', diff --git a/packages/@n8n/api-types/src/frontend-settings.ts b/packages/@n8n/api-types/src/frontend-settings.ts index 6b2f3231d3..54b7956821 100644 --- a/packages/@n8n/api-types/src/frontend-settings.ts +++ b/packages/@n8n/api-types/src/frontend-settings.ts @@ -27,7 +27,8 @@ export interface IUserManagementSettings { } export interface FrontendSettings { - isDocker?: boolean; + inE2ETests: boolean; + isDocker: boolean; databaseType: 'sqlite' | 'mariadb' | 'mysqldb' | 'postgresdb'; endpointForm: string; endpointFormTest: string; diff --git a/packages/cli/src/services/frontend.service.ts b/packages/cli/src/services/frontend.service.ts index 7d9fe7d2b4..081ef5fd4a 100644 --- a/packages/cli/src/services/frontend.service.ts +++ b/packages/cli/src/services/frontend.service.ts @@ -10,7 +10,7 @@ import path from 'path'; import { Container, Service } from 'typedi'; import config from '@/config'; -import { LICENSE_FEATURES, N8N_VERSION } from '@/constants'; +import { inE2ETests, LICENSE_FEATURES, N8N_VERSION } from '@/constants'; import { CredentialTypes } from '@/credential-types'; import { CredentialsOverwrites } from '@/credentials-overwrites'; import { getVariablesLimit } from '@/environments/variables/environment-helpers'; @@ -82,6 +82,7 @@ export class FrontendService { } this.settings = { + inE2ETests, isDocker: this.isDocker(), databaseType: this.globalConfig.database.type, previewMode: process.env.N8N_PREVIEW_MODE === 'true', diff --git a/packages/editor-ui/src/__tests__/defaults.ts b/packages/editor-ui/src/__tests__/defaults.ts index d2181db151..5746ca5a20 100644 --- a/packages/editor-ui/src/__tests__/defaults.ts +++ b/packages/editor-ui/src/__tests__/defaults.ts @@ -1,6 +1,7 @@ import type { FrontendSettings } from '@n8n/api-types'; export const defaultSettings: FrontendSettings = { + inE2ETests: false, databaseType: 'sqlite', isDocker: false, pruning: { diff --git a/packages/editor-ui/src/components/MainHeader/MainHeader.vue b/packages/editor-ui/src/components/MainHeader/MainHeader.vue index 67428421e0..280eed9d36 100644 --- a/packages/editor-ui/src/components/MainHeader/MainHeader.vue +++ b/packages/editor-ui/src/components/MainHeader/MainHeader.vue @@ -16,6 +16,7 @@ import { useSourceControlStore } from '@/stores/sourceControl.store'; import { useUIStore } from '@/stores/ui.store'; import { useWorkflowsStore } from '@/stores/workflows.store'; import { useExecutionsStore } from '@/stores/executions.store'; +import { useSettingsStore } from '@/stores/settings.store'; import { usePushConnection } from '@/composables/usePushConnection'; import GithubButton from 'vue-github-button'; @@ -29,6 +30,7 @@ const uiStore = useUIStore(); const sourceControlStore = useSourceControlStore(); const workflowsStore = useWorkflowsStore(); const executionsStore = useExecutionsStore(); +const settingsStore = useSettingsStore(); const activeHeaderTab = ref(MAIN_HEADER_TABS.WORKFLOW); const workflowToReturnTo = ref(''); @@ -50,6 +52,7 @@ const workflowId = computed(() => ); const onWorkflowPage = computed(() => !!(route.meta.nodeView || route.meta.keepWorkflowAlive)); const readOnly = computed(() => sourceControlStore.preferences.branchReadOnly); +const showGitHubButton = computed(() => !settingsStore.settings.inE2ETests); watch(route, (to, from) => { syncTabsWithRoute(to, from); @@ -184,15 +187,16 @@ async function navigateToExecutionsView(openInNewTab: boolean) { @update:model-value="onTabSelected" /> -
+
Star + Star +