Yohei-Shiina пре 3 година
родитељ
комит
e963e7b3c1

+ 2 - 2
packages/app/src/components/Navbar/PersonalDropdown.jsx

@@ -55,12 +55,12 @@ const PersonalDropdown = () => {
 
           <div className="btn-group btn-block mt-2" role="group">
             <Link href={`/user/${user.username}`}>
-              <a className="btn btn-sm btn-outline-secondary col">
+              <a className="btn btn-sm btn-outline-secondary col" data-testid="user-home">
                 <i className="icon-fw icon-home"></i>{t('personal_dropdown.home')}
               </a>
             </Link>
             <Link href="/me">
-              <a className="btn btn-sm btn-outline-secondary col">
+              <a className="btn btn-sm btn-outline-secondary col" data-testid="user-settings">
                 <i className="icon-fw icon-wrench"></i>{t('personal_dropdown.settings')}
               </a>
             </Link>

+ 98 - 95
packages/app/test/cypress/integration/60-home/home.spec.ts

@@ -12,13 +12,16 @@ context('Access Home', () => {
 
   it('Visit home', () => {
     cy.visit('/dummy');
-    cy.getByTestid('grw-personal-dropdown').click();
-    cy.getByTestid('grw-personal-dropdown').find('.dropdown-menu .btn-group > .btn-outline-secondary:eq(0)').click();
+    cy.waitUntilSkeletonDisappear();
+    cy.get('.grw-personal-dropdown > button').should('be.visible').click();
 
+    cy.getByTestid('grw-personal-dropdown').should('be.visible').within(()=>{
+      cy.getByTestid('user-home').should('be.visible').click();
+    })
     // eslint-disable-next-line cypress/no-unnecessary-waiting
     cy.wait(2000); // wait for calcViewHeight and rendering
-
     cy.waitUntilSkeletonDisappear();
+
     // for check download toc data
     cy.get('.toc-link').should('be.visible');
 
@@ -29,95 +32,95 @@ context('Access Home', () => {
 });
 
 
-context('Access User settings', () => {
-  const ssPrefix = 'access-user-settings-';
-
-  beforeEach(() => {
-    // login
-    cy.fixture("user-admin.json").then(user => {
-      cy.login(user.username, user.password);
-    });
-    // collapse sidebar
-    cy.collapseSidebar(true);
-    cy.visit('/me');
-    // hide fab // disable fab for sticky-events warning
-    // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
-  });
-
-  it('Access User information', () => {
-    // User information
-    cy.getByTestid('grw-user-settings').should('be.visible');
-    cy.screenshot(`${ssPrefix}-user-information-1`);
-    cy.getByTestid('grw-besic-info-settings-update-button').click();
-    cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
-    cy.screenshot(`${ssPrefix}-user-information-2`);
-
-    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
-    cy.get('.toast').should('not.exist');
-  });
-
-  it('Access External account', () => {
-    cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(1) a').click();
-    cy.scrollTo('top');
-    cy.screenshot(`${ssPrefix}-external-account-1`);
-    cy.getByTestid('grw-external-account-add-button').click();
-    cy.getByTestid('grw-associate-modal').should('be.visible');
-    cy.screenshot(`${ssPrefix}-external-account-2`);
-    cy.getByTestid('grw-associate-modal').find('.modal-footer button').click(); // click add button in modal form
-    cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
-    cy.screenshot(`${ssPrefix}-external-account-3`);
-    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
-    cy.get('.toast').should('not.exist');
-    cy.getByTestid('grw-associate-modal').find('.close').click();
-    cy.screenshot(`${ssPrefix}-external-account-4`);
-
-    cy.get('.toast').should('not.exist');
-  });
-
-  it('Access Password setting', () => {
-    cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(2) a').click();
-    cy.scrollTo('top');
-    cy.screenshot(`${ssPrefix}-password-settings-1`);
-    cy.getByTestid('grw-password-settings-update-button').click();
-    cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
-    cy.screenshot(`${ssPrefix}-password-settings-2`);
-
-    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
-    cy.get('.toast').should('not.exist');
-  });
-
-  it('Access API setting', () => {
-    cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(3) a').click();
-    cy.scrollTo('top');
-    cy.screenshot(`${ssPrefix}-api-setting-1`);
-    cy.getByTestid('grw-api-settings-update-button').click();
-    cy.getByTestid('grw-api-settings-input').should('be.visible');
-    cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
-    cy.screenshot(`${ssPrefix}-api-setting-2`);
-
-    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
-    cy.get('.toast').should('not.exist');
-  });
-
-  it('Access Editor setting', () => {
-    cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(4) a').click();
-    cy.scrollTo('top');
-    cy.getByTestid('grw-editor-settings').should('be.visible');
-    cy.screenshot(`${ssPrefix}-editor-setting-1`);
-    cy.getByTestid('grw-editor-settings-update-button').click();
-    cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
-    cy.screenshot(`${ssPrefix}-editor-setting-2`);
-
-    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
-    cy.get('.toast').should('not.exist');
-  });
-
-  it('Access In-app notification setting', () => {
-    cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(5) a').click();
-    cy.scrollTo('top');
-    cy.screenshot(`${ssPrefix}-in-app-notification-setting-1`);
-    cy.getByTestid('grw-in-app-notification-settings-update-button').click();
-    cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
-    cy.screenshot(`${ssPrefix}-in-app-notification-setting-2`);
-  });
-});
+// context('Access User settings', () => {
+//   const ssPrefix = 'access-user-settings-';
+
+//   beforeEach(() => {
+//     // login
+//     cy.fixture("user-admin.json").then(user => {
+//       cy.login(user.username, user.password);
+//     });
+//     // collapse sidebar
+//     cy.collapseSidebar(true);
+//     cy.visit('/me');
+//     // hide fab // disable fab for sticky-events warning
+//     // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
+//   });
+
+//   it('Access User information', () => {
+//     // User information
+//     cy.getByTestid('grw-user-settings').should('be.visible');
+//     cy.screenshot(`${ssPrefix}-user-information-1`);
+//     cy.getByTestid('grw-besic-info-settings-update-button').click();
+//     cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
+//     cy.screenshot(`${ssPrefix}-user-information-2`);
+
+//     cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+//     cy.get('.toast').should('not.exist');
+//   });
+
+//   it('Access External account', () => {
+//     cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(1) a').click();
+//     cy.scrollTo('top');
+//     cy.screenshot(`${ssPrefix}-external-account-1`);
+//     cy.getByTestid('grw-external-account-add-button').click();
+//     cy.getByTestid('grw-associate-modal').should('be.visible');
+//     cy.screenshot(`${ssPrefix}-external-account-2`);
+//     cy.getByTestid('grw-associate-modal').find('.modal-footer button').click(); // click add button in modal form
+//     cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
+//     cy.screenshot(`${ssPrefix}-external-account-3`);
+//     cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+//     cy.get('.toast').should('not.exist');
+//     cy.getByTestid('grw-associate-modal').find('.close').click();
+//     cy.screenshot(`${ssPrefix}-external-account-4`);
+
+//     cy.get('.toast').should('not.exist');
+//   });
+
+//   it('Access Password setting', () => {
+//     cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(2) a').click();
+//     cy.scrollTo('top');
+//     cy.screenshot(`${ssPrefix}-password-settings-1`);
+//     cy.getByTestid('grw-password-settings-update-button').click();
+//     cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
+//     cy.screenshot(`${ssPrefix}-password-settings-2`);
+
+//     cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+//     cy.get('.toast').should('not.exist');
+//   });
+
+//   it('Access API setting', () => {
+//     cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(3) a').click();
+//     cy.scrollTo('top');
+//     cy.screenshot(`${ssPrefix}-api-setting-1`);
+//     cy.getByTestid('grw-api-settings-update-button').click();
+//     cy.getByTestid('grw-api-settings-input').should('be.visible');
+//     cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
+//     cy.screenshot(`${ssPrefix}-api-setting-2`);
+
+//     cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+//     cy.get('.toast').should('not.exist');
+//   });
+
+//   it('Access Editor setting', () => {
+//     cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(4) a').click();
+//     cy.scrollTo('top');
+//     cy.getByTestid('grw-editor-settings').should('be.visible');
+//     cy.screenshot(`${ssPrefix}-editor-setting-1`);
+//     cy.getByTestid('grw-editor-settings-update-button').click();
+//     cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
+//     cy.screenshot(`${ssPrefix}-editor-setting-2`);
+
+//     cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+//     cy.get('.toast').should('not.exist');
+//   });
+
+//   it('Access In-app notification setting', () => {
+//     cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(5) a').click();
+//     cy.scrollTo('top');
+//     cy.screenshot(`${ssPrefix}-in-app-notification-setting-1`);
+//     cy.getByTestid('grw-in-app-notification-settings-update-button').click();
+//     cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
+//     cy.screenshot(`${ssPrefix}-in-app-notification-setting-2`);
+//   });
+// });