فهرست منبع

improve collapseSidebar

Yuki Takei 2 سال پیش
والد
کامیت
7343da3739
1فایلهای تغییر یافته به همراه5 افزوده شده و 13 حذف شده
  1. 5 13
      apps/app/test/cypress/support/commands.ts

+ 5 - 13
apps/app/test/cypress/support/commands.ts

@@ -70,7 +70,11 @@ Cypress.Commands.add('waitUntilSpinnerDisappear', () => {
 });
 });
 
 
 Cypress.Commands.add('collapseSidebar', (isCollapsed: boolean, waitUntilSaving = false) => {
 Cypress.Commands.add('collapseSidebar', (isCollapsed: boolean, waitUntilSaving = false) => {
-  cy.getByTestid('grw-sidebar-wrapper', { timeout: 5000 }).within(() => {
+  cy.get('.grw-navigation-wrap').should('be.visible');
+  cy.get('.grw-sidebar-dock').should('be.visible');
+
+  cy.getByTestid('grw-sidebar-wrapper').within(() => {
+
     // skip if .grw-sidebar-dock does not exist
     // skip if .grw-sidebar-dock does not exist
     if (isHidden(Cypress.$('.grw-sidebar-dock'))) {
     if (isHidden(Cypress.$('.grw-sidebar-dock'))) {
       return;
       return;
@@ -98,15 +102,3 @@ Cypress.Commands.add('collapseSidebar', (isCollapsed: boolean, waitUntilSaving =
     });
     });
   });
   });
 });
 });
-
-Cypress.Commands.add('isInViewport', (selector: string) => {
-  cy.get(selector).then($el => {
-    const bottom = Cypress.config("viewportWidth");
-    const rect = $el[0].getBoundingClientRect();
-
-    expect(rect.top).not.to.be.greaterThan(bottom);
-    expect(rect.bottom).not.to.be.greaterThan(bottom);
-    expect(rect.top).not.to.be.greaterThan(bottom);
-    expect(rect.bottom).not.to.be.greaterThan(bottom);
-  });
-});