summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/cypress/integration/orchestrator/workflow/nfs/nfs-export.po.ts
blob: c700ef0581dd761c89754e1a2c5a660a13c2081b (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
/* tslint:disable*/
import { PageHelper } from '../../../page-helper.po';
/* tslint:enable*/

const pages = {
  index: { url: '#/nfs', id: 'cd-nfs-list' },
  create: { url: '#/nfs/create', id: 'cd-nfs-form' }
};

export class NFSPageHelper extends PageHelper {
  pages = pages;

  @PageHelper.restrictTo(pages.create.url)
  create(backend: string, squash: string, client: object, pseudo: string, rgwPath?: string) {
    this.selectOption('cluster_id', 'testnfs');
    // select a storage backend
    this.selectOption('name', backend);
    if (backend === 'CephFS') {
      this.selectOption('fs_name', 'myfs');

      cy.get('#security_label').click({ force: true });
    } else {
      cy.get('input[data-testid=rgw_path]').type(rgwPath);
    }

    cy.get('input[name=pseudo]').type(pseudo);
    this.selectOption('squash', squash);

    // Add clients
    cy.get('button[name=add_client]').click({ force: true });
    cy.get('input[name=addresses]').type(client['addresses']);

    // Check if we can remove clients and add it again
    cy.get('span[name=remove_client]').click({ force: true });
    cy.get('button[name=add_client]').click({ force: true });
    cy.get('input[name=addresses]').type(client['addresses']);

    cy.get('cd-submit-button').click();
  }

  editExport(pseudo: string, editPseudo: string) {
    this.navigateEdit(pseudo);

    cy.get('input[name=pseudo]').clear().type(editPseudo);

    cy.get('cd-submit-button').click();

    // Click the export and check its details table for updated content
    this.getExpandCollapseElement(editPseudo).click();
    cy.get('.active.tab-pane').should('contain.text', editPseudo);
  }
}