Skip to content

Commit dc643a1

Browse files
authored
Merge branch 'master' into SER-2577-push-dashboard-summary-needs-to-be-updated-according-to-the-new-events-data-collection
2 parents 6b7b669 + ff6afae commit dc643a1

File tree

5 files changed

+200
-4
lines changed

5 files changed

+200
-4
lines changed

ui-tests/cypress/e2e/dashboard/dashboards/dashboards.cy.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,64 @@ describe('Create New Custom Dashboard', () => {
8585
reportHelper.openReportPreviewButton();
8686
reportHelper.verifyReportPreviewPageImage();
8787
});
88+
89+
it(`Create a private custom dashboard and duplicate it and edit it and delete it then verify the flow`, function() {
90+
91+
const dashboard = generateDashboardFixture();
92+
const editedDashboard = generateDashboardFixture();
93+
const editPermissionEmail = generateDashboardFixture();
94+
const viewOnlyPermissionEmail = generateDashboardFixture();
95+
96+
dashboardsHelper.clickDashboardsNewButton();
97+
dashboardsHelper.typeDashboardName(dashboard.dashboardName);
98+
dashboardsHelper.selectPrivateDashboardVisibility();
99+
dashboardsHelper.selectNotifyAllUsersViaEmail();
100+
dashboardsHelper.selectUseCustomRefreshRate();
101+
dashboardsHelper.clickCreateDashboardButton();
102+
dashboardsHelper.verifyDashboardCreatedNotification();
103+
dashboardsHelper.closeNotification();
104+
105+
dashboardsHelper.verifyCustomDashboardElements({
106+
dashboardName: dashboard.dashboardName,
107+
createdTime: "just now",
108+
createdBy: "[email protected]",
109+
});
110+
111+
// Duplicate dashboard
112+
dashboardsHelper.openDuplicateDashboard();
113+
dashboardsHelper.clickSaveDashboardButton();
114+
dashboardsHelper.verifyDashboardCreatedNotification();
115+
dashboardsHelper.closeNotification();
116+
117+
dashboardsHelper.verifyCustomDashboardElements({
118+
dashboardName: "Copy - " + dashboard.dashboardName,
119+
createdTime: "just now",
120+
createdBy: "[email protected]",
121+
});
122+
123+
//Edit dashboard
124+
dashboardsHelper.openEditDashboard();
125+
dashboardsHelper.typeDashboardName(editedDashboard.dashboardName);
126+
dashboardsHelper.selectSomeSpecificUsersDashboardVisibility();
127+
dashboardsHelper.typeEditPermissionEmail(editPermissionEmail.email);
128+
dashboardsHelper.typeViewOnlyPermissionEmail(viewOnlyPermissionEmail.email);
129+
dashboardsHelper.clickSaveDashboardButton();
130+
dashboardsHelper.verifyDashboardEditedNotification();
131+
dashboardsHelper.closeNotification();
132+
133+
dashboardsHelper.verifyCustomDashboardElements({
134+
dashboardName: editedDashboard.dashboardName,
135+
createdTime: "seconds",
136+
createdBy: "[email protected]",
137+
});
138+
139+
//Delete dashboard
140+
dashboardsHelper.openDeleteDashboard();
141+
dashboardsHelper.verifyDeleteDashboardPopupElements(editedDashboard.dashboardName);
142+
dashboardsHelper.clickYesDeleteDashboardButton();
143+
dashboardsHelper.verifyDashboardDeletedNotification();
144+
dashboardsHelper.closeNotification();
145+
dashboardsHelper.searchDashboard(editedDashboard.dashboardName);
146+
dashboardsHelper.verifyDashboardShouldBeDeleted();
147+
});
88148
});

ui-tests/cypress/fixtures/generators/dashboards/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ const { faker } = require('@faker-js/faker');
22

33
const generator = () => {
44
const dashboardName = faker.lorem.words({ min: 3, max: 10 });
5+
const email = faker.internet.email();
56

67
return {
7-
dashboardName
8+
dashboardName,
9+
email
810
};
911
};
1012

ui-tests/cypress/lib/dashboard/dashboards/dashboards.js

Lines changed: 119 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
customDashboardDrawerElements,
66
newWidgetDrawerElements
77
} from "../../../support/elements/dashboard/dashboards/dashboards";
8+
import sidebarElements from '../../../support/elements/sidebar/sidebar';
89

910
//Dashboard Sidebar Menu
1011
const clickDashboardsNewButton = () => {
@@ -17,7 +18,7 @@ const typeDashboardName = (dashboardName) => {
1718
};
1819

1920
const clickCreateDashboardButton = () => {
20-
cy.clickElement(customDashboardDrawerElements.CREATE_BUTTON);
21+
cy.clickElement(customDashboardDrawerElements.CREATE_BUTTON, true);
2122
cy.checkPaceActive();
2223
};
2324

@@ -134,7 +135,106 @@ const clickCreateWidgetButton = () => {
134135
cy.clickElement(newWidgetDrawerElements.CREATE_WIDGET_BUTTON);
135136
};
136137

137-
//
138+
const selectPrivateDashboardVisibility = () => {
139+
cy.clickElement(customDashboardDrawerElements.DASHBOARD_VISIBILITY_RADIO_BUTTON_PRIVATE);
140+
};
141+
142+
const selectNotifyAllUsersViaEmail = () => {
143+
cy.clickElement(customDashboardDrawerElements.NOTIFY_VIA_EMAIL_CHECKBOX_INPUT);
144+
};
145+
146+
const selectUseCustomRefreshRate = () => {
147+
cy.clickElement(customDashboardDrawerElements.USE_REFRESH_RATE_CHECKBOX_INPUT);
148+
};
149+
150+
const selectSomeSpecificUsersDashboardVisibility = () => {
151+
cy.clickElement(customDashboardDrawerElements.DASHBOARD_VISIBILITY_RADIO_BUTTON_SOME_SPECIFIC_USERS);
152+
};
153+
154+
const openDuplicateDashboard = () => {
155+
cy.clickElement(customDashboardElements.MORE_OPTIONS_BUTTON);
156+
cy.clickElement(customDashboardElements.MORE_OPTIONS_BUTTON_DUPLICATE_OPTION);
157+
};
158+
159+
const openEditDashboard = () => {
160+
cy.clickElement(customDashboardElements.MORE_OPTIONS_BUTTON);
161+
cy.clickElement(customDashboardElements.MORE_OPTIONS_BUTTON_EDIT_OPTION);
162+
};
163+
164+
const verifyDashboardEditedNotification = () => {
165+
cy.verifyElement({
166+
labelElement: customDashboardElements.NOTIFICATION_SAVED_SUCCESSFULLY_MESSAGE,
167+
labelText: "Dashboard edited successfully!"
168+
});
169+
};
170+
171+
const openDeleteDashboard = () => {
172+
cy.clickElement(customDashboardElements.MORE_OPTIONS_BUTTON);
173+
cy.clickElement(customDashboardElements.MORE_OPTIONS_BUTTON_DELETE_OPTION);
174+
};
175+
176+
const verifyDeleteDashboardPopupElements = (dashboardName) => {
177+
178+
cy.verifyElement({
179+
labelElement: customDashboardElements.DELETE_POPUP_TITLE,
180+
labelText: "Delete dashboard?"
181+
});
182+
183+
cy.verifyElement({
184+
element: customDashboardElements.DELETE_POPUP_CLOSE_ICON
185+
});
186+
187+
cy.verifyElement({
188+
labelElement: customDashboardElements.DELETE_POPUP_SUBTITLE,
189+
labelText: "Do you really want to delete dashboard called " + dashboardName + " ?"
190+
});
191+
192+
cy.verifyElement({
193+
labelElement: customDashboardElements.DELETE_POPUP_CANCEL_BUTTON,
194+
labelText: "No, don't delete"
195+
});
196+
197+
cy.verifyElement({
198+
labelElement: customDashboardElements.DELETE_POPUP_DELETE_BUTTON,
199+
labelText: "Yes, delete dashboard"
200+
});
201+
};
202+
203+
const clickYesDeleteDashboardButton = () => {
204+
cy.clickElement(customDashboardElements.DELETE_POPUP_DELETE_BUTTON, true);
205+
};
206+
207+
const verifyDashboardDeletedNotification = () => {
208+
cy.verifyElement({
209+
labelElement: customDashboardElements.NOTIFICATION_SAVED_SUCCESSFULLY_MESSAGE,
210+
labelText: "Dashboard deleted successfully!"
211+
});
212+
};
213+
214+
const clickSaveDashboardButton = () => {
215+
cy.clickElement(customDashboardDrawerElements.CREATE_BUTTON, 1, true);
216+
};
217+
218+
const typeEditPermissionEmail = (editPermissionEmail) => {
219+
cy.clickElement(customDashboardDrawerElements.DASHBOARD_EDIT_PERMISSIONS_INPUT);
220+
cy.typeInputWithIndex(customDashboardDrawerElements.DASHBOARD_EDIT_PERMISSIONS_SEARCH_BOX, editPermissionEmail, { index: 1, force: true });
221+
cy.clickElement(customDashboardDrawerElements.DASHBOARD_EDIT_PERMISSIONS_INPUT, true);
222+
};
223+
224+
const typeViewOnlyPermissionEmail = (viewPermissionEmail) => {
225+
cy.clickElement(customDashboardDrawerElements.DASHBOARD_VIEW_PERMISSIONS_INPUT);
226+
cy.typeInputWithIndex(customDashboardDrawerElements.DASHBOARD_EDIT_PERMISSIONS_SEARCH_BOX, viewPermissionEmail, {index: 1, force: true});
227+
};
228+
229+
const searchDashboard = (dashboardName) => {
230+
cy.clickElement(sidebarElements.SIDEBAR_MENU_OPTIONS.DASHBOARDS);
231+
cy.typeInput(dashboardsMenuElements().DASHBOARD_SEARCH_BOX, dashboardName);
232+
};
233+
234+
const verifyDashboardShouldBeDeleted = () => {
235+
cy.shouldNotExist(customDashboardElements.DASHBOARD_ITEM);
236+
};
237+
138238

139239
module.exports = {
140240
clickDashboardsNewButton,
@@ -150,5 +250,21 @@ module.exports = {
150250
selectVisualizationType,
151251
selectMetric,
152252
clickCreateWidgetButton,
153-
openCreateNewReportDrawer
253+
openCreateNewReportDrawer,
254+
selectPrivateDashboardVisibility,
255+
selectNotifyAllUsersViaEmail,
256+
selectUseCustomRefreshRate,
257+
selectSomeSpecificUsersDashboardVisibility,
258+
openDuplicateDashboard,
259+
openEditDashboard,
260+
verifyDashboardEditedNotification,
261+
openDeleteDashboard,
262+
verifyDeleteDashboardPopupElements,
263+
clickYesDeleteDashboardButton,
264+
verifyDashboardDeletedNotification,
265+
clickSaveDashboardButton,
266+
typeEditPermissionEmail,
267+
typeViewOnlyPermissionEmail,
268+
searchDashboard,
269+
verifyDashboardShouldBeDeleted
154270
};

ui-tests/cypress/support/commands.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ Cypress.Commands.add("typeInput", (element, tag) => {
77
cy.getElement(element).clear().type(tag);
88
});
99

10+
Cypress.Commands.add("typeInputWithIndex", (element, tag, { index = 0, force = false } = {}) => {
11+
cy.getElement(element)
12+
.eq(index)
13+
.clear({ force })
14+
.type(`${tag}{enter}`, { force });
15+
});
16+
1017
Cypress.Commands.add("clearInput", (element) => {
1118
cy.getElement(element).clear();
1219
});

ui-tests/cypress/support/elements/dashboard/dashboards/dashboards.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ const customDashboardElements = {
3131

3232
NOTIFICATION_SAVED_SUCCESSFULLY_MESSAGE: 'cly-notification-text',
3333
NOTIFICATION_SAVED_SUCCESSFULLY_MESSAGE_CLOSE_ICON: 'cly-notification-full-size-close-icon',
34+
35+
DASHBOARD_ITEM: "custom-dashboard-0",
36+
37+
//Delete popup elements
38+
DELETE_POPUP_TITLE: "cly-confirm-test-id-cly-confirm-dialog-title-label",
39+
DELETE_POPUP_CLOSE_ICON: "el-dialog-test-id-el-dialog-close-button",
40+
DELETE_POPUP_SUBTITLE: "el-dialog-test-id-el-dialog-content-label",
41+
DELETE_POPUP_CANCEL_BUTTON: "cly-confirm-test-id-cly-confirm-dialog-cancel-button",
42+
DELETE_POPUP_DELETE_BUTTON: "cly-confirm-test-id-cly-confirm-dialog-save-button"
3443
};
3544

3645
const customDashboardWidgetElements = (index = 0) => ({
@@ -64,9 +73,11 @@ const customDashboardDrawerElements = {
6473
DASHBOARD_EDIT_PERMISSIONS_LABEL: "dashboard-users-edit-permission-label-header",
6574
DASHBOARD_EDIT_PERMISSIONS_SUB_LABEL: "dashboard-users-edit-permission-label-sub-header",
6675
DASHBOARD_EDIT_PERMISSIONS_INPUT: "edit-permission-user-email-input",
76+
DASHBOARD_EDIT_PERMISSIONS_SEARCH_BOX: "search-email-input",
6777
DASHBOARD_VIEW_PERMISSIONS_LABEL: "dashboard-users-view-permission-label-header",
6878
DASHBOARD_VIEW_PERMISSIONS_SUB_LABEL: "dashboard-users-view-permission-label-sub-header",
6979
DASHBOARD_VIEW_PERMISSIONS_INPUT: "view-permission-user-email-input",
80+
DASHBOARD_VIEW_ONLY_PERMISSIONS_SEARCH_BOX: "search-email-input",
7081

7182
DASHBOARD_ADDITIONAL_SETTINGS_LABEL: "dashboard-additional-settings-label",
7283
NOTIFY_VIA_EMAIL_CHECKBOX_LABEL: 'dashboard-send-email-checkbox-el-checkbox-label',

0 commit comments

Comments
 (0)