Просмотр исходного кода

- Remove update-home-setting.ts
- Add access-home.spec.ts and access-user-settings.spec.ts
- Make the test run once instead of make test each tab link
- Adjust selector code

LuqmanHakim-Grune 4 лет назад
Родитель
Сommit
6bba71f7af

+ 1 - 1
.github/workflows/reusable-app-prod.yml

@@ -185,7 +185,7 @@ jobs:
       fail-fast: false
       matrix:
         # List string expressions that is comma separated ids of tests in "test/cypress/integration"
-        spec-group: ['1', '2', '3']
+        spec-group: ['1', '2', '3', '4', '5', '6']
 
     services:
       mongodb:

+ 0 - 48
packages/app/test/cypress/integration/6-home-setting/update-home-setting.ts

@@ -1,48 +0,0 @@
-context('Update home setting', () => {
-  const ssPrefix = 'update-home-setting-';
-
-  let connectSid: string | undefined;
-
-  before(() => {
-    // login
-    cy.fixture("user-admin.json").then(user => {
-      cy.login(user.username, user.password);
-    });
-    cy.getCookie('connect.sid').then(cookie => {
-      connectSid = cookie?.value;
-    });
-    // collapse sidebar
-    cy.collapseSidebar(true);
-  });
-
-  beforeEach(() => {
-    if (connectSid != null) {
-      cy.setCookie('connect.sid', connectSid);
-    }
-  });
-
-  it('Update User information', () => {
-
-  });
-
-  it('Update External account', () => {
-
-  });
-
-  it('Update Password setting', () => {
-
-  });
-
-  it('Update API setting', () => {
-
-  });
-
-  it('Update Editor setting', () => {
-
-  });
-
-  it('Update In-app notification setting', () => {
-
-  });
-
-});

+ 32 - 0
packages/app/test/cypress/integration/6-home-settings/access-home.spec.ts

@@ -0,0 +1,32 @@
+/* eslint-disable cypress/no-unnecessary-waiting */
+context('Access Home', () => {
+  const ssPrefix = 'access-home-';
+
+  let connectSid: string | undefined;
+
+  before(() => {
+    // login
+    cy.fixture("user-admin.json").then(user => {
+      cy.login(user.username, user.password);
+    });
+    cy.getCookie('connect.sid').then(cookie => {
+      connectSid = cookie?.value;
+    });
+  });
+
+  beforeEach(() => {
+    if (connectSid != null) {
+      cy.setCookie('connect.sid', connectSid);
+    }
+  });
+
+  it('Visit home', () => {
+    cy.visit('/');
+    cy.get('.grw-personal-dropdown').click();
+    cy.get('.grw-personal-dropdown .dropdown-menu .btn-group > .btn-outline-secondary:eq(0)').click();
+
+    cy.wait(1500);
+    cy.screenshot(`${ssPrefix}-visit-home`, { capture: 'viewport' });
+  });
+
+});

+ 85 - 0
packages/app/test/cypress/integration/6-home-settings/access-user-settings.spec.ts

@@ -0,0 +1,85 @@
+/* eslint-disable cypress/no-unnecessary-waiting */
+context('Access User settings', () => {
+  const ssPrefix = 'access-user-settings-';
+
+  let connectSid: string | undefined;
+
+  before(() => {
+    // login
+    cy.fixture("user-admin.json").then(user => {
+      cy.login(user.username, user.password);
+    });
+    cy.getCookie('connect.sid').then(cookie => {
+      connectSid = cookie?.value;
+    });
+
+    cy.visit('/');
+    cy.get('.grw-personal-dropdown').click();
+    cy.get('[href="/me"]').click();
+
+    cy.wait(1500);
+  });
+
+  beforeEach(() => {
+    if (connectSid != null) {
+      cy.setCookie('connect.sid', connectSid);
+    }
+  });
+
+  it('Update settings', () => {
+    // Access User information
+    cy.get('#personal-setting .tab-pane.active > div:first button').click(); // Click basic info update button
+
+    cy.wait(500);
+
+    cy.screenshot(`${ssPrefix}-user-information`, { capture: 'viewport' });
+    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+
+    // Access External account
+    cy.get('#personal-setting .nav-title.nav li:eq(1) a').click(); // click
+    cy.get('#personal-setting .tab-pane.active h2 button').click(); // click add button
+    cy.get('.modal-footer button').click(); // click add button in modal form
+    cy.get('.close[aria-label="Close"]').click(); // close modal form
+
+    cy.wait(500);
+
+    cy.screenshot(`${ssPrefix}-external-account`, { capture: 'viewport' });
+    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+
+    // Access Password setting
+    cy.get('#personal-setting .nav-title.nav li:eq(2) a').click();
+    cy.get('#personal-setting .tab-pane.active button').click(); // click update button
+
+    cy.wait(500);
+
+    cy.screenshot(`${ssPrefix}-password-setting`, { capture: 'viewport' });
+    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+
+    // Access API setting
+    cy.get('#personal-setting .nav-title.nav li:eq(2) a').click();
+    cy.get('#personal-setting .tab-pane.active button').click(); // click update API token button
+
+    cy.wait(500);
+
+    cy.screenshot(`${ssPrefix}-api-setting`, { capture: 'viewport' });
+    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+
+    // Access Editor setting
+    cy.get('#personal-setting .nav-title.nav li:eq(3) a').click();
+    cy.get('#personal-setting .tab-pane.active button').click(); // click update button
+
+    cy.wait(500);
+
+    cy.screenshot(`${ssPrefix}-editor-setting`, { capture: 'viewport' });
+    cy.get('.toast-close-button').click({ multiple: true }); // close toast alert
+
+    // Access In-app notification setting
+    cy.get('#personal-setting .nav-title.nav li:eq(4) a').click();
+    cy.get('#personal-setting .tab-pane.active button').click(); // click update button
+
+    cy.wait(500);
+
+    cy.screenshot(`${ssPrefix}-in-app-notification-setting`, { capture: 'viewport' });
+  });
+
+});