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:
Jaakko Husso
2025-05-28 23:41:07 +03:00
committed by GitHub
parent ba70cab9d5
commit e860dd6d2e
27 changed files with 1989 additions and 292 deletions

View File

@@ -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();
}

View File

@@ -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();