Skip to content

Commit 55a2250

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/fs-extra-11.3.4
2 parents 63bebc1 + 74f5604 commit 55a2250

6 files changed

Lines changed: 61 additions & 52 deletions

File tree

ui-tests/cypress.config.sample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = defineConfig({
1616
e2e: {
1717
baseUrl: "http://localhost",
1818
defaultCommandTimeout: 30000,
19-
retries: 2,
19+
//retries: 2,
2020
viewportWidth: 2000,
2121
viewportHeight: 1100,
2222
numTestsKeptInMemory: 0,

ui-tests/cypress/lib/dashboard/analytics/events/events.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ const verifyFullDataPageElements = () => {
212212

213213
verifyStaticElementsOfCompareEventsPage();
214214

215-
selectEventsToCompare('Credit Card Application');
215+
selectEventsToCompare('Credit Card Payment');
216216
clickCompare();
217217

218218
verifyCompareEventsEChartElements({
@@ -388,7 +388,7 @@ const verifyEventStatsDataTableElements = ({
388388

389389
const verifyCompareEventsEChartElements = ({
390390
isEmpty = false,
391-
eventName = 'Credit Card Application',
391+
eventName = 'Credit Card Payment',
392392
}) => {
393393

394394
if (isEmpty) {

ui-tests/cypress/lib/dashboard/feedback/ratings/widgets.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,8 @@ const getWidgetIdFromDataTable = (index) => {
906906

907907
const navigateToWidgetsDetailPage = (widgetName) => {
908908
searchWidgetOnDataTable(widgetName);
909-
cy.clickElement(widgetsDataTableElements().WIDGET_NAME, true);
909+
cy.clickElement(widgetsDataTableElements().WIDGET_NAME);
910+
cy.checkLoading();
910911
};
911912

912913
const verifyWidgetDetailsPageElements = ({
@@ -1065,7 +1066,6 @@ const verifyWidgetDetailsPageElements = ({
10651066

10661067
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_TAB_COMMENTS);
10671068
cy.scrollPageToBottom('.main-view');
1068-
10691069
cy.verifyElement({
10701070
labelElement: feedbackRatingWidgetDetailsCommentsDataTableElements().COLUMN_NAME_RATING_LABEL,
10711071
labelText: "Rating",
@@ -1087,27 +1087,24 @@ const verifyWidgetDetailsPageElements = ({
10871087
});
10881088

10891089
for (index = 0; index < commentsTable.ratings.length; index++) {
1090+
1091+
cy.scrollPageToBottom('.main-view');
1092+
10901093
cy.verifyElement({
10911094
labelElement: feedbackRatingWidgetDetailsCommentsDataTableElements(index).ROW_RATING,
10921095
labelText: commentsTable.ratings[index],
10931096
});
1094-
}
10951097

1096-
for (index = 0; index < commentsTable.ratings.length; index++) {
10971098
cy.verifyElement({
10981099
labelElement: feedbackRatingWidgetDetailsCommentsDataTableElements(index).ROW_TIME,
10991100
labelText: commentsTable.times,
11001101
});
1101-
}
11021102

1103-
for (index = 0; index < commentsTable.comments.length; index++) {
11041103
cy.verifyElement({
11051104
labelElement: feedbackRatingWidgetDetailsCommentsDataTableElements(index).ROW_COMMENT,
11061105
labelText: commentsTable.comments[index],
11071106
});
1108-
}
11091107

1110-
for (index = 0; index < commentsTable.emails.length; index++) {
11111108
cy.verifyElement({
11121109
labelElement: feedbackRatingWidgetDetailsCommentsDataTableElements(index).ROW_EMAIL,
11131110
labelText: commentsTable.emails[index],
@@ -1117,9 +1114,9 @@ const verifyWidgetDetailsPageElements = ({
11171114
};
11181115

11191116
const deleteWidget = () => {
1120-
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_MORE_BUTTON);
1121-
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_DELETE_BUTTON);
1122-
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_DELETE_CONFIRM_BUTTON);
1117+
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_MORE_BUTTON, true);
1118+
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_DELETE_BUTTON, true);
1119+
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_DELETE_CONFIRM_BUTTON, true);
11231120
};
11241121

11251122
const shouldBeWidgetDeleted = (question) => {
@@ -1137,19 +1134,19 @@ const shouldBeWidgetDeleted = (question) => {
11371134
};
11381135

11391136
const stopWidget = () => {
1140-
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_STOP_WIDGET_BUTTON);
1137+
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_STOP_WIDGET_BUTTON, true);
11411138
};
11421139

11431140
const shouldBeWidgetStopped = () => {
11441141
cy.shouldContainText(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_STATUS_LABEL, 'Stopped');
11451142
};
11461143

11471144
const clickEditWidgetButton = () => {
1148-
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_EDIT_WIDGET_BUTTON);
1145+
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_EDIT_WIDGET_BUTTON, true);
11491146
};
11501147

11511148
const clickBackToRatingWidgetLink = () => {
1152-
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_BACK_TO_RATING_WIDGETS_LINK);
1149+
cy.clickElement(feedbackRatingWidgetDetailsPageElements.RATINGS_WIDGET_DETAILS_BACK_TO_RATING_WIDGETS_LINK, true);
11531150
};
11541151

11551152
const createRatingWithApi = (username, password, appName, widgetName) => {

ui-tests/cypress/lib/dashboard/manage/sdk/stats.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ const verifyStaticElementsOfPage = () => {
6666
elementText: "percentage",
6767
});
6868

69+
cy.scrollPageToBottom();
70+
6971
clickSDKsTab();
7072

7173
cy.verifyElement({
@@ -433,31 +435,31 @@ const verifySDKVersionsDataFromTable = ({
433435
};
434436

435437
const clickSDKsTab = () => {
436-
cy.clickElement(sdkStatsPageElements.TAB_SDK_S);
438+
cy.clickElement(sdkStatsPageElements.TAB_SDK_S, true);
437439
};
438440

439441
const clickSdkVersionsTab = () => {
440-
cy.clickElement(sdkStatsPageElements.TAB_SDK_VERSIONS);
442+
cy.clickElement(sdkStatsPageElements.TAB_SDK_VERSIONS, true);
441443
};
442444

443445
const clickSdkStatsTab = () => {
444446
cy.scrollPageToTop();
445-
cy.clickElement(sdkStatsPageElements.TAB_SDK_STATS);
447+
cy.clickElement(sdkStatsPageElements.TAB_SDK_STATS, true);
446448
};
447449

448450
const clickRequestStatsTab = () => {
449451
cy.scrollPageToTop();
450-
cy.clickElement(sdkStatsPageElements.TAB_REQUEST_STATS);
452+
cy.clickElement(sdkStatsPageElements.TAB_REQUEST_STATS, true);
451453
};
452454

453455
const clickHealthCheckTab = () => {
454456
cy.scrollPageToTop();
455-
cy.clickElement(sdkStatsPageElements.TAB_HEALTH_CHECK);
457+
cy.clickElement(sdkStatsPageElements.TAB_HEALTH_CHECK, true);
456458
};
457459

458460
const clickSdkConfigurationTab = () => {
459461
cy.scrollPageToTop();
460-
cy.clickElement(sdkStatsPageElements.TAB_SDK_CONFIGURATION);
462+
cy.clickElement(sdkStatsPageElements.TAB_SDK_CONFIGURATION, true);
461463
};
462464

463465
module.exports = {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const verifyStaticElementsOfPage = () => {
5656
element: messagingMetricCardElements.ENABLED_USERS_PERCENTAGE_PROGRESS_CIRCLE,
5757
});
5858

59-
cy.clickElement(messagingPageElements.TAB_ONE_TIME_NOTIFICATIONS);
59+
cy.clickElement(messagingPageElements.TAB_ONE_TIME_NOTIFICATIONS, true);
6060

6161
cy.verifyElement({
6262
labelElement: messagingChartElements.FILTER_PARAMETERS_SELECT_LABEL,

ui-tests/cypress/support/commands.js

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,26 @@ Cypress.Commands.add("clickDataTableMoreButtonItem", (element, rowIndex = 0) =>
3838
});
3939

4040
Cypress.Commands.add("clickElement", (element, isForce = false, index = 0) => {
41-
cy.getElement(element).eq(index).click({ force: isForce });
41+
42+
if (isForce) {
43+
cy.getElement(element)
44+
.eq(index)
45+
.click({ force: true });
46+
}
47+
else {
48+
cy.getElement(element)
49+
.filter(':visible')
50+
.eq(index)
51+
.should('exist')
52+
.and('not.be.disabled')
53+
.click();
54+
}
55+
4256
cy.checkPaceRunning();
4357
});
4458

4559
Cypress.Commands.add("clickBody", () => {
46-
cy.get('body').click({ force: true });
60+
cy.get('body', { log: false }).click(0, 0);
4761
cy.checkPaceRunning();
4862
});
4963

@@ -76,7 +90,7 @@ Cypress.Commands.add("selectCheckboxOption", (element, ...options) => {
7690
});
7791

7892
Cypress.Commands.add("clickOption", (element, option) => {
79-
cy.getElement(element).contains(new RegExp("^" + option + "$", "g")).click({force: true});
93+
cy.getElement(element).contains(new RegExp("^" + option + "$", "g")).click({ force: true });
8094
});
8195

8296
Cypress.Commands.add("selectValue", (element, valueText) => {
@@ -181,18 +195,17 @@ Cypress.Commands.add("shouldUrlInclude", (url) => {
181195
cy.url().should('include', url);
182196
});
183197

184-
Cypress.Commands.add('elementExists', (selector) => {
185-
186-
cy.wait(500);
187-
if (!selector.includes('[data-test-id=') && (!selector[0].includes('.') || !selector[0].includes('#'))) {
188-
selector = `[data-test-id="${selector}"]`;
198+
Cypress.Commands.add('elementExists', (selector, { parent = 'body' } = {}) => {
199+
if (!selector.includes('[data-test-id=')) {
200+
if (!(selector.startsWith('.') || selector.startsWith('#'))) {
201+
selector = `[data-test-id="${selector}"]`;
202+
}
189203
}
190204

191-
cy
192-
.get('body')
193-
.then(($body) => {
194-
return $body.find(selector).length > 0;
195-
});
205+
return cy.get(parent, { log: false }).then($parent => {
206+
const exists = $parent.find(selector).length > 0;
207+
return exists;
208+
});
196209
});
197210

198211
Cypress.Commands.add('shouldBeExist', (element) => {
@@ -204,23 +217,20 @@ Cypress.Commands.add('shouldNotExist', (element) => {
204217
});
205218

206219
Cypress.Commands.add('checkPaceRunning', () => {
207-
cy
208-
.elementExists('.pace-running')
209-
.then((isExists) => {
210-
if (isExists) {
211-
cy.shouldNotExist('.pace-running');
212-
}
213-
});
220+
cy.get('.pace-running', { timeout: 10000 }).should('not.exist');
214221
});
215222

216223
Cypress.Commands.add('checkPaceActive', () => {
217-
cy
218-
.elementExists('.pace-active')
219-
.then((isExists) => {
220-
if (isExists) {
221-
cy.shouldNotExist('.pace-active');
222-
}
223-
});
224+
cy.get('.pace-active', { timeout: 10000 }).should('not.exist');
225+
});
226+
227+
Cypress.Commands.add('checkLoading', () => {
228+
cy.get('body').then($body => {
229+
if ($body.find('.el-loading-mask').length) {
230+
cy.get('.el-loading-mask', { timeout: 20000 })
231+
.should('not.be.visible');
232+
}
233+
});
224234
});
225235

226236
Cypress.Commands.add("scrollPageSlightly", (element = '.main-view', index = 0) => {
@@ -362,7 +372,7 @@ Cypress.Commands.add('dropMongoDatabase', () => {
362372
Cypress.Commands.add('getElement', (selector, parent = null) => {
363373

364374
if (!selector.includes('[data-test-id=')) {
365-
if (selector[0].includes('.') || selector[0].includes('#')) {
375+
if (selector.startsWith('.') || selector.startsWith('#')) {
366376
return cy.get(selector);
367377
}
368378
else {

0 commit comments

Comments
 (0)