]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/02-create-cluster-add-host.e2e-spec.ts
import quincy beta 17.1.0
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / cypress / integration / orchestrator / workflow / 02-create-cluster-add-host.e2e-spec.ts
CommitLineData
a4b75251
TL
1import {
2 CreateClusterHostPageHelper,
3 CreateClusterWizardHelper
4} from 'cypress/integration/cluster/create-cluster.po';
5
6describe('Create cluster add host page', () => {
7 const createCluster = new CreateClusterWizardHelper();
8 const createClusterHostPage = new CreateClusterHostPageHelper();
20effc67 9 const hostnames = ['ceph-node-00', 'ceph-node-01', 'ceph-node-02', 'ceph-node-[01-03]'];
a4b75251 10 const addHost = (hostname: string, exist?: boolean, pattern?: boolean, labels: string[] = []) => {
20effc67 11 cy.get('button[data-testid=table-action-button]').click();
a4b75251
TL
12 createClusterHostPage.add(hostname, exist, false, labels);
13 if (!pattern) {
14 createClusterHostPage.checkExist(hostname, true);
15 }
16 };
17
18 beforeEach(() => {
19 cy.login();
20 Cypress.Cookies.preserveOnce('token');
21 createCluster.navigateTo();
22 createCluster.createCluster();
23 });
24
25 it('should check if title contains Add Hosts', () => {
26 cy.get('.nav-link').should('contain.text', 'Add Hosts');
27
28 cy.get('.title').should('contain.text', 'Add Hosts');
29 });
30
31 it('should check existing host and add new hosts', () => {
32 createClusterHostPage.checkExist(hostnames[0], true);
33
34 addHost(hostnames[1], false);
35 addHost(hostnames[2], false);
20effc67
TL
36 createClusterHostPage.remove(hostnames[1]);
37 createClusterHostPage.remove(hostnames[2]);
a4b75251
TL
38 addHost(hostnames[3], false, true);
39 });
40
20effc67
TL
41 it('should remove a host', () => {
42 createClusterHostPage.remove(hostnames[1]);
a4b75251
TL
43 });
44
45 it('should add a host with some predefined labels and verify it', () => {
46 const labels = ['mon', 'mgr', 'rgw', 'osd'];
47 addHost(hostnames[1], false, false, labels);
48 createClusterHostPage.checkLabelExists(hostnames[1], labels, true);
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});