]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/blob
8ea195f89e7aa1f31b1e40b526387e2529ad8c90
[ceph-ci.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-02].cephlab.com'
14   ];
15   const addHost = (hostname: string, exist?: boolean, pattern?: boolean) => {
16     cy.get('.btn.btn-accent').first().click({ force: true });
17     createClusterHostPage.add(hostname, exist, false);
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.delete(hostnames[1]);
42     createClusterHostPage.delete(hostnames[2]);
43     addHost(hostnames[3], false, true);
44   });
45
46   it('should delete a host and add it back', () => {
47     createClusterHostPage.delete(hostnames[1]);
48     addHost(hostnames[1], false);
49   });
50
51   it('should verify "_no_schedule" label is added', () => {
52     createClusterHostPage.checkLabelExists(hostnames[1], ['_no_schedule'], true);
53     createClusterHostPage.checkLabelExists(hostnames[2], ['_no_schedule'], true);
54   });
55
56   it('should not add an existing host', () => {
57     cy.get('.btn.btn-accent').first().click({ force: true });
58     createClusterHostPage.add(hostnames[0], true);
59   });
60
61   it('should edit host labels', () => {
62     const labels = ['foo', 'bar'];
63     createClusterHostPage.editLabels(hostnames[0], labels, true);
64     createClusterHostPage.editLabels(hostnames[0], labels, false);
65   });
66 });