2 CreateClusterHostPageHelper,
3 CreateClusterWizardHelper
4 } from 'cypress/integration/cluster/create-cluster.po';
6 describe('Create cluster add host page', () => {
7 const createCluster = new CreateClusterWizardHelper();
8 const createClusterHostPage = new CreateClusterHostPageHelper();
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'
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);
19 createClusterHostPage.checkExist(hostname, true);
25 Cypress.Cookies.preserveOnce('token');
26 createCluster.navigateTo();
27 createCluster.createCluster();
30 it('should check if title contains Add Hosts', () => {
31 cy.get('.nav-link').should('contain.text', 'Add Hosts');
33 cy.get('.title').should('contain.text', 'Add Hosts');
36 it('should check existing host and add new hosts', () => {
37 createClusterHostPage.checkExist(hostnames[0], true);
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);
46 it('should remove a host', () => {
47 createClusterHostPage.remove(hostnames[1]);
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);
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);
61 it('should not add an existing host', () => {
62 cy.get('.btn.btn-accent').first().click({ force: true });
63 createClusterHostPage.add(hostnames[0], true);
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);