1 import { PageHelper } from '../page-helper.po';
3 export class ConfigurationPageHelper extends PageHelper {
5 index: { url: '#/configuration', id: 'cd-configuration' }
9 * Clears out all the values in a config to reset before and after testing
10 * Does not work for configs with checkbox only, possible future PR
12 configClear(name: string) {
13 const valList = ['global', 'mon', 'mgr', 'osd', 'mds', 'client']; // Editable values
15 this.navigateEdit(name);
16 // Waits for the data to load
17 cy.contains('.card-header', `Edit ${name}`);
19 for (const i of valList) {
20 cy.get(`#${i}`).clear();
22 // Clicks save button and checks that values are not present for the selected config
23 cy.get('[data-cy=submitBtn]').click();
25 // Enter config setting name into filter box
26 this.seachTable(name);
29 this.getExpandCollapseElement(name).click();
31 // Checks for visibility of details tab
32 this.getStatusTables().should('be.visible');
34 for (const i of valList) {
35 // Waits until values are not present in the details table
36 this.getStatusTables().should('not.contain.text', i + ':');
41 * Clicks the designated config, then inputs the values passed into the edit function.
42 * Then checks if the edit is reflected in the config table.
43 * Takes in name of config and a list of tuples of values the user wants edited,
44 * each tuple having the desired value along with the number tehey want for that value.
45 * Ex: [global, '2'] is the global value with an input of 2
47 edit(name: string, ...values: [string, string][]) {
48 this.navigateEdit(name);
50 // Waits for data to load
51 cy.contains('.card-header', `Edit ${name}`);
53 values.forEach((valtuple) => {
54 // Finds desired value based off given list
55 cy.get(`#${valtuple[0]}`).type(valtuple[1]); // of values and inserts the given number for the value
58 // Clicks save button then waits until the desired config is visible, clicks it,
59 // then checks that each desired value appears with the desired number
60 cy.get('[data-cy=submitBtn]').click();
62 // Enter config setting name into filter box
63 this.seachTable(name);
65 // Checks for visibility of config in table
66 this.getExpandCollapseElement(name).should('be.visible').click();
69 values.forEach((value) => {
70 // iterates through list of values and
71 // checks if the value appears in details with the correct number attatched
72 cy.contains('.table.table-striped.table-bordered', `${value[0]}\: ${value[1]}`);