]>
Commit | Line | Data |
---|---|---|
e306af50 TL |
1 | import { PageHelper } from '../page-helper.po'; |
2 | ||
3 | export class ConfigurationPageHelper extends PageHelper { | |
4 | pages = { | |
5 | index: { url: '#/configuration', id: 'cd-configuration' } | |
6 | }; | |
7 | ||
8 | /** | |
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 | |
11 | */ | |
12 | configClear(name: string) { | |
13 | const valList = ['global', 'mon', 'mgr', 'osd', 'mds', 'client']; // Editable values | |
14 | ||
15 | this.navigateEdit(name); | |
16 | // Waits for the data to load | |
17 | cy.contains('.card-header', `Edit ${name}`); | |
18 | ||
19 | for (const i of valList) { | |
20 | cy.get(`#${i}`).clear(); | |
21 | } | |
22 | // Clicks save button and checks that values are not present for the selected config | |
23 | cy.contains('button', 'Save').click(); | |
24 | ||
25 | // Enter config setting name into filter box | |
26 | this.seachTable(name); | |
27 | ||
28 | // Expand row | |
29 | this.getExpandCollapseElement(name).click(); | |
30 | ||
31 | // Checks for visibility of details tab | |
32 | this.getStatusTables().should('be.visible'); | |
33 | ||
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 + ':'); | |
37 | } | |
38 | } | |
39 | ||
40 | /** | |
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 | |
46 | */ | |
47 | edit(name: string, ...values: [string, string][]) { | |
48 | this.navigateEdit(name); | |
49 | ||
50 | // Waits for data to load | |
51 | cy.contains('.card-header', `Edit ${name}`); | |
52 | ||
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 | |
56 | }); | |
57 | ||
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.contains('button', 'Save').click(); | |
61 | ||
62 | // Enter config setting name into filter box | |
63 | this.seachTable(name); | |
64 | ||
65 | // Checks for visibility of config in table | |
66 | this.getExpandCollapseElement(name).should('be.visible').click(); | |
67 | ||
68 | // Clicks config | |
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]}`); | |
73 | }); | |
74 | } | |
75 | } |