Skip to content

Commit 21d103a

Browse files
Merge pull request #757 from etmurasaki/etmura-ou-1189
OU-1189: automation for kebab management actions for perses dashboards
2 parents ee45e94 + 4fd9ea1 commit 21d103a

14 files changed

Lines changed: 1130 additions & 290 deletions

web/cypress/e2e/perses/01.coo_list_perses_admin.cy.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { nav } from '../../views/nav';
2-
import { runCOOListPersesTests } from '../../support/perses/01.coo_list_perses_admin.cy';
2+
import { runCOOListPersesDuplicateDashboardTests, runCOOListPersesTests } from '../../support/perses/01.coo_list_perses_admin.cy';
33
import { runCOOListPersesTestsNamespace } from '../../support/perses/01.coo_list_perses_admin_namespace.cy';
44

55
// Set constants for the operators that need to be installed for tests.
@@ -27,13 +27,18 @@ describe('COO - Dashboards (Perses) - List perses dashboards', { tags: ['@perses
2727

2828
beforeEach(() => {
2929
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
30+
cy.wait(5000);
3031
cy.changeNamespace('All Projects');
3132
});
3233

3334
runCOOListPersesTests({
3435
name: 'Administrator',
3536
});
3637

38+
runCOOListPersesDuplicateDashboardTests({
39+
name: 'Administrator',
40+
});
41+
3742
});
3843

3944
//TODO: change tag to @dashboards when customizable-dashboards gets merged

web/cypress/fixtures/perses/constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,11 @@ export const persesDashboardSampleQueries = {
149149
CPU_LINE_MULTI_SERIES_LEGEND: '{{}{{}mode{}}{}} mode - {{}{{}job{}}{}} {{}{{}instance{}}{}}',
150150
CPU_LINE_MULTI_SERIES_SERIES_SELECTOR: 'up{{}job=~"$job"{}}',
151151
}
152+
153+
export const persesDashboardsRenameDashboard = {
154+
DIALOG_MAX_LENGTH_VALIDATION: 'Must be 75 or fewer characters long: error status;',
155+
}
156+
157+
export const persesDashboardsDuplicateDashboard = {
158+
DIALOG_DUPLICATED_NAME_VALIDATION: "already exists", //use contains
159+
}

web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts

Lines changed: 174 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
import { persesDashboardsAcceleratorsCommonMetricsPanels, persesDashboardsDashboardDropdownCOO, persesDashboardsDashboardDropdownPersesDev } from '../../fixtures/perses/constants';
1+
import { persesDashboardsAcceleratorsCommonMetricsPanels, persesDashboardsDashboardDropdownCOO, persesDashboardsDashboardDropdownPersesDev, persesDashboardsEmptyDashboard } from '../../fixtures/perses/constants';
22
import { persesDashboardsPage } from '../../views/perses-dashboards';
33
import { persesMUIDataTestIDs } from '../../../src/components/data-test';
4-
import { listPersesDashboardsPage } from '../../views/list-perses-dashboards';
4+
import { listPersesDashboardsPage } from '../../views/perses-dashboards-list-dashboards';
5+
import { persesDashboardsPanelGroup } from '../../views/perses-dashboards-panelgroup';
6+
import { persesDashboardsPanel } from '../../views/perses-dashboards-panel';
7+
import { persesDashboardsEditVariables } from '../../views/perses-dashboards-edit-variables';
8+
import { persesCreateDashboardsPage } from '../../views/perses-dashboards-create-dashboard';
9+
import { persesDashboardsAddListVariableSource } from '../../fixtures/perses/constants';
10+
import { persesDashboardSampleQueries } from '../../fixtures/perses/constants';
11+
import { persesDashboardsAddListPanelType } from '../../fixtures/perses/constants';
12+
import { commonPages } from '../../views/common';
513

614
export interface PerspectiveConfig {
715
name: string;
@@ -17,14 +25,14 @@ export function testBVTCOOPerses1(perspective: PerspectiveConfig) {
1725
it(`1.${perspective.name} perspective - Dashboards (Perses) page`, () => {
1826
cy.log(`1.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
1927
listPersesDashboardsPage.shouldBeLoaded();
20-
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2]);
28+
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[0]);
2129
persesDashboardsPage.shouldBeLoaded1();
2230
});
2331

2432
it(`2.${perspective.name} perspective - Accelerators common metrics dashboard `, () => {
2533
cy.log(`2.1. use sidebar nav to go to Observe > Dashboards (Perses) > Accelerators common metrics dashboard`);
2634
cy.changeNamespace('openshift-cluster-observability-operator');
27-
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2]);
35+
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[0]);
2836
cy.wait(2000);
2937

3038
cy.log(`2.2. Select dashboard`);
@@ -39,7 +47,7 @@ export function testBVTCOOPerses1(perspective: PerspectiveConfig) {
3947
it(`3.${perspective.name} perspective - Perses Dashboard Sample dashboard`, () => {
4048
cy.log(`3.1. use sidebar nav to go to Observe > Dashboards (Perses) > Perses Dashboard Sample dashboard`);
4149
cy.changeNamespace('perses-dev');
42-
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[2]);
50+
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
4351
cy.wait(2000);
4452
persesDashboardsPage.clickDashboardDropdown(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0] as keyof typeof persesDashboardsDashboardDropdownPersesDev);
4553
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-job').should('be.visible');
@@ -56,12 +64,172 @@ export function testBVTCOOPerses1(perspective: PerspectiveConfig) {
5664

5765
it(`4.${perspective.name} perspective - Download and View JSON`, () => {
5866
cy.log(`4.1. use sidebar nav to go to Observe > Dashboards (Perses) > Download and View JSON`);
59-
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2]);
67+
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[0]);
6068
persesDashboardsPage.downloadDashboard(true, persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2], 'JSON');
6169
persesDashboardsPage.downloadDashboard(true, persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2], 'YAML');
6270
persesDashboardsPage.downloadDashboard(true, persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2], 'YAML (CR)');
6371
persesDashboardsPage.viewJSON(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2], 'openshift-cluster-observability-operator');
6472

6573
});
6674

75+
it(`5.${perspective.name} perspective - Duplicate from a project to another, Rename and Delete`, () => {
76+
cy.log(`5.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
77+
commonPages.titleShouldHaveText('Dashboards');
78+
listPersesDashboardsPage.shouldBeLoaded();
79+
80+
cy.log(`5.2. Change namespace to perses-dev`);
81+
cy.changeNamespace('perses-dev');
82+
listPersesDashboardsPage.countDashboards('3');
83+
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
84+
listPersesDashboardsPage.countDashboards('1');
85+
86+
cy.log(`5.3. Click on the Kebab icon - Duplicate to another project`);
87+
listPersesDashboardsPage.clickKebabIcon();
88+
listPersesDashboardsPage.clickDuplicateOption();
89+
listPersesDashboardsPage.duplicateDashboardEnterName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
90+
listPersesDashboardsPage.duplicateDashboardSelectProjectDropdown('openshift-cluster-observability-operator');
91+
listPersesDashboardsPage.duplicateDashboardDuplicateButton();
92+
persesDashboardsPage.shouldBeLoadedEditionMode(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
93+
persesDashboardsPage.shouldBeLoadedAfterDuplicate(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
94+
persesDashboardsPage.backToListPersesDashboardsPage();
95+
96+
cy.log(`5.4. Click on the Kebab icon - Rename`);
97+
cy.changeNamespace('openshift-cluster-observability-operator');
98+
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0]);
99+
listPersesDashboardsPage.countDashboards('1');
100+
listPersesDashboardsPage.clickKebabIcon();
101+
listPersesDashboardsPage.clickRenameDashboardOption();
102+
listPersesDashboardsPage.renameDashboardEnterName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0] + ' - Renamed');
103+
listPersesDashboardsPage.renameDashboardRenameButton();
104+
105+
cy.log(`5.5. Click on the Kebab icon - Delete`);
106+
listPersesDashboardsPage.clearAllFilters();
107+
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0] + ' - Renamed');
108+
listPersesDashboardsPage.countDashboards('1');
109+
110+
cy.log(`5.6. Click on the Kebab icon - Delete`);
111+
listPersesDashboardsPage.clickKebabIcon();
112+
listPersesDashboardsPage.clickDeleteOption();
113+
listPersesDashboardsPage.deleteDashboardDeleteButton();
114+
listPersesDashboardsPage.emptyState();
115+
listPersesDashboardsPage.countDashboards('0');
116+
117+
cy.log(`5.7. Search for the renamed dashboard`);
118+
listPersesDashboardsPage.clearAllFilters();
119+
cy.changeNamespace('All Projects');
120+
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0] + ' - Renamed');
121+
listPersesDashboardsPage.countDashboards('0');
122+
listPersesDashboardsPage.clearAllFilters();
123+
124+
});
125+
126+
it(`6.${perspective.name} perspective - Create Dashboard with panel groups, panels and variables`, () => {
127+
let dashboardName = 'Testing Dashboard - UP ';
128+
let randomSuffix = Math.random().toString(5);
129+
dashboardName += randomSuffix;
130+
cy.log(`6.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
131+
listPersesDashboardsPage.shouldBeLoaded();
132+
133+
cy.log(`6.2. Click on Create button`);
134+
listPersesDashboardsPage.clickCreateButton();
135+
persesCreateDashboardsPage.createDashboardShouldBeLoaded();
136+
137+
cy.log(`6.3. Create Dashboard`);
138+
persesCreateDashboardsPage.selectProject('perses-dev');
139+
persesCreateDashboardsPage.enterDashboardName(dashboardName);
140+
persesCreateDashboardsPage.createDashboardDialogCreateButton();
141+
persesDashboardsPage.shouldBeLoadedEditionMode(dashboardName);
142+
persesDashboardsPage.shouldBeLoadedEditionModeFromCreateDashboard();
143+
144+
cy.log(`6.4. Add Variable`);
145+
persesDashboardsPage.clickEditActionButton('EditVariables');
146+
persesDashboardsEditVariables.clickButton('Add Variable');
147+
persesDashboardsEditVariables.addListVariable('interval', false, false, '', '', '', undefined, undefined);
148+
persesDashboardsEditVariables.addListVariable_staticListVariable_enterValue('1m');
149+
persesDashboardsEditVariables.addListVariable_staticListVariable_enterValue('5m');
150+
persesDashboardsEditVariables.clickButton('Add');
151+
152+
persesDashboardsEditVariables.clickButton('Add Variable');
153+
persesDashboardsEditVariables.addListVariable('job', false, false, '', '', '', persesDashboardsAddListVariableSource.PROMETHEUS_LABEL_VARIABLE, undefined);
154+
persesDashboardsEditVariables.addListVariable_promLabelValuesVariable_enterLabelName('job');
155+
persesDashboardsEditVariables.clickButton('Add');
156+
157+
persesDashboardsEditVariables.clickButton('Add Variable');
158+
persesDashboardsEditVariables.addListVariable('instance', false, false, '', '', '', persesDashboardsAddListVariableSource.PROMETHEUS_LABEL_VARIABLE, undefined);
159+
persesDashboardsEditVariables.addListVariable_promLabelValuesVariable_enterLabelName('instance');
160+
persesDashboardsEditVariables.addListVariable_promLabelValuesVariable_addSeriesSelector(persesDashboardSampleQueries.CPU_LINE_MULTI_SERIES_SERIES_SELECTOR);
161+
persesDashboardsEditVariables.clickButton('Add');
162+
163+
persesDashboardsEditVariables.clickButton('Apply');
164+
persesDashboardsPage.clickEditActionButton('Save');
165+
166+
cy.log(`6.5. Add Panel Group`);
167+
persesDashboardsPage.clickEditButton();
168+
persesDashboardsPage.clickEditActionButton('AddGroup');
169+
persesDashboardsPanelGroup.addPanelGroup('Panel Group Up', 'Open', '');
170+
171+
cy.log(`6.6. Add Panel`);
172+
persesDashboardsPage.clickEditActionButton('AddPanel');
173+
persesDashboardsPanel.addPanelShouldBeLoaded();
174+
persesDashboardsPanel.addPanel('Up', 'Panel Group Up', persesDashboardsAddListPanelType.TIME_SERIES_CHART, 'This is a line chart test', 'up');
175+
persesDashboardsPage.clickEditActionButton('Save');
176+
177+
cy.log(`6.7. Back and check panel`);
178+
persesDashboardsPage.backToListPersesDashboardsPage();
179+
listPersesDashboardsPage.filter.byName(dashboardName);
180+
listPersesDashboardsPage.clickDashboard(dashboardName);
181+
persesDashboardsPage.panelGroupHeaderAssertion('Panel Group Up', 'Open');
182+
persesDashboardsPage.assertPanel('Up', 'Panel Group Up', 'Open');
183+
persesDashboardsPage.assertVariableBeVisible('interval');
184+
persesDashboardsPage.assertVariableBeVisible('job');
185+
persesDashboardsPage.assertVariableBeVisible('instance');
186+
187+
cy.log(`6.8. Click on Edit button`);
188+
persesDashboardsPage.clickEditButton();
189+
190+
cy.log(`6.9. Click on Edit Variables button and Delete all variables`);
191+
persesDashboardsPage.clickEditActionButton('EditVariables');
192+
persesDashboardsEditVariables.clickDeleteVariableButton(0);
193+
persesDashboardsEditVariables.clickDeleteVariableButton(0);
194+
persesDashboardsEditVariables.clickDeleteVariableButton(0);
195+
persesDashboardsEditVariables.clickButton('Apply');
196+
197+
cy.log(`6.10. Assert variables not exist`);
198+
persesDashboardsPage.assertVariableNotExist('interval');
199+
persesDashboardsPage.assertVariableNotExist('job');
200+
persesDashboardsPage.assertVariableNotExist('instance');
201+
202+
cy.log(`6.11. Delete Panel`);
203+
persesDashboardsPanel.deletePanel('Up');
204+
persesDashboardsPanel.clickDeletePanelButton();
205+
206+
cy.log(`6.12. Delete Panel Group`);
207+
persesDashboardsPanelGroup.clickPanelGroupAction('Panel Group Up', 'delete');
208+
persesDashboardsPanelGroup.clickDeletePanelGroupButton();
209+
persesDashboardsPage.clickEditActionButton('Save');
210+
211+
cy.get('h2').contains(persesDashboardsEmptyDashboard.TITLE).scrollIntoView().should('be.visible');
212+
cy.get('p').contains(persesDashboardsEmptyDashboard.DESCRIPTION).scrollIntoView().should('be.visible');
213+
214+
persesDashboardsPage.backToListPersesDashboardsPage();
215+
216+
cy.log(`6.13. Filter by Name`);
217+
listPersesDashboardsPage.filter.byName(dashboardName);
218+
listPersesDashboardsPage.countDashboards('1');
219+
220+
cy.log(`6.14. Click on the Kebab icon - Delete`);
221+
listPersesDashboardsPage.clickKebabIcon();
222+
listPersesDashboardsPage.clickDeleteOption();
223+
listPersesDashboardsPage.deleteDashboardDeleteButton();
224+
listPersesDashboardsPage.emptyState();
225+
listPersesDashboardsPage.countDashboards('0');
226+
listPersesDashboardsPage.clearAllFilters();
227+
228+
cy.log(`6.15. Filter by Name`);
229+
listPersesDashboardsPage.filter.byName(dashboardName);
230+
listPersesDashboardsPage.countDashboards('0');
231+
listPersesDashboardsPage.clearAllFilters();
232+
233+
});
234+
67235
}

0 commit comments

Comments
 (0)