Skip to content

Commit

Permalink
Merge pull request #4928 from mozilla/mntor-3486
Browse files Browse the repository at this point in the history
Show petition banner experiment CSAT only US users
  • Loading branch information
flozia authored Aug 19, 2024
2 parents dd8c552 + a5b71bd commit 49748f4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3699,7 +3699,7 @@ describe("CSAT survey banner", () => {
expect(cookies.get("last_scan_date_plus-user_dismissed")).toBeDefined();
});

it("displays the petition CSAT survey for users in the control branch", async () => {
it("displays the petition CSAT survey for US users on the control branch", async () => {
const user = userEvent.setup();
const ComposedDashboard = composeStory(
DashboardUsPremiumResolvedScanNoBreaches,
Expand Down Expand Up @@ -3731,7 +3731,28 @@ describe("CSAT survey banner", () => {
expect(cookies.get("petition_banner_plus-user_dismissed")).toBeDefined();
});

it("does not display the petition CSAT survey for users in the treatment branch before they interacted with the “Data privacy petition banner”", () => {
it("does not display the petition CSAT survey for non-US users on the control branch", () => {
const ComposedDashboard = composeStory(DashboardNonUsNoBreaches, Meta);
render(
<ComposedDashboard
activeTab="action-needed"
enabledFeatureFlags={["PetitionBannerCsatSurvey"]}
experimentData={{
...defaultExperimentData,
"data-privacy-petition-banner": {
enabled: false,
},
}}
/>,
);

const answerButton = screen.queryByRole("button", {
name: "Neutral",
});
expect(answerButton).not.toBeInTheDocument();
});

it("does not display the petition CSAT survey for users on the treatment branch before they interacted with the “Data privacy petition banner”", () => {
const ComposedDashboard = composeStory(
DashboardUsPremiumResolvedScanNoBreaches,
Meta,
Expand All @@ -3755,7 +3776,7 @@ describe("CSAT survey banner", () => {
expect(answerButton).not.toBeInTheDocument();
});

it("displays the petition CSAT survey for users in the treatment branch after they clicked “No, thank you”", async () => {
it("displays the petition CSAT survey for users on the treatment branch after they clicked “No, thank you”", async () => {
const user = userEvent.setup();
const ComposedDashboard = composeStory(
DashboardUsPremiumResolvedScanNoBreaches,
Expand Down Expand Up @@ -3786,7 +3807,7 @@ describe("CSAT survey banner", () => {
expect(answerButton).toBeInTheDocument();
});

it("displays the petition CSAT survey for users in the treatment branch after they clicked “Sign petition”", async () => {
it("displays the petition CSAT survey for users on the treatment branch after they clicked “Sign petition”", async () => {
const user = userEvent.setup();
const ComposedDashboard = composeStory(
DashboardUsPremiumResolvedScanNoBreaches,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ export const View = (props: Props) => {
lastScanDate={props.userScanData.scan?.created_at ?? null}
signInCount={props.signInCount}
localDismissalPetitionBanner={localDismissalPetitionBanner}
isEligibleForPremium={props.isEligibleForPremium}
/>
<div className={styles.dashboardContent}>
<DashboardTopBanner
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/client/csat_survey/CsatSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type CsatSurveyProps = {
lastScanDate: Date | null;
signInCount: number | null;
localDismissalPetitionBanner: DismissalData;
isEligibleForPremium: boolean;
};

export const CsatSurvey = (props: CsatSurveyProps) => {
Expand Down Expand Up @@ -57,6 +58,7 @@ export const CsatSurvey = (props: CsatSurveyProps) => {
lastScanDate: props.lastScanDate,
}),
props.enabledFeatureFlags.includes("PetitionBannerCsatSurvey") &&
props.isEligibleForPremium &&
getPetitionBannerCsatSurvey(surveyOptions),
];

Expand Down

0 comments on commit 49748f4

Please sign in to comment.