mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
feat(editor): Combine 'Move to Folder' and 'Change owner' modals (#15756)
This new modal also allows transferring entire folders to other projects and users.
This commit is contained in:
@@ -206,6 +206,14 @@ export function getMoveToFolderInput() {
|
||||
return getMoveToFolderDropdown().find('input');
|
||||
}
|
||||
|
||||
export function getProjectSharingInput() {
|
||||
return cy.getByTestId('project-sharing-select');
|
||||
}
|
||||
|
||||
export function getProjectSharingOption(name: string) {
|
||||
return cy.getByTestId('project-sharing-info').contains(name);
|
||||
}
|
||||
|
||||
export function getEmptyFolderDropdownMessage(text: string) {
|
||||
return cy.get('.el-select-dropdown__empty').contains(text);
|
||||
}
|
||||
@@ -500,7 +508,12 @@ function deleteFolderAndMoveContents(folderName: string, destinationName: string
|
||||
function moveFolder(folderName: string, destinationName: string) {
|
||||
cy.intercept('PATCH', '/rest/projects/**').as('moveFolder');
|
||||
getMoveFolderModal().should('be.visible');
|
||||
getMoveFolderModal().find('h1').first().contains(`Move "${folderName}" to another folder`);
|
||||
getMoveFolderModal().find('h1').first().contains(`Move folder ${folderName}`);
|
||||
|
||||
// The dropdown focuses after a small delay (once modal's slide in animation is done).
|
||||
// On the component we listen for an event, but here the wait should be very predictable.
|
||||
cy.wait(500);
|
||||
|
||||
// Try to find current folder in the dropdown
|
||||
// This tests that auto-focus worked as expected
|
||||
cy.focused().type(folderName, { delay: 50 });
|
||||
@@ -514,3 +527,27 @@ function moveFolder(folderName: string, destinationName: string) {
|
||||
getMoveFolderConfirmButton().should('be.enabled').click();
|
||||
cy.wait('@moveFolder');
|
||||
}
|
||||
|
||||
export function transferWorkflow(
|
||||
workflowName: string,
|
||||
projectName: string,
|
||||
destinationFolder?: string,
|
||||
) {
|
||||
getMoveFolderModal().should('be.visible');
|
||||
getMoveFolderModal().find('h1').first().contains(`Move workflow ${workflowName}`);
|
||||
|
||||
cy.wait(500);
|
||||
|
||||
getProjectSharingInput().should('be.visible').click();
|
||||
cy.focused().type(projectName, { delay: 50 });
|
||||
getProjectSharingOption(projectName).should('be.visible').click();
|
||||
|
||||
if (destinationFolder) {
|
||||
getMoveToFolderInput().click();
|
||||
// Select destination folder
|
||||
cy.focused().type(destinationFolder, { delay: 50 });
|
||||
getMoveToFolderOption(destinationFolder).should('be.visible').click();
|
||||
}
|
||||
|
||||
getMoveFolderConfirmButton().should('be.enabled').click();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ const workflowPage = new WorkflowPage();
|
||||
const credentialsModal = new CredentialsModal();
|
||||
|
||||
export const getHomeButton = () => cy.getByTestId('project-home-menu-item');
|
||||
export const getPersonalProjectsButton = () => cy.getByTestId('project-personal-menu-item');
|
||||
export const getMenuItems = () => cy.getByTestId('project-menu-item');
|
||||
export const getAddProjectButton = () => {
|
||||
cy.getByTestId('universal-add').should('be.visible').click();
|
||||
@@ -62,6 +63,8 @@ export const addProjectMember = (email: string, role?: string) => {
|
||||
};
|
||||
export const getResourceMoveModal = () => cy.getByTestId('project-move-resource-modal');
|
||||
export const getProjectMoveSelect = () => cy.getByTestId('project-move-resource-modal-select');
|
||||
export const getProjectSharingSelect = () => cy.getByTestId('project-sharing-select');
|
||||
export const getMoveToFolderSelect = () => cy.getByTestId('move-to-folder-dropdown');
|
||||
|
||||
export function createProject(name: string) {
|
||||
getAddProjectButton().click();
|
||||
|
||||
Reference in New Issue
Block a user