Skip to content

Commit 1c3559c

Browse files
authored
Merge pull request #5734 from Countly/QT-254
[QT-254] Fix rating consent fail
2 parents cadf1b8 + 73a4c1e commit 1c3559c

File tree

11 files changed

+209
-36
lines changed

11 files changed

+209
-36
lines changed

plugins/logger/frontend/public/templates/logger.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
<template v-slot="props">
4242
<cly-section>
4343
<el-tabs type="card" value="data">
44-
<el-tab-pane name="data" label="Data">
44+
<el-tab-pane name="data" label="Data" data-test-id="datatable-logs-expand-data">
4545
<vue-json-pretty :data="jsonParser(props.row.q)"/>
4646
</el-tab-pane>
47-
<el-tab-pane name="header" label="Header">
47+
<el-tab-pane name="header" label="Header" data-test-id="datatable-logs-expand-header">
4848
<vue-json-pretty :data="props.row.h"/>
4949
</el-tab-pane>
5050
</el-tabs>
@@ -54,22 +54,22 @@
5454
<el-table-column class="request-date" sortable="custom"
5555
:label="i18n('logger.requests')" vertical-align="middle" prop="reqts" min-width="283">
5656
<template slot-scope="rowScope">
57-
<logger-readable-date :timestamp="rowScope.row.reqts"></logger-readable-date>
57+
<logger-readable-date :timestamp="rowScope.row.reqts" :data-test-id="'datatable-logs-request-received-' + rowScope.$index"></logger-readable-date>
5858
</template>
5959
</el-table-column>
6060
<el-table-column sortable="custom" prop="details" :label="i18n('logger.details')" min-width="413">
6161
<template slot-scope="rowScope">
6262
<logger-details :device="rowScope.row.d" :version="rowScope.row.v" :sdk="rowScope.row.s"
63-
:location="rowScope.row.l"></logger-details>
63+
:location="rowScope.row.l" :data-test-id="'datatable-logger-details-' + rowScope.$index"></logger-details>
6464
</template>
6565
</el-table-column>
6666
<el-table-column sortable="custom" prop="info" :label="i18n('logger.info')" min-width="283">
6767
<template slot-scope="rowScope">
68-
<strong v-if="rowScope.row.c" class='red-text'>{{i18n('logger.request-canceled')}}</strong>
69-
<div v-if="rowScope.row.c" class="bu-pt-2" >{{rowScope.row.c}}</div>
70-
<logger-info :info="rowScope.row.t" :filter="loggerFilter"></logger-info>
71-
<strong v-if="rowScope.row.p" class='red-text'>{{i18n('logger.problems')}}</strong>
72-
<div v-if="rowScope.row.p" v-for="p in rowScope.row.p" class="bu-pt-2" >{{p}}</div>
68+
<strong v-if="rowScope.row.c" class='red-text' :data-test-id="'datatable-logs-information-canceled-' + rowScope.$index">{{i18n('logger.request-canceled')}}</strong>
69+
<div v-if="rowScope.row.c" class="bu-pt-2" :data-test-id="'datatable-logs-information-c-' + rowScope.$index">{{rowScope.row.c}}</div>
70+
<logger-info :info="rowScope.row.t" :filter="loggerFilter" :data-test-id="'datatable-logs-information-filter-' + rowScope.$index"></logger-info>
71+
<strong v-if="rowScope.row.p" class='red-text' :data-test-id="'datatable-logs-information-problems-' + rowScope.$index">{{i18n('logger.problems')}}</strong>
72+
<div v-if="rowScope.row.p" v-for="p in rowScope.row.p" class="bu-pt-2" :data-test-id="'datatable-logs-information-p-' + rowScope.$index">{{p}}</div>
7373
</template>
7474
</el-table-column>
7575
</template>

plugins/star-rating/frontend/public/templates/drawer.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
</div>
5353
<div v-if="drawerScope.editedObject.consent" class="ratings-drawer__consent">
5454
<label>
55-
<input type="checkbox"
55+
<input data-test-id="ratings-drawer-ratingspopup-consent-checkbox" type="checkbox"
5656
value="consent" checked
5757
>
58-
<span v-html="finalTxt(drawerScope.editedObject.links)"></span>
58+
<span v-html="finalTxt(drawerScope.editedObject.links)" data-test-id="ratings-drawer-ratingspopup-consent-text"></span>
5959
</label>
6060
</div>
6161
<div class="ratings-drawer__rp-action-area">
@@ -180,6 +180,7 @@
180180
</div>
181181
<div class="cly-vue-drawer-step__section bu-py-1 cly-vue-surveys-drawer__consent">
182182
<el-checkbox
183+
test-id="ratings-drawer-settings-add-user-consent"
183184
class="text-smallish"
184185
@change="onConsentCheckbox(drawerScope.editedObject)"
185186
size="small"
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<div class="bu-py-1 bu-px-4 cly-vue-drawer-step__section-group--filled">
22
<div class="cly-vue-drawer-step__section">
3-
<div class="text-small text-heading bu-pb-1">{{i18n('rating.drawer.consent.text')}}</div>
3+
<div class="text-small text-heading bu-pb-1" data-test-id="ratings-drawer-settings-add-user-consent-text-label">{{i18n('rating.drawer.consent.text')}}</div>
44
<validation-provider name="value.consent" rules="required|max:93" v-slot="v">
55
<el-input
6+
test-id="ratings-drawer-settings-add-user-consent-text-input"
67
:class="{'is-error': v.errors.length > 0}"
78
:placeholder="i18n('rating.drawer.consent.placeholder')"
89
v-model="value.finalText"
@@ -11,14 +12,15 @@
1112
>
1213
</el-input>
1314
</validation-provider>
14-
<div class="bu-pt-4 text-small text-heading">
15+
<div class="bu-pt-4 text-small text-heading" data-test-id="ratings-drawer-settings-add-user-consent-links-label">
1516
{{i18n('rating.drawer.consent.links')}}
16-
<cly-tooltip-icon :tooltip="i18n('rating.drawer.links.tooltip')" icon="ion-help-circled"></cly-tooltip-icon>
17+
<cly-tooltip-icon :tooltip="i18n('rating.drawer.links.tooltip')" icon="ion-help-circled" data-test-id="ratings-drawer-settings-add-user-consent-links-tooltip"></cly-tooltip-icon>
1718
</div>
1819
<div style="gap:8px" class="bu-is-flex bu-is-justify-content-space-between bu-is-align-items-center bu-py-1" :key="idx" v-for="(item, idx) in value.link">
1920
<div class="cly-vue-surveys-drawer__consent__basis-text">
2021
<validation-provider :name="item.text" rules="required" v-slot="v">
2122
<el-input
23+
:test-id="'ratings-drawer-settings-add-user-consent-links-text-input-' + idx"
2224
:class="{'is-error': v.errors.length > 0}"
2325
:placeholder=item.text
2426
v-model="item.textValue">
@@ -28,14 +30,15 @@
2830
<div class="cly-vue-surveys-drawer__consent__basis">
2931
<validation-provider name="item.link" rules="required" v-slot="v">
3032
<el-input
33+
:test-id="'ratings-drawer-settings-add-user-consent-links-link-input-' + idx"
3134
:class="{'is-error': v.errors.length > 0}"
3235
:placeholder=item.link
3336
v-model="item.linkValue">
3437
</el-input>
3538
</validation-provider>
3639
</div>
37-
<div @click="onDelete(idx)" class="cly-icon-button--gray bu-has-text-right"><i class="ion-ios-close-empty bu-is-clickable ratings-drawer__consent__close-icon"></i></div>
40+
<div @click="onDelete(idx)" class="cly-icon-button--gray bu-has-text-right" :data-test-id="'ratings-drawer-settings-add-user-consent-delete-link-icon-' + idx"><i class="ion-ios-close-empty bu-is-clickable ratings-drawer__consent__close-icon" :data-test-id="'ratings-drawer-settings-add-user-consent-delete-link-' + idx"></i></div>
3841
</div>
39-
<el-button v-if="newLinkAllowed" @click="add" type="text">{{i18n('rating.drawer.consent.add.link')}}</el-button>
42+
<el-button v-if="newLinkAllowed" @click="add" type="text" data-test-id="ratings-drawer-settings-add-user-consent-add-link-button">{{i18n('rating.drawer.consent.add.link')}}</el-button>
4043
</div>
4144
</div>

ui-tests/cypress/e2e/dashboard/feedback/ratings/widgets.cy.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ describe('Create New Widget', () => {
141141
widgetsHelpers.typeAddCommentCheckboxLabelText(widget.addCommentCheckboxLabelText);
142142
widgetsHelpers.clickContactViaCheckbox();
143143
widgetsHelpers.typeContactViaCheckboxLabelText(widget.contactViaCheckboxLabelText);
144+
widgetsHelpers.clickAddUserConsentCheckbox();
144145
widgetsHelpers.typeButtonCallOut(widget.buttonCallOut);
145146
widgetsHelpers.typeThanksMessage(widget.thanksMessage);
146147
widgetsHelpers.clickNextStepButton();
@@ -166,6 +167,8 @@ describe('Create New Widget', () => {
166167
commentCheckboxLabelText: widget.comment,
167168
isCheckedViaContact: true,
168169
viaContactCheckboxLabelText: widget.contactVia,
170+
isCheckedAddConsent: true,
171+
consentText: "I agree to the Terms and Conditions and Privacy Policy.",
169172
submitButtonText: widget.buttonCallOut,
170173
submitButtonColor: widget.mainColor,
171174
submitButtonFontColor: widget.FontColor,
@@ -285,6 +288,12 @@ describe('Create New Widget', () => {
285288
widgetsHelpers.typeAddCommentCheckboxLabelText(widget.addCommentCheckboxLabelText);
286289
widgetsHelpers.clickContactViaCheckbox();
287290
widgetsHelpers.typeContactViaCheckboxLabelText(widget.contactViaCheckboxLabelText);
291+
widgetsHelpers.clickAddUserConsentCheckbox();
292+
widgetsHelpers.typeAddUserConsentText(widget.consentText);
293+
widgetsHelpers.typeAddUserConsentLinkText(0, widget.firstConsentLinkText);
294+
widgetsHelpers.typeAddUserConsentLinkUrl(0, widget.firstConsentLinkUrl);
295+
widgetsHelpers.typeAddUserConsentLinkText(1, widget.secondConsentLinkText);
296+
widgetsHelpers.typeAddUserConsentLinkUrl(1, widget.secondConsentLinkUrl);
288297
widgetsHelpers.typeButtonCallOut(widget.buttonCallOut);
289298
widgetsHelpers.typeThanksMessage(widget.thanksMessage);
290299
widgetsHelpers.clickNextStepButton();
@@ -310,6 +319,8 @@ describe('Create New Widget', () => {
310319
commentCheckboxLabelText: widget.comment,
311320
isCheckedViaContact: true,
312321
viaContactCheckboxLabelText: widget.contactVia,
322+
isCheckedAddConsent: true,
323+
consentText: widget.consentText,
313324
submitButtonText: widget.buttonCallOut,
314325
submitButtonColor: widget.mainColor,
315326
submitButtonFontColor: widget.FontColor,
@@ -363,6 +374,7 @@ describe('Create New Widget', () => {
363374
contactViaCheckboxLabelText: widget.contactViaCheckboxLabelText,
364375
contactEmail: widgetRate.contactEmail,
365376
submitButtonText: widget.submitButtonText,
377+
consentText: widget.consentText,
366378
selectedMainColor: widget.mainColor,
367379
selectedFontColor: widget.FontColor,
368380
hasPoweredByLogo: true,
@@ -400,8 +412,7 @@ describe('Create New Widget', () => {
400412
index: 0,
401413
question: widget.question,
402414
internalName: widget.widgetName,
403-
//There is still an issue TODO
404-
//pages: "/homepage, /shopping, /checkout",
415+
pages: "/homepage, /shopping, /checkout",
405416
isActive: false
406417
});
407418
});
@@ -429,6 +440,12 @@ describe('Create New Widget', () => {
429440
widgetsHelpers.typeAddCommentCheckboxLabelText(widget.addCommentCheckboxLabelText);
430441
widgetsHelpers.clickContactViaCheckbox();
431442
widgetsHelpers.typeContactViaCheckboxLabelText(widget.contactViaCheckboxLabelText);
443+
widgetsHelpers.clickAddUserConsentCheckbox();
444+
widgetsHelpers.typeAddUserConsentText(widget.consentText);
445+
widgetsHelpers.typeAddUserConsentLinkText(0, widget.firstConsentLinkText);
446+
widgetsHelpers.typeAddUserConsentLinkUrl(0, widget.firstConsentLinkUrl);
447+
widgetsHelpers.typeAddUserConsentLinkText(1, widget.secondConsentLinkText);
448+
widgetsHelpers.typeAddUserConsentLinkUrl(1, widget.secondConsentLinkUrl);
432449
widgetsHelpers.typeButtonCallOut(widget.buttonCallOut);
433450
widgetsHelpers.clickNextStepButton();
434451

@@ -458,6 +475,17 @@ describe('Create New Widget', () => {
458475
addCommentCheckboxLabelText: widget.addCommentCheckboxLabelText,
459476
isCheckedViaContact: true,
460477
contactViaCheckboxLabelText: widget.contactViaCheckboxLabelText,
478+
consentText: widget.consentText,
479+
consentItems: [
480+
{
481+
text: widget.firstConsentLinkText,
482+
link: widget.firstConsentLinkUrl
483+
},
484+
{
485+
text: widget.secondConsentLinkText,
486+
link: widget.secondConsentLinkUrl
487+
}
488+
],
461489
submitButtonText: widget.buttonCallOut,
462490
thanksMessageText: widget.thanksMessage,
463491
});

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ const generator = () => {
1010
const emojiFiveText = faker.lorem.words({ min: 1, max: 3 });
1111
const addCommentCheckboxLabelText = faker.lorem.words({ min: 1, max: 3 });
1212
const contactViaCheckboxLabelText = faker.lorem.words({ min: 1, max: 3 });
13+
const firstConsentLinkText = faker.lorem.words({ min: 1, max: 3 });
14+
const firstConsentLinkUrl = faker.internet.url();
15+
const secondConsentLinkText = faker.lorem.words({ min: 1, max: 3 });
16+
const secondConsentLinkUrl = faker.internet.url();
17+
const consentText = faker.lorem.words({ min: 1, max: 3 }) + ' ' + firstConsentLinkText + ' and ' + secondConsentLinkText + ' ' + faker.lorem.words({ min: 1, max: 3 });
1318
const buttonCallOut = faker.lorem.words({ min: 1, max: 3 });
1419
const thanksMessage = faker.lorem.words({ min: 1, max: 3 });
1520
const mainColor = faker.color.rgb({ format: 'hex', casing: 'upper' });
@@ -27,6 +32,11 @@ const generator = () => {
2732
emojiFiveText,
2833
addCommentCheckboxLabelText,
2934
contactViaCheckboxLabelText,
35+
consentText,
36+
firstConsentLinkText,
37+
firstConsentLinkUrl,
38+
secondConsentLinkText,
39+
secondConsentLinkUrl,
3040
buttonCallOut,
3141
thanksMessage,
3242
mainColor,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,10 @@ const verifyRatingsEChartElements = ({
267267
element: ratingsEChartElements.RATING_ICON,
268268
});
269269

270-
cy.pause();
271270
cy.verifyElement({
272271
element: ratingsEChartElements.RATING,
273272
elementText: "Ratings",
274273
});
275-
cy.pause();
276274
};
277275

278276
const verifyRatingsDataFromTable = ({

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

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
feedbackRatingWidgetsPageElements,
3+
feedbackRatingWidgetAddUserConsentElements,
34
widgetsDataTableElements,
45
feedbackRatingWidgetDetailsPageElements,
56
feedbackRatingWidgetDetailsCommentsDataTableElements,
@@ -65,6 +66,9 @@ const verifySettingsPageElements = ({
6566
commentText,
6667
isCheckedViaContact,
6768
viaContactText,
69+
isCheckedAddConsent,
70+
consentText,
71+
consentItems = [],
6872
submitButtonText,
6973
thanksMessageText
7074
}) => {
@@ -73,7 +77,7 @@ const verifySettingsPageElements = ({
7377

7478
cy.verifyElement({
7579
labelElement: feedbackRatingWidgetsPageElements.WIDGET_NAME_LABEL,
76-
labelText: "surveys.drawer.internal.name",
80+
labelText: "surveys.drawer.internal.name", //TODO: Will be updated after SER-2121 fixed
7781
element: feedbackRatingWidgetsPageElements.WIDGET_NAME_INPUT,
7882
value: widgetName,
7983
elementPlaceHolder: "Widget Name"
@@ -138,6 +142,53 @@ const verifySettingsPageElements = ({
138142
value: viaContactText,
139143
});
140144
}
145+
146+
cy.verifyElement({
147+
labelElement: feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_LABEL,
148+
labelText: "surveys.drawer.consent", //TODO:Updated after SER-2121 fixed
149+
element: feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_CHECKBOX,
150+
isChecked: isCheckedAddConsent
151+
});
152+
153+
if (isCheckedAddConsent) {
154+
cy.verifyElement({
155+
labelElement: feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_TEXT_LABEL,
156+
labelText: "Text",
157+
});
158+
159+
cy.verifyElement({
160+
element: feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_TEXT_INPUT,
161+
value: consentText,
162+
});
163+
164+
cy.verifyElement({
165+
labelElement: feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_LINK_LABEL,
166+
labelText: "Link(s)",
167+
tooltipElement: feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_LINK_TOOLTIP,
168+
tooltipText: "Matching link texts inside the consent text are modified to be links",
169+
});
170+
171+
cy.verifyElement({
172+
element: feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_CONSENT_ADD_LINK_BUTTON,
173+
});
174+
175+
consentItems.forEach((consent, index) => {
176+
const consentLinkElements = feedbackRatingWidgetAddUserConsentElements(index);
177+
178+
cy.verifyElement({
179+
element: consentLinkElements.ADD_USER_CONSENT_CONSENT_LINKS_TEXT_INPUT,
180+
value: consent.text,
181+
});
182+
183+
cy.verifyElement({
184+
element: consentLinkElements.ADD_USER_CONSENT_CONSENT_LINKS_URL_INPUT,
185+
value: consent.link,
186+
});
187+
});
188+
}
189+
190+
cy.scrollPageToBottom('.cly-vue-drawer__steps-container.is-multi-step');
191+
141192
cy.verifyElement({
142193
labelElement: feedbackRatingWidgetsPageElements.BUTTON_CALLOUT_LABEL,
143194
labelText: "Button Callout",
@@ -449,6 +500,22 @@ const typeContactViaCheckboxLabelText = (email) => {
449500
cy.typeInput(feedbackRatingWidgetsPageElements.CONTACT_VIA_INPUT, email);
450501
};
451502

503+
const clickAddUserConsentCheckbox = () => {
504+
cy.clickElement(feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_CHECKBOX);
505+
};
506+
507+
const typeAddUserConsentText = (text) => {
508+
cy.typeInput(feedbackRatingWidgetAddUserConsentElements().ADD_USER_CONSENT_TEXT_INPUT, text);
509+
};
510+
511+
const typeAddUserConsentLinkText = (index, text) => {
512+
cy.typeInput(feedbackRatingWidgetAddUserConsentElements(index).ADD_USER_CONSENT_CONSENT_LINKS_TEXT_INPUT, text);
513+
};
514+
515+
const typeAddUserConsentLinkUrl = (index, link) => {
516+
cy.typeInput(feedbackRatingWidgetAddUserConsentElements(index).ADD_USER_CONSENT_CONSENT_LINKS_URL_INPUT, link);
517+
};
518+
452519
const typeButtonCallOut = (buttonText) => {
453520
cy.typeInput(feedbackRatingWidgetsPageElements.BUTTON_CALLOUT_INPUT, buttonText);
454521
};
@@ -681,6 +748,8 @@ const verifyPreviewRatingsPopUpElements = ({
681748
commentCheckboxLabelText,
682749
isCheckedViaContact,
683750
viaContactCheckboxLabelText,
751+
isCheckedAddConsent = false,
752+
consentText,
684753
submitButtonText,
685754
submitButtonColor,
686755
submitButtonFontColor,
@@ -733,6 +802,16 @@ const verifyPreviewRatingsPopUpElements = ({
733802
isChecked: isCheckedViaContact
734803
});
735804

805+
if (isCheckedAddConsent) {
806+
cy.verifyElement({
807+
labelElement: feedbackRatingWidgetsPageElements.RATINGS_POPUP_CONSENT_LABEL,
808+
labelText: consentText,
809+
element: feedbackRatingWidgetsPageElements.RATINGS_POPUP_CONSENT_CHECKBOX,
810+
attr: "checked",
811+
attrText: "checked",
812+
});
813+
}
814+
736815
cy.verifyElement({
737816
element: feedbackRatingWidgetsPageElements.RATINGS_POPUP_SUBMIT_BUTTON,
738817
elementText: submitButtonText,
@@ -1125,6 +1204,10 @@ module.exports = {
11251204
typeAddCommentCheckboxLabelText,
11261205
clickContactViaCheckbox,
11271206
typeContactViaCheckboxLabelText,
1207+
clickAddUserConsentCheckbox,
1208+
typeAddUserConsentText,
1209+
typeAddUserConsentLinkText,
1210+
typeAddUserConsentLinkUrl,
11281211
typeButtonCallOut,
11291212
typeThanksMessage,
11301213
selectRatingSymbol,

0 commit comments

Comments
 (0)