Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the switch to include secondary staging onetrust script instead #12989

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions network-api/networkapi/utility/templatetags/mofo_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/newsletter/001-default-layout.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.dispatchEvent("click");
expect(await errorMessages.count()).toBe(await requiredFields.count());

// test if putting focus on the email field triggers the toggleable fields
Expand Down Expand Up @@ -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.dispatchEvent("click");
expect(await errorMessages.count()).toBe(0);
expect(await innerWrapper.getAttribute("data-submission-status")).toBe(
"pending"
Expand Down Expand Up @@ -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.dispatchEvent("click");
expect(await errorMessages.count()).toBe(0);
expect(await innerWrapper.getAttribute("data-submission-status")).toBe(
"pending"
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/petition/001-petition-form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ 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);

// test if filling out the form and submitting it eliminates the validation errors
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
Expand All @@ -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;
});

Expand Down
Loading