1 import { OSDsPageHelper } from '../cluster/osds.po';
2 import { DashboardPageHelper } from '../ui/dashboard.po';
4 describe('OSDs page', () => {
5 const osds = new OSDsPageHelper();
6 const dashboard = new DashboardPageHelper();
10 Cypress.Cookies.preserveOnce('token');
14 describe('when Orchestrator is available', () => {
15 it('should create and delete OSDs', () => {
16 osds.getTableCount('total').as('initOSDCount');
17 osds.navigateTo('create');
20 cy.get('@newOSDCount').then((newCount) => {
21 cy.get('@initOSDCount').then((oldCount) => {
22 const expectedCount = Number(oldCount) + Number(newCount);
25 osds.expectTableCount('total', expectedCount);
27 // landing page is easier to check OSD status
28 dashboard.navigateTo();
29 dashboard.infoCardBody('OSDs').should('contain.text', `${expectedCount} total`);
30 dashboard.infoCardBody('OSDs').should('contain.text', `${expectedCount} up`);
31 dashboard.infoCardBody('OSDs').should('contain.text', `${expectedCount} in`);
34 expect(Number(newCount)).to.be.gte(2);
35 // Delete the first OSD we created
37 const deleteOsdId = Number(oldCount);
38 osds.deleteByIDs([deleteOsdId], false);
39 osds.ensureNoOsd(deleteOsdId);
42 // Replace the second OSD we created
43 const replaceID = Number(oldCount) + 1;
44 osds.deleteByIDs([replaceID], true);
45 osds.checkStatus(replaceID, ['destroyed']);