From 1c5f1cab37972da60e7f304c7667b04a0d5f0024 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Fri, 28 Feb 2025 07:10:09 +0100 Subject: [PATCH] fix(editor): Fix and re-enable e2e test (no-changelog) (#13535) --- cypress/e2e/39-projects.cy.ts | 27 +++++++++---------- cypress/pages/notifications.ts | 8 +++--- .../editor-ui/src/stores/projects.store.ts | 3 --- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/cypress/e2e/39-projects.cy.ts b/cypress/e2e/39-projects.cy.ts index 09b9c2bb65..d8c618539f 100644 --- a/cypress/e2e/39-projects.cy.ts +++ b/cypress/e2e/39-projects.cy.ts @@ -54,11 +54,7 @@ describe('Projects', { disableAutoLogin: true }, () => { cy.changeQuota('maxTeamProjects', -1); }); - /** - * @TODO: New Canvas - Fix this test - */ - // eslint-disable-next-line n8n-local-rules/no-skipped-tests - it.skip('should filter credentials by project ID when creating new workflow or hard reloading an opened workflow', () => { + it('should filter credentials by project ID when creating new workflow or hard reloading an opened workflow', () => { cy.signinAsOwner(); cy.visit(workflowsPage.url); @@ -453,6 +449,8 @@ describe('Projects', { disableAutoLogin: true }, () => { }); it('should allow to change inaccessible credential when the workflow was moved to a team project', () => { + cy.intercept('GET', /\/rest\/(workflows|credentials).*/).as('getResources'); + cy.signinAsOwner(); cy.visit(workflowsPage.url); @@ -474,15 +472,14 @@ describe('Projects', { disableAutoLogin: true }, () => { // Create a project and add a user to it projects.createProject('Project 1'); projects.addProjectMember(INSTANCE_MEMBERS[0].email); + + clearNotifications(); projects.getProjectSettingsSaveButton().click(); // Move the workflow from Home to Project 1 projects.getHomeButton().click(); - workflowsPage.getters - .workflowCards() - .should('have.length', 1) - .filter(':contains("Personal")') - .should('exist'); + workflowsPage.getters.workflowCards().should('have.length', 1); + workflowsPage.getters.workflowCards().filter(':contains("Personal")').should('exist'); workflowsPage.getters.workflowCardActions('My workflow').click(); workflowsPage.getters.workflowMoveButton().click(); @@ -492,13 +489,13 @@ describe('Projects', { disableAutoLogin: true }, () => { .contains('button', 'Move workflow') .should('be.disabled'); projects.getProjectMoveSelect().click(); - getVisibleSelect() - .find('li') - .should('have.length', 4) - .filter(':contains("Project 1")') - .click(); + getVisibleSelect().find('li').should('have.length', 4); + getVisibleSelect().find('li').filter(':contains("Project 1")').click(); projects.getResourceMoveModal().contains('button', 'Move workflow').click(); + clearNotifications(); + cy.wait('@getResources'); + workflowsPage.getters .workflowCards() .should('have.length', 1) diff --git a/cypress/pages/notifications.ts b/cypress/pages/notifications.ts index 46db264633..2c3648355a 100644 --- a/cypress/pages/notifications.ts +++ b/cypress/pages/notifications.ts @@ -16,9 +16,11 @@ export const clearNotifications = () => { const notificationSelector = '.el-notification:has(.el-notification--success)'; cy.get('body').then(($body) => { if ($body.find(notificationSelector).length) { - cy.get(notificationSelector) - .find('.el-notification__closeBtn') - .click({ multiple: true, force: true }); + cy.get(notificationSelector).each(($el) => { + if ($el.find('.el-notification__closeBtn').length) { + cy.wrap($el).find('.el-notification__closeBtn').click({ force: true }); + } + }); } }); }; diff --git a/packages/editor-ui/src/stores/projects.store.ts b/packages/editor-ui/src/stores/projects.store.ts index 0183236517..ee882e1dff 100644 --- a/packages/editor-ui/src/stores/projects.store.ts +++ b/packages/editor-ui/src/stores/projects.store.ts @@ -10,7 +10,6 @@ import { ProjectTypes } from '@/types/projects.types'; import { useSettingsStore } from '@/stores/settings.store'; import { hasPermission } from '@/utils/rbac/permissions'; import type { IWorkflowDb } from '@/Interface'; -import { useWorkflowsStore } from '@/stores/workflows.store'; import { useCredentialsStore } from '@/stores/credentials.store'; import { STORES } from '@/constants'; import { useUsersStore } from '@/stores/users.store'; @@ -21,7 +20,6 @@ export const useProjectsStore = defineStore(STORES.PROJECTS, () => { const route = useRoute(); const rootStore = useRootStore(); const settingsStore = useSettingsStore(); - const workflowsStore = useWorkflowsStore(); const credentialsStore = useCredentialsStore(); const usersStore = useUsersStore(); @@ -168,7 +166,6 @@ export const useProjectsStore = defineStore(STORES.PROJECTS, () => { destinationProjectId: projectId, shareCredentials, }); - await workflowsStore.fetchAllWorkflows(currentProjectId.value); } else { await credentialsEEApi.moveCredentialToProject( rootStore.restApiContext,