Skip to content

Commit

Permalink
Merge pull request #5639 from Countly/SER-1961
Browse files Browse the repository at this point in the history
[SER-1961] if the user creates a Widget with terms and condition, and edits it "Add user consent" seems is not selected.
  • Loading branch information
ArtursKadikis authored Oct 7, 2024
2 parents 4c9ffc1 + a1f1e05 commit 45ad575
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@
steps: null
};
}
if (Array.isArray(this.widget.links)) {
if (Array.isArray(this.widget.links) && this.widget.links.length) {
this.widget.links.forEach(function(link) {
if (link.linkValue.indexOf('term')) {
link.text = "Terms and Conditions";
Expand All @@ -1162,8 +1162,9 @@
link.linkValue = link.linkValue.replace(new RegExp('[?&]' + CLY_X_INT + '=[^&]*'), '').replace(/[?&]$/, '');
});
this.widget.links = {"link": this.widget.links, "finalText": this.widget.finalText};
this.widget.consent = true;
}
if (!this.widget.links) {
else {
this.widget.links = {
"link": [
{
Expand All @@ -1182,6 +1183,7 @@
"finalText": "I agree to the Terms and Conditions and Privacy Policy."

};
this.widget.consent = false;
}
if (!this.widget.rating_symbol) {
this.widget.rating_symbol = "emojis";
Expand Down
3 changes: 2 additions & 1 deletion ui-tests/cypress/e2e/dashboard/feedback/ratings/widgets.cy.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Create New Widget', () => {
navigationHelpers.goToFeedbackRatingsWidgetsPage();
});

it('Verify default values of page and create a widget with that values and then update the widget data', function() {
it.skip('Verify default values of page and create a widget with that values and then update the widget data', function() {
widgetsHelpers.clickAddNewWidgetButton();
widgetsHelpers.verifySettingsPageDefaultElements();
widgetsHelpers.typeWidgetName("My New Widget");
Expand Down Expand Up @@ -222,6 +222,7 @@ describe('Create New Widget', () => {
contactViaCheckboxLabelText: widget.contactViaCheckboxLabelText,
contactEmail: widgetRate.contactEmail,
submitButtonText: widget.submitButtonText,
hasAggrementCheckbox: true,
selectedMainColor: widget.mainColor,
selectedFontColor: widget.FontColor,
hasPoweredByLogo: true,
Expand Down
7 changes: 7 additions & 0 deletions ui-tests/cypress/lib/dashboard/feedback/ratings/demoWidgetPage.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const verifyDemoPageElementsAndRate = ({
submitButtonText,
submitButtonColor,
submitButtonFontColor,
hasAggrementCheckbox = false,
hasPoweredByLogo = true,
thankYouMessageText,
successIconColor
Expand Down Expand Up @@ -132,6 +133,12 @@ const verifyDemoPageElementsAndRate = ({
cy.shouldNotExist(demoPageElements.LOGO_IMAGE);
}

if (hasAggrementCheckbox) {
cy.contains('label', 'I agree to the terms and conditions and privacy policy')
.find('input[type="checkbox"]')
.click();
}

cy.clickElement(demoPageElements.SUBMIT_BUTTON);

// cy.window().then((win) => {
Expand Down

0 comments on commit 45ad575

Please sign in to comment.