]> git.apps.os.sepia.ceph.com Git - ceph.git/blob
02b61167de3bbf1fe313c6becdac21e2733f7668
[ceph.git] /
1 import {
2   CreateClusterHostPageHelper,
3   CreateClusterWizardHelper
4 } from 'cypress/integration/cluster/create-cluster.po';
5
6 describe('Create cluster add host page', () => {
7   const createCluster = new CreateClusterWizardHelper();
8   const createClusterHostPage = new CreateClusterHostPageHelper();
9   const hostnames = [
10     'ceph-node-00.cephlab.com',
11     'ceph-node-01.cephlab.com',
12     'ceph-node-02.cephlab.com',
13     'ceph-node-[01-03].cephlab.com'
14   ];
15   const addHost = (hostname: string, exist?: boolean, pattern?: boolean, labels: string[] = []) => {
16     cy.get('button[data-testid=table-action-button]').click();
17     createClusterHostPage.add(hostname, exist, false, labels);
18     if (!pattern) {
19       createClusterHostPage.checkExist(hostname, true);
20     }
21   };
22
23   beforeEach(() => {
24     cy.login();
25     Cypress.Cookies.preserveOnce('token');
26     createCluster.navigateTo();
27     createCluster.createCluster();
28   });
29
30   it('should check if title contains Add Hosts', () => {
31     cy.get('.nav-link').should('contain.text', 'Add Hosts');
32
33     cy.get('.title').should('contain.text', 'Add Hosts');
34   });
35
36   it('should check existing host and add new hosts', () => {
37     createClusterHostPage.checkExist(hostnames[0], true);
38
39     addHost(hostnames[1], false);
40     addHost(hostnames[2], false);
41     createClusterHostPage.remove(hostnames[1]);
42     createClusterHostPage.remove(hostnames[2]);
43     addHost(hostnames[3], false, true);
44   });
45
46   it('should remove a host', () => {
47     createClusterHostPage.remove(hostnames[1]);
48   });
49
50   it('should add a host with some predefined labels and verify it', () => {
51     const labels = ['mon', 'mgr', 'rgw', 'osd'];
52     addHost(hostnames[1], false, false, labels);
53     createClusterHostPage.checkLabelExists(hostnames[1], labels, true);
54   });
55
56   it('should verify "_no_schedule" label is added', () => {
57     createClusterHostPage.checkLabelExists(hostnames[1], ['_no_schedule'], true);
58     createClusterHostPage.checkLabelExists(hostnames[2], ['_no_schedule'], true);
59   });
60
61   it('should not add an existing host', () => {
62     cy.get('.btn.btn-accent').first().click({ force: true });
63     createClusterHostPage.add(hostnames[0], true);
64   });
65
66   it('should edit host labels', () => {
67     const labels = ['foo', 'bar'];
68     createClusterHostPage.editLabels(hostnames[0], labels, true);
69     createClusterHostPage.editLabels(hostnames[0], labels, false);
70   });
71 });