|
|
@@ -70,35 +70,31 @@ Cypress.Commands.add('waitUntilSpinnerDisappear', () => {
|
|
|
});
|
|
|
|
|
|
Cypress.Commands.add('collapseSidebar', (isCollapsed: boolean, waitUntilSaving = false) => {
|
|
|
- cy.get('.grw-navigation-wrap').should('be.visible');
|
|
|
- cy.get('.grw-sidebar-dock').should('be.visible');
|
|
|
+ cy.getByTestid('grw-sidebar').should('be.visible');
|
|
|
|
|
|
- cy.getByTestid('grw-sidebar-wrapper').within(() => {
|
|
|
+ cy.getByTestid('grw-sidebar').within(($elem) => {
|
|
|
|
|
|
// skip if .grw-sidebar-dock does not exist
|
|
|
- if (isHidden(Cypress.$('.grw-sidebar-dock'))) {
|
|
|
+ if ($elem.hasClass('grw-sidebar-dock')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // process only when Dock Mode
|
|
|
- cy.get('.grw-sidebar-dock').within(() => {
|
|
|
- const isSidebarContextualNavigationHidden = isHiddenByTestId('grw-contextual-navigation-sub');
|
|
|
- if (isSidebarContextualNavigationHidden === isCollapsed) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ const isSidebarContextualNavigationHidden = isHiddenByTestId('grw-contextual-navigation-sub');
|
|
|
+ if (isSidebarContextualNavigationHidden === isCollapsed) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- cy.waitUntil(() => {
|
|
|
- // do
|
|
|
- cy.getByTestid("grw-navigation-resize-button").click({force: true});
|
|
|
- // wait until saving UserUISettings
|
|
|
- if (waitUntilSaving) {
|
|
|
- // eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
|
- cy.wait(1500);
|
|
|
- }
|
|
|
+ cy.waitUntil(() => {
|
|
|
+ // do
|
|
|
+ cy.getByTestid("grw-navigation-resize-button").click({force: true});
|
|
|
+ // wait until saving UserUISettings
|
|
|
+ if (waitUntilSaving) {
|
|
|
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
|
+ cy.wait(1500);
|
|
|
+ }
|
|
|
|
|
|
- // wait until
|
|
|
- return cy.getByTestid('grw-contextual-navigation-sub').then($contents => isHidden($contents) === isCollapsed);
|
|
|
- });
|
|
|
+ // wait until
|
|
|
+ return cy.getByTestid('grw-contextual-navigation-sub').then($contents => isHidden($contents) === isCollapsed);
|
|
|
});
|
|
|
});
|
|
|
});
|