ripe-traffic-15039
12/21/2022, 12:56 PMimport Warehouse from "../../../pagesObjects/customerDataPlatform/warehouse.cy";
const warehouse = new Warehouse();
describe("Regression Tests CDP GDPR", () => {
var completeDate = 0
var constants = ""
beforeEach(() => {
cy.viewport(Cypress.env("viewportWidth"), Cypress.env("viewportHeight"));
cy.login()
cy.getPlatformLanguageConstants().then(value => constants = value);
})
it('CDP-4071 GDPR - Consent Version. Edit Terms and Conditions', () => {
cy.getCodeTime().then(value => completeDate = value);
cy.visitUrl(Cypress.env('urls').cdp.complianceVersions.link)
cy.then(() => {
cy.textArea_TypeAndSave(warehouse.editableTermsConditions(),completeDate,warehouse.btnSaveTermsConditions())
});
cy.clickModalConfirmation()
cy.wait(1000)
cy.checkModal(constants.cdp.gdprModalTermsConditionsTitle,constants.cdp.gdprModalTermsConditions)
cy.visitUrl(Cypress.env('urls').cdp.complianceVersions.link)
cy.then(() => {
cy.checkText(warehouse.editableTermsConditions(),completeDate)
})
});
it('CDP-4072 GDPR - Consent Version. Edit Personalized communications', () => {
cy.getCodeTime().then(value => completeDate = value);
cy.visitUrl(Cypress.env('urls').cdp.complianceVersions.link)
cy.then(() => {
cy.textArea_TypeAndSave(warehouse.editablePersonalizedCommunications(),completeDate,warehouse.btnSaveConsent())
});
cy.clickModalConfirmation()
cy.wait(1000)
cy.checkModal(constants.cdp.gdprModalTermsConditionsTitle,constants.cdp.gdprModalTermsConditions)
cy.visitUrl(Cypress.env('urls').cdp.complianceVersions.link)
cy.checkText(warehouse.editablePersonalizedCommunications(),completeDate)
});
});
fresh-doctor-14925
12/21/2022, 1:02 PMCypress.env('urls')
in your cy.visitUrl()
if you've set your baseUrl correctly
(Also, why did you need to make a method for this? Looks like cy.visit()
should be enough)fresh-doctor-14925
12/21/2022, 1:03 PMcy.then()
after your visitUrl commands. Cypress should handle the chaining under the hoodfresh-doctor-14925
12/21/2022, 1:05 PMcheckText
and checkModal
). I think it's easier for others to understand if you can see the assertions in the spec itself.
But that's personal preferenceripe-traffic-15039
12/21/2022, 1:10 PMripe-traffic-15039
12/21/2022, 1:11 PMripe-traffic-15039
12/21/2022, 1:13 PMfresh-doctor-14925
12/21/2022, 1:15 PMcy.then()
. You can place all of your commands in the first then()
cy.getCodeTime().then(value => { completeDate = value;
cy.visitUrl(Cypress.env('urls').cdp.complianceVersions.link);
...
})
ripe-traffic-15039
12/21/2022, 1:18 PMfresh-doctor-14925
12/21/2022, 1:20 PMCypress.config('baseUrl', url)
. but docs can confirm thatgray-kilobyte-89541
12/21/2022, 3:01 PM.then
callbacks and local closure variables if you aliases set in beforeEach
. Can I write a blog post using your posted code?ripe-traffic-15039
12/21/2022, 3:25 PMripe-traffic-15039
12/21/2022, 3:26 PMlemon-holiday-89994
12/21/2022, 7:06 PMlemon-holiday-89994
12/21/2022, 7:07 PM