Quellcode durchsuchen

set data-testid for ToggleCollapseButton

Yuki Takei vor 2 Jahren
Ursprung
Commit
0ab7cb25c2

+ 1 - 0
apps/app/src/components/Sidebar/SidebarHead/ToggleCollapseButton.tsx

@@ -37,6 +37,7 @@ export const ToggleCollapseButton = memo((): JSX.Element => {
       type="button"
       type="button"
       className={`btn btn-primary ${styles['btn-toggle-collapse']} p-2`}
       className={`btn btn-primary ${styles['btn-toggle-collapse']} p-2`}
       onClick={isDrawerMode() ? toggleDrawer : toggleCollapsed}
       onClick={isDrawerMode() ? toggleDrawer : toggleCollapsed}
+      data-testid="btn-toggle-collapse"
     >
     >
       <span className={`material-symbols-outlined fs-2 ${rotationClass}`}>{icon}</span>
       <span className={`material-symbols-outlined fs-2 ${rotationClass}`}>{icon}</span>
     </button>
     </button>

+ 1 - 2
apps/app/test/cypress/e2e/50-sidebar/50-sidebar--access-to-side-bar.cy.ts

@@ -36,9 +36,8 @@ describe('Access to sidebar', () => {
           });
           });
         });
         });
 
 
-        // TODO: rewrite test case with grw-switch-collapse-button
         it('Successfully collapse sidebar', () => {
         it('Successfully collapse sidebar', () => {
-          cy.getByTestid('grw-switch-collapse-button').click({force: true});
+          cy.getByTestid('btn-toggle-collapse').click({force: true});
 
 
           cy.getByTestid('grw-sidebar-contents').should('not.be.visible');
           cy.getByTestid('grw-sidebar-contents').should('not.be.visible');
 
 

+ 1 - 1
apps/app/test/cypress/support/commands.ts

@@ -88,7 +88,7 @@ Cypress.Commands.add('collapseSidebar', (isCollapsed: boolean, waitUntilSaving =
 
 
     cy.waitUntil(() => {
     cy.waitUntil(() => {
       // do
       // do
-      cy.getByTestid("grw-switch-collapse-button").click({force: true});
+      cy.getByTestid("btn-toggle-collapse").click({force: true});
       // wait until saving UserUISettings
       // wait until saving UserUISettings
       if (waitUntilSaving) {
       if (waitUntilSaving) {
         // eslint-disable-next-line cypress/no-unnecessary-waiting
         // eslint-disable-next-line cypress/no-unnecessary-waiting