From 9b73bea41d636982bfee89467635c9d27dcb35a9 Mon Sep 17 00:00:00 2001 From: Rob DiVincenzo Date: Thu, 10 Oct 2024 10:55:48 -0400 Subject: [PATCH 1/5] Update the switch to include secondary staging onetrust script instead --- .../networkapi/utility/templatetags/mofo_common.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/network-api/networkapi/utility/templatetags/mofo_common.py b/network-api/networkapi/utility/templatetags/mofo_common.py index a5cc0a72e6..28dfc685dd 100644 --- a/network-api/networkapi/utility/templatetags/mofo_common.py +++ b/network-api/networkapi/utility/templatetags/mofo_common.py @@ -21,14 +21,15 @@ def onetrust_data_domain(): Get the OneTrust cookie "data-domain-script" script attribute. Data domain is taken from the data-domain-script script attribute via - OneTrust's cookie script integration. While the test / production data - domain id currently only differ by a suffix, this may change in the future + OneTrust's cookie script integration. We have two scripts & properties set up + in OneTrust. One for production (foundation.mozilla.org) and one for + dev/staging (foundation.mofostaging.net). """ - data_domain = "0191beda-31c8-76ff-9093-4055176ccf8c" + if get_app_environment() == "Production": - return data_domain + return "0191beda-31c8-76ff-9093-4055176ccf8c" else: - return data_domain + "-test" + return "0190e65a-dbec-7548-89af-4b67155ee70a-test" def get_app_environment(): From a832b49d79a0eefc6b3dd1842865bc694cfeb195 Mon Sep 17 00:00:00 2001 From: Rob DiVincenzo Date: Thu, 10 Oct 2024 12:03:37 -0400 Subject: [PATCH 2/5] Attempt force click if cookie banner is now in the way of integration test --- tests/integration/newsletter/001-default-layout.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/newsletter/001-default-layout.spec.js b/tests/integration/newsletter/001-default-layout.spec.js index 81aaf996de..ec90127f73 100644 --- a/tests/integration/newsletter/001-default-layout.spec.js +++ b/tests/integration/newsletter/001-default-layout.spec.js @@ -79,7 +79,7 @@ test.describe("Blog body newsletter signup form", () => { const requiredFields = await form.locator(`[required]`); errorMessages = form.locator(".error-message"); await submitButton.waitFor({ state: "attached" }); - await submitButton.click(); + await submitButton.click({force: true}); expect(await errorMessages.count()).toBe(await requiredFields.count()); // test if putting focus on the email field triggers the toggleable fields @@ -125,7 +125,7 @@ test.describe("Blog body newsletter signup form", () => { const apiUrl = await moduleContainer.getAttribute("data-api-url"); const fetchRequest = page.waitForRequest(apiUrl); - await submitButton.click(); + await submitButton.click({force: true}); expect(await errorMessages.count()).toBe(0); expect(await innerWrapper.getAttribute("data-submission-status")).toBe( "pending" @@ -162,7 +162,7 @@ test.describe("Blog body newsletter signup form", () => { const apiUrl = await moduleContainer.getAttribute("data-api-url"); const fetchRequest = page.waitForRequest(apiUrl); - await submitButton.click(); + await submitButton.click({force: true}); expect(await errorMessages.count()).toBe(0); expect(await innerWrapper.getAttribute("data-submission-status")).toBe( "pending" From 009526af45f30bc8fb0143cd6bbe4f2ac6be5182 Mon Sep 17 00:00:00 2001 From: Rob DiVincenzo Date: Thu, 10 Oct 2024 12:15:23 -0400 Subject: [PATCH 3/5] linting --- tests/integration/newsletter/001-default-layout.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/newsletter/001-default-layout.spec.js b/tests/integration/newsletter/001-default-layout.spec.js index ec90127f73..848dcad9c8 100644 --- a/tests/integration/newsletter/001-default-layout.spec.js +++ b/tests/integration/newsletter/001-default-layout.spec.js @@ -79,7 +79,7 @@ test.describe("Blog body newsletter signup form", () => { const requiredFields = await form.locator(`[required]`); errorMessages = form.locator(".error-message"); await submitButton.waitFor({ state: "attached" }); - await submitButton.click({force: true}); + await submitButton.click({ force: true }); expect(await errorMessages.count()).toBe(await requiredFields.count()); // test if putting focus on the email field triggers the toggleable fields @@ -125,7 +125,7 @@ test.describe("Blog body newsletter signup form", () => { const apiUrl = await moduleContainer.getAttribute("data-api-url"); const fetchRequest = page.waitForRequest(apiUrl); - await submitButton.click({force: true}); + await submitButton.click({ force: true }); expect(await errorMessages.count()).toBe(0); expect(await innerWrapper.getAttribute("data-submission-status")).toBe( "pending" @@ -162,7 +162,7 @@ test.describe("Blog body newsletter signup form", () => { const apiUrl = await moduleContainer.getAttribute("data-api-url"); const fetchRequest = page.waitForRequest(apiUrl); - await submitButton.click({force: true}); + await submitButton.click({ force: true }); expect(await errorMessages.count()).toBe(0); expect(await innerWrapper.getAttribute("data-submission-status")).toBe( "pending" From 61455953cabf58c6008506669a3fbfc66b2789b9 Mon Sep 17 00:00:00 2001 From: Rob DiVincenzo Date: Thu, 10 Oct 2024 12:58:59 -0400 Subject: [PATCH 4/5] Try to dispatch the click event rather than simulate click --- tests/integration/newsletter/001-default-layout.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/newsletter/001-default-layout.spec.js b/tests/integration/newsletter/001-default-layout.spec.js index 848dcad9c8..fa37d7ba63 100644 --- a/tests/integration/newsletter/001-default-layout.spec.js +++ b/tests/integration/newsletter/001-default-layout.spec.js @@ -79,7 +79,7 @@ test.describe("Blog body newsletter signup form", () => { const requiredFields = await form.locator(`[required]`); errorMessages = form.locator(".error-message"); await submitButton.waitFor({ state: "attached" }); - await submitButton.click({ force: true }); + await submitButton.dispatchEvent("click"); expect(await errorMessages.count()).toBe(await requiredFields.count()); // test if putting focus on the email field triggers the toggleable fields @@ -125,7 +125,7 @@ test.describe("Blog body newsletter signup form", () => { const apiUrl = await moduleContainer.getAttribute("data-api-url"); const fetchRequest = page.waitForRequest(apiUrl); - await submitButton.click({ force: true }); + await submitButton.dispatchEvent("click"); expect(await errorMessages.count()).toBe(0); expect(await innerWrapper.getAttribute("data-submission-status")).toBe( "pending" @@ -162,7 +162,7 @@ test.describe("Blog body newsletter signup form", () => { const apiUrl = await moduleContainer.getAttribute("data-api-url"); const fetchRequest = page.waitForRequest(apiUrl); - await submitButton.click({ force: true }); + await submitButton.dispatchEvent("click"); expect(await errorMessages.count()).toBe(0); expect(await innerWrapper.getAttribute("data-submission-status")).toBe( "pending" From d9c68dfaf1a898c5e7ec21e3a3aae1a589bc7028 Mon Sep 17 00:00:00 2001 From: Rob DiVincenzo Date: Thu, 10 Oct 2024 13:08:48 -0400 Subject: [PATCH 5/5] Dispatch click on petition form test --- tests/integration/petition/001-petition-form.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/petition/001-petition-form.spec.js b/tests/integration/petition/001-petition-form.spec.js index d15c7c059f..ffd2401ab2 100644 --- a/tests/integration/petition/001-petition-form.spec.js +++ b/tests/integration/petition/001-petition-form.spec.js @@ -93,7 +93,7 @@ test.describe("FormAssembly petition form", () => { // test if submitting the form without filling out the required fields creates validation errors // wait for submitButton's click event to be attached await submitButton.waitFor({ state: "attached" }); - await submitButton.click(); + await submitButton.dispatchEvent("click"); expect(await page.locator(".errFld").count()).toBe(4); expect(await page.locator(".errMsg").count()).toBe(4); @@ -101,7 +101,7 @@ test.describe("FormAssembly petition form", () => { await firstNameInput.fill("Integration"); await lastNameInput.fill("Test"); await emailInput.fill(`test-${TIMESTAMP}-${localeToTest}@example.com`); - await privacyInput.check(); + await privacyInput.dispatchEvent("click"); // Update campaign id to TEST_CAMPAIGN_ID so this test can be submitted to FormAssembly // We can't use locator because the campaign id field is hidden @@ -124,7 +124,7 @@ test.describe("FormAssembly petition form", () => { // prepare to wait for the form to submit const navigationPromise = page.waitForNavigation(); - await submitButton.click(); + await submitButton.dispatchEvent("click"); await navigationPromise; });