work with nested menus

This commit is contained in:
r00gm 2024-11-14 10:28:55 +01:00
parent 14c3d7a76f
commit 22790c39b4
No known key found for this signature in database
4 changed files with 78 additions and 26 deletions

View file

@ -8,11 +8,22 @@ export const getHomeButton = () => cy.getByTestId('project-home-menu-item');
export const getMenuItems = () => cy.getByTestId('project-menu-item'); export const getMenuItems = () => cy.getByTestId('project-menu-item');
export const getAddProjectButton = () => { export const getAddProjectButton = () => {
cy.getByTestId('universal-add').should('be.visible').click(); cy.getByTestId('universal-add').should('be.visible').click();
return cy cy.getByTestId('universal-add')
.getByTestId('navigation-menu-item') .find('.el-sub-menu__title')
.should('be.visible') .invoke('attr', 'aria-describedby')
.filter(':contains("Project")') .then((el) => cy.get(`[id="${el}"]`))
.last(); .as('submenu');
cy.get('@submenu').within((submenu) =>
cy
.wrap(submenu)
.getByTestId('navigation-menu-item')
.should('be.visible')
.filter(':contains("Project")')
.as('button'),
);
return cy.get('@button');
}; };
// export const getAddProjectButton = () => // export const getAddProjectButton = () =>

View file

@ -275,7 +275,7 @@ describe('Projects', { disableAutoLogin: true }, () => {
cy.changeQuota('maxTeamProjects', -1); cy.changeQuota('maxTeamProjects', -1);
}); });
it.only('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.signinAsOwner();
cy.visit(workflowsPage.url); cy.visit(workflowsPage.url);

View file

@ -7,19 +7,28 @@ export class CredentialsPage extends BasePage {
emptyListCreateCredentialButton: () => cy.getByTestId('empty-resources-list').find('button'), emptyListCreateCredentialButton: () => cy.getByTestId('empty-resources-list').find('button'),
createCredentialButton: () => { createCredentialButton: () => {
cy.getByTestId('resource-add').should('be.visible').click(); cy.getByTestId('resource-add').should('be.visible').click();
cy.getByTestId('resource-add')
.find('.el-sub-menu__title')
.invoke('attr', 'aria-describedby')
.then((el) => cy.get(`[id="${el}"]`))
.as('submenu');
cy.getByTestId('navigation-submenu') cy.get('@submenu').within((submenu) => {
.should('be.visible') cy.wrap(submenu)
.filter(':contains("Credential")') .find('[data-test-id="navigation-submenu"]')
.last() .should('be.visible')
.filter(':contains("Credential")')
.as('child')
.click();
.click(); cy.get('@child')
.find('[data-test-id="navigation-submenu-item"]')
.should('be.visible')
.filter(':contains("Personal")')
.as('button');
});
return cy return cy.get('@button');
.getByTestId('navigation-submenu-item')
.should('be.visible')
.filter(':contains("Personal")')
.last();
}, },
// cy.getByTestId('resources-list-add'), // cy.getByTestId('resources-list-add'),

View file

@ -9,19 +9,51 @@ export class WorkflowsPage extends BasePage {
searchBar: () => cy.getByTestId('resources-list-search'), searchBar: () => cy.getByTestId('resources-list-search'),
createWorkflowButton: () => { createWorkflowButton: () => {
cy.getByTestId('resource-add').should('be.visible').click(); cy.getByTestId('resource-add').should('be.visible').click();
cy.getByTestId('resource-add')
.find('.el-sub-menu__title')
.invoke('attr', 'aria-describedby')
.then((el) => cy.get(`[id="${el}"]`))
.as('submenu');
cy.getByTestId('navigation-submenu') cy.get('@submenu').within((submenu) => {
.should('be.visible') cy.wrap(submenu)
.filter(':contains("Workflow")') .find('[data-test-id="navigation-submenu"]')
.last() .should('be.visible')
.filter(':contains("Workflow")')
.as('child')
.click();
.click(); cy.get('@child')
.find('[data-test-id="navigation-submenu-item"]')
.should('be.visible')
.filter(':contains("Personal")')
.as('button');
});
return cy return cy.get('@button');
.getByTestId('navigation-submenu-item') // cy.getByTestId('resource-add').should('be.visible').click();
.should('be.visible') // cy.getByTestId('resource-add')
.filter(':contains("Personal")') // .find('.el-sub-menu__title')
.first(); // .invoke('attr', 'aria-describedby')
// .then((el) => cy.get(`[id="${el}"]`))
// .as('submenu');
// cy.get('@submenu')
// .getByTestId('navigation-submenu')
// .should('be.visible')
// .filter(':contains("Workflow")')
// .click();
// cy.get('@submenu').within((submenu) =>
// cy
// .wrap(submenu)
// .getByTestId('navigation-submenu-item')
// .should('be.visible')
// .filter(':contains("Personal")')
// .as('button'),
// );
// return cy.get('@button');
}, },
workflowCards: () => cy.getByTestId('resources-list-item'), workflowCards: () => cy.getByTestId('resources-list-item'),
workflowCard: (workflowName: string) => workflowCard: (workflowName: string) =>