fix(editor): Fix and re-enable e2e test (no-changelog) (#13535)

This commit is contained in:
Csaba Tuncsik 2025-02-28 07:10:09 +01:00 committed by GitHub
parent 0c266b3060
commit 1c5f1cab37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 21 deletions

View file

@ -54,11 +54,7 @@ describe('Projects', { disableAutoLogin: true }, () => {
cy.changeQuota('maxTeamProjects', -1); cy.changeQuota('maxTeamProjects', -1);
}); });
/** it('should filter credentials by project ID when creating new workflow or hard reloading an opened workflow', () => {
* @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', () => {
cy.signinAsOwner(); cy.signinAsOwner();
cy.visit(workflowsPage.url); 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', () => { 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.signinAsOwner();
cy.visit(workflowsPage.url); cy.visit(workflowsPage.url);
@ -474,15 +472,14 @@ describe('Projects', { disableAutoLogin: true }, () => {
// Create a project and add a user to it // Create a project and add a user to it
projects.createProject('Project 1'); projects.createProject('Project 1');
projects.addProjectMember(INSTANCE_MEMBERS[0].email); projects.addProjectMember(INSTANCE_MEMBERS[0].email);
clearNotifications();
projects.getProjectSettingsSaveButton().click(); projects.getProjectSettingsSaveButton().click();
// Move the workflow from Home to Project 1 // Move the workflow from Home to Project 1
projects.getHomeButton().click(); projects.getHomeButton().click();
workflowsPage.getters workflowsPage.getters.workflowCards().should('have.length', 1);
.workflowCards() workflowsPage.getters.workflowCards().filter(':contains("Personal")').should('exist');
.should('have.length', 1)
.filter(':contains("Personal")')
.should('exist');
workflowsPage.getters.workflowCardActions('My workflow').click(); workflowsPage.getters.workflowCardActions('My workflow').click();
workflowsPage.getters.workflowMoveButton().click(); workflowsPage.getters.workflowMoveButton().click();
@ -492,13 +489,13 @@ describe('Projects', { disableAutoLogin: true }, () => {
.contains('button', 'Move workflow') .contains('button', 'Move workflow')
.should('be.disabled'); .should('be.disabled');
projects.getProjectMoveSelect().click(); projects.getProjectMoveSelect().click();
getVisibleSelect() getVisibleSelect().find('li').should('have.length', 4);
.find('li') getVisibleSelect().find('li').filter(':contains("Project 1")').click();
.should('have.length', 4)
.filter(':contains("Project 1")')
.click();
projects.getResourceMoveModal().contains('button', 'Move workflow').click(); projects.getResourceMoveModal().contains('button', 'Move workflow').click();
clearNotifications();
cy.wait('@getResources');
workflowsPage.getters workflowsPage.getters
.workflowCards() .workflowCards()
.should('have.length', 1) .should('have.length', 1)

View file

@ -16,9 +16,11 @@ export const clearNotifications = () => {
const notificationSelector = '.el-notification:has(.el-notification--success)'; const notificationSelector = '.el-notification:has(.el-notification--success)';
cy.get('body').then(($body) => { cy.get('body').then(($body) => {
if ($body.find(notificationSelector).length) { if ($body.find(notificationSelector).length) {
cy.get(notificationSelector) cy.get(notificationSelector).each(($el) => {
.find('.el-notification__closeBtn') if ($el.find('.el-notification__closeBtn').length) {
.click({ multiple: true, force: true }); cy.wrap($el).find('.el-notification__closeBtn').click({ force: true });
}
});
} }
}); });
}; };

View file

@ -10,7 +10,6 @@ import { ProjectTypes } from '@/types/projects.types';
import { useSettingsStore } from '@/stores/settings.store'; import { useSettingsStore } from '@/stores/settings.store';
import { hasPermission } from '@/utils/rbac/permissions'; import { hasPermission } from '@/utils/rbac/permissions';
import type { IWorkflowDb } from '@/Interface'; import type { IWorkflowDb } from '@/Interface';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useCredentialsStore } from '@/stores/credentials.store'; import { useCredentialsStore } from '@/stores/credentials.store';
import { STORES } from '@/constants'; import { STORES } from '@/constants';
import { useUsersStore } from '@/stores/users.store'; import { useUsersStore } from '@/stores/users.store';
@ -21,7 +20,6 @@ export const useProjectsStore = defineStore(STORES.PROJECTS, () => {
const route = useRoute(); const route = useRoute();
const rootStore = useRootStore(); const rootStore = useRootStore();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
const workflowsStore = useWorkflowsStore();
const credentialsStore = useCredentialsStore(); const credentialsStore = useCredentialsStore();
const usersStore = useUsersStore(); const usersStore = useUsersStore();
@ -168,7 +166,6 @@ export const useProjectsStore = defineStore(STORES.PROJECTS, () => {
destinationProjectId: projectId, destinationProjectId: projectId,
shareCredentials, shareCredentials,
}); });
await workflowsStore.fetchAllWorkflows(currentProjectId.value);
} else { } else {
await credentialsEEApi.moveCredentialToProject( await credentialsEEApi.moveCredentialToProject(
rootStore.restApiContext, rootStore.restApiContext,