summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/cypress/integration/block/mirroring.po.ts
blob: e24a3ebc037abbc8b1b2fd619fe89e57e86d3f54 (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
import { PageHelper } from '../page-helper.po';

const pages = {
  index: { url: '#/block/mirroring', id: 'cd-mirroring' }
};

export class MirroringPageHelper extends PageHelper {
  pages = pages;

  /**
   * Goes to the mirroring page and edits a pool in the Pool table. Clicks on the
   * pool and chooses an option (either pool, image, or disabled)
   */
  @PageHelper.restrictTo(pages.index.url)
  editMirror(name: string, option: string) {
    // Select the pool in the table
    this.getFirstTableCell(name).click();

    // Clicks the Edit Mode button
    cy.contains('button', 'Edit Mode').click();

    // Clicks the drop down in the edit pop-up, then clicks the Update button
    cy.get('.modal-content').should('be.visible');
    this.selectOption('mirrorMode', option);

    // Clicks update button and checks if the mode has been changed
    cy.contains('button', 'Update').click();
    cy.contains('.modal-dialog', 'Edit pool mirror mode').should('not.exist');
    const val = option.toLowerCase(); // used since entries in table are lower case
    this.getFirstTableCell(val).should('be.visible');

    // unselect the pool in the table
    this.getFirstTableCell(name).click();
  }
}