]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Add E2E for navigation
authorTiago Melo <tmelo@suse.com>
Tue, 5 May 2020 09:55:49 +0000 (09:55 +0000)
committerTiago Melo <tmelo@suse.com>
Tue, 7 Jul 2020 22:05:15 +0000 (22:05 +0000)
Fixes: https://tracker.ceph.com/issues/45376
Signed-off-by: Tiago Melo <tmelo@suse.com>
src/pybind/mgr/dashboard/frontend/cypress.json
src/pybind/mgr/dashboard/frontend/cypress/fixtures/nfs-ganesha-status.json [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/cypress/fixtures/rgw-status.json [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.e2e-spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.po.ts [new file with mode: 0644]

index 4f604241edb98ff7c83be41ce65cf4350b3ca2c1..cef1e3382d3cb98a54e1725aeeeaddb633334818 100644 (file)
@@ -9,6 +9,5 @@
   "viewportHeight": 1080,
   "viewportWidth": 1920,
   "pluginsFile": false,
-  "fixturesFolder": false,
   "projectId": "k7ab29"
 }
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/fixtures/nfs-ganesha-status.json b/src/pybind/mgr/dashboard/frontend/cypress/fixtures/nfs-ganesha-status.json
new file mode 100644 (file)
index 0000000..4dbbaac
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "available": false,
+  "message": "Ganesha config location is not configured. Please set the GANESHA_RADOS_POOL_NAMESPACE setting."
+}
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/fixtures/rgw-status.json b/src/pybind/mgr/dashboard/frontend/cypress/fixtures/rgw-status.json
new file mode 100644 (file)
index 0000000..faa8c04
--- /dev/null
@@ -0,0 +1 @@
+{ "available": true, "message": null }
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.e2e-spec.ts
new file mode 100644 (file)
index 0000000..f9d74a0
--- /dev/null
@@ -0,0 +1,23 @@
+import { NavigationPageHelper } from './navigation.po';
+
+describe('Shared pages', () => {
+  const shared = new NavigationPageHelper();
+
+  beforeEach(() => {
+    cy.login();
+    shared.navigateTo();
+  });
+
+  it('should display the vertical menu by default', () => {
+    shared.getVerticalMenu().should('be.visible');
+  });
+
+  it('should hide the vertical menu', () => {
+    shared.getMenuToggler().click();
+    shared.getVerticalMenu().should('not.be.visible');
+  });
+
+  it('should navigate to the correct page', () => {
+    shared.checkNavigations(shared.navigations);
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/ui/navigation.po.ts
new file mode 100644 (file)
index 0000000..31215cd
--- /dev/null
@@ -0,0 +1,69 @@
+import { PageHelper } from '../page-helper.po';
+
+export class NavigationPageHelper extends PageHelper {
+  pages = {
+    index: { url: '#/dashboard', id: 'cd-dashboard' }
+  };
+
+  navigations = [
+    { menu: 'NFS', component: 'cd-nfs-501' },
+    {
+      menu: 'Object Gateway',
+      submenus: [
+        { menu: 'Daemons', component: 'cd-rgw-daemon-list' },
+        { menu: 'Users', component: 'cd-rgw-user-list' },
+        { menu: 'Buckets', component: 'cd-rgw-bucket-list' }
+      ]
+    },
+    { menu: 'Dashboard', component: 'cd-dashboard' },
+    {
+      menu: 'Cluster',
+      submenus: [
+        { menu: 'Hosts', component: 'cd-hosts' },
+        { menu: 'Inventory', component: 'cd-inventory' },
+        { menu: 'Monitors', component: 'cd-monitor' },
+        { menu: 'Services', component: 'cd-services' },
+        { menu: 'OSDs', component: 'cd-osd-list' },
+        { menu: 'Configuration', component: 'cd-configuration' },
+        { menu: 'CRUSH map', component: 'cd-crushmap' },
+        { menu: 'Manager modules', component: 'cd-mgr-module-list' },
+        { menu: 'Logs', component: 'cd-logs' },
+        { menu: 'Monitoring', component: 'cd-prometheus-tabs' }
+      ]
+    },
+    { menu: 'Pools', component: 'cd-pool-list' },
+    {
+      menu: 'Block',
+      submenus: [
+        { menu: 'Images', component: 'cd-rbd-list' },
+        { menu: 'Mirroring', component: 'cd-mirroring' },
+        { menu: 'iSCSI', component: 'cd-iscsi' }
+      ]
+    },
+    { menu: 'Filesystem', component: 'cd-cephfs-list' }
+  ];
+
+  getVerticalMenu() {
+    return cy.get('ul.cd-navbar-primary');
+  }
+
+  getMenuToggler() {
+    return cy.get('cd-navigation > div.cd-navbar-top button.btn.btn-link');
+  }
+
+  checkNavigations(navs: any) {
+    // The nfs-ganesha and RGW status requests are mocked to ensure that this method runs in time
+    cy.server();
+    cy.route('/api/nfs-ganesha/status', 'fixture:nfs-ganesha-status');
+    cy.route('/api/rgw/status', 'fixture:rgw-status');
+
+    navs.forEach((nav: any) => {
+      cy.contains('.simplebar-content li.nav-item a', nav.menu).click();
+      if (nav.submenus) {
+        this.checkNavigations(nav.submenus);
+      } else {
+        cy.get(nav.component).should('exist');
+      }
+    });
+  }
+}