summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.e2e-spec.ts
blob: d022d59cfa9a2ea85e8f1396bd92eaca42c54292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { ConfigurationPageHelper } from './configuration.po';

describe('Configuration page', () => {
  const configuration = new ConfigurationPageHelper();

  beforeEach(() => {
    cy.login();
    Cypress.Cookies.preserveOnce('token');
    configuration.navigateTo();
  });

  describe('breadcrumb test', () => {
    it('should open and show breadcrumb', () => {
      configuration.expectBreadcrumbText('Configuration');
    });
  });

  describe('fields check', () => {
    beforeEach(() => {
      configuration.getExpandCollapseElement().click();
    });

    it('should check that details table opens (w/o tab header)', () => {
      configuration.getStatusTables().should('be.visible');
      configuration.getTabs().should('not.exist');
    });
  });

  describe('edit configuration test', () => {
    const configName = 'client_cache_size';

    beforeEach(() => {
      configuration.clearTableSearchInput();
      configuration.getTableCount('found').as('configFound');
    });

    after(() => {
      configuration.configClear(configName);
    });

    it('should click and edit a configuration and results should appear in the table', () => {
      configuration.edit(
        configName,
        ['global', '1'],
        ['mon', '2'],
        ['mgr', '3'],
        ['osd', '4'],
        ['mds', '5'],
        ['client', '6']
      );
    });

    it('should verify modified filter is applied properly', () => {
      configuration.filterTable('Modified', 'no');
      configuration.getTableCount('found').as('unmodifiedConfigs');

      // Modified filter value to yes
      configuration.filterTable('Modified', 'yes');
      configuration.getTableCount('found').as('modifiedConfigs');

      cy.get('@configFound').then((configFound) => {
        cy.get('@unmodifiedConfigs').then((unmodifiedConfigs) => {
          const modifiedConfigs = Number(configFound) - Number(unmodifiedConfigs);
          configuration.getTableCount('found').should('eq', modifiedConfigs);
        });
      });

      // Modified filter value to no
      configuration.filterTable('Modified', 'no');
      cy.get('@configFound').then((configFound) => {
        cy.get('@modifiedConfigs').then((modifiedConfigs) => {
          const unmodifiedConfigs = Number(configFound) - Number(modifiedConfigs);
          configuration.getTableCount('found').should('eq', unmodifiedConfigs);
        });
      });
    });
  });
});