]> git.apps.os.sepia.ceph.com Git - ceph.git/blob
a35bd6c10748ee3e6dbd9ce5eda9fc8c5afa979f
[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   ];
14   const addHost = (hostname: string, exist?: boolean) => {
15     cy.get('.btn.btn-accent').first().click({ force: true });
16     createClusterHostPage.add(hostname, exist, false);
17     createClusterHostPage.checkExist(hostname, true);
18   };
19
20   beforeEach(() => {
21     cy.login();
22     Cypress.Cookies.preserveOnce('token');
23     createCluster.navigateTo();
24     createCluster.createCluster();
25   });
26
27   it('should check if title contains Add Hosts', () => {
28     cy.get('.nav-link').should('contain.text', 'Add Hosts');
29
30     cy.get('.title').should('contain.text', 'Add Hosts');
31   });
32
33   it('should check existing host and add new hosts', () => {
34     createClusterHostPage.checkExist(hostnames[0], true);
35
36     addHost(hostnames[1], false);
37     addHost(hostnames[2], false);
38   });
39
40   it('should delete a host and add it back', () => {
41     createClusterHostPage.delete(hostnames[1]);
42     addHost(hostnames[1], false);
43   });
44
45   it('should verify "_no_schedule" label is added', () => {
46     createClusterHostPage.checkLabelExists(hostnames[1], ['_no_schedule'], true);
47     createClusterHostPage.checkLabelExists(hostnames[2], ['_no_schedule'], true);
48   });
49
50   it('should not add an existing host', () => {
51     cy.get('.btn.btn-accent').first().click({ force: true });
52     createClusterHostPage.add(hostnames[0], true);
53   });
54
55   it('should edit host labels', () => {
56     const labels = ['foo', 'bar'];
57     createClusterHostPage.editLabels(hostnames[0], labels, true);
58     createClusterHostPage.editLabels(hostnames[0], labels, false);
59   });
60 });