summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/logs.e2e-spec.ts
blob: 9868b89aedbc5489298b34355d7a092078a44a06 (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
import { PoolPageHelper } from '../pools/pools.po';
import { LogsPageHelper } from './logs.po';

describe('Logs page', () => {
  const logs = new LogsPageHelper();
  const pools = new PoolPageHelper();

  const poolname = 'e2e_logs_test_pool';
  const today = new Date();
  let hour = today.getHours();
  if (hour > 12) {
    hour = hour - 12;
  }
  const minute = today.getMinutes();

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

  describe('breadcrumb and tab tests', () => {
    beforeEach(() => {
      logs.navigateTo();
    });

    it('should open and show breadcrumb', () => {
      logs.expectBreadcrumbText('Logs');
    });

    it('should show two tabs', () => {
      logs.getTabsCount().should('eq', 2);
    });

    it('should show cluster logs tab at first', () => {
      logs.getTabText(0).should('eq', 'Cluster Logs');
    });

    it('should show audit logs as a second tab', () => {
      logs.getTabText(1).should('eq', 'Audit Logs');
    });
  });

  describe('audit logs respond to pool creation and deletion test', () => {
    it('should create pool and check audit logs reacted', () => {
      pools.navigateTo('create');
      pools.create(poolname, 8);
      pools.navigateTo();
      pools.existTableCell(poolname, true);
      logs.checkAuditForPoolFunction(poolname, 'create', hour, minute);
    });

    it('should delete pool and check audit logs reacted', () => {
      pools.navigateTo();
      pools.delete(poolname);
      logs.checkAuditForPoolFunction(poolname, 'delete', hour, minute);
    });
  });
});