@@ -3477,12 +3477,7 @@ describe("CSAT survey banner", () => {
3477
3477
render (
3478
3478
< ComposedDashboard
3479
3479
elapsedTimeInDaysSinceInitialScan = { 1 }
3480
- experimentData = { {
3481
- ...defaultExperimentData ,
3482
- "automatic-removal-csat-survey" : {
3483
- enabled : true ,
3484
- } ,
3485
- } }
3480
+ enabledFeatureFlags = { [ "AutomaticRemovalCsatSurvey" ] }
3486
3481
/> ,
3487
3482
) ;
3488
3483
@@ -3501,12 +3496,7 @@ describe("CSAT survey banner", () => {
3501
3496
render (
3502
3497
< ComposedDashboard
3503
3498
elapsedTimeInDaysSinceInitialScan = { 1 }
3504
- experimentData = { {
3505
- ...defaultExperimentData ,
3506
- "automatic-removal-csat-survey" : {
3507
- enabled : true ,
3508
- } ,
3509
- } }
3499
+ enabledFeatureFlags = { [ "AutomaticRemovalCsatSurvey" ] }
3510
3500
/> ,
3511
3501
) ;
3512
3502
@@ -3528,12 +3518,7 @@ describe("CSAT survey banner", () => {
3528
3518
render (
3529
3519
< ComposedDashboard
3530
3520
elapsedTimeInDaysSinceInitialScan = { 91 }
3531
- experimentData = { {
3532
- ...defaultExperimentData ,
3533
- "automatic-removal-csat-survey" : {
3534
- enabled : true ,
3535
- } ,
3536
- } }
3521
+ enabledFeatureFlags = { [ "AutomaticRemovalCsatSurvey" ] }
3537
3522
/> ,
3538
3523
) ;
3539
3524
@@ -3555,12 +3540,7 @@ describe("CSAT survey banner", () => {
3555
3540
render (
3556
3541
< ComposedDashboard
3557
3542
elapsedTimeInDaysSinceInitialScan = { 1 }
3558
- experimentData = { {
3559
- ...defaultExperimentData ,
3560
- "automatic-removal-csat-survey" : {
3561
- enabled : true ,
3562
- } ,
3563
- } }
3543
+ enabledFeatureFlags = { [ "AutomaticRemovalCsatSurvey" ] }
3564
3544
/> ,
3565
3545
) ;
3566
3546
@@ -3587,12 +3567,7 @@ describe("CSAT survey banner", () => {
3587
3567
render (
3588
3568
< ComposedDashboard
3589
3569
elapsedTimeInDaysSinceInitialScan = { 180 }
3590
- experimentData = { {
3591
- ...defaultExperimentData ,
3592
- "automatic-removal-csat-survey" : {
3593
- enabled : true ,
3594
- } ,
3595
- } }
3570
+ enabledFeatureFlags = { [ "AutomaticRemovalCsatSurvey" ] }
3596
3571
/> ,
3597
3572
) ;
3598
3573
@@ -3620,12 +3595,7 @@ describe("CSAT survey banner", () => {
3620
3595
< ComposedDashboard
3621
3596
activeTab = "fixed"
3622
3597
elapsedTimeInDaysSinceInitialScan = { 185 }
3623
- experimentData = { {
3624
- ...defaultExperimentData ,
3625
- "automatic-removal-csat-survey" : {
3626
- enabled : true ,
3627
- } ,
3628
- } }
3598
+ enabledFeatureFlags = { [ "AutomaticRemovalCsatSurvey" ] }
3629
3599
/> ,
3630
3600
) ;
3631
3601
@@ -3684,7 +3654,10 @@ describe("CSAT survey banner", () => {
3684
3654
activeTab = "fixed"
3685
3655
elapsedTimeInDaysSinceInitialScan = { 90 }
3686
3656
hasFirstMonitoringScan
3687
- enabledFeatureFlags = { [ "LatestScanDateCsatSurvey" ] }
3657
+ enabledFeatureFlags = { [
3658
+ "LatestScanDateCsatSurvey" ,
3659
+ "AutomaticRemovalCsatSurvey" ,
3660
+ ] }
3688
3661
/> ,
3689
3662
) ;
3690
3663
@@ -3703,7 +3676,10 @@ describe("CSAT survey banner", () => {
3703
3676
activeTab = "fixed"
3704
3677
elapsedTimeInDaysSinceInitialScan = { 90 }
3705
3678
hasFirstMonitoringScan
3706
- enabledFeatureFlags = { [ "LatestScanDateCsatSurvey" ] }
3679
+ enabledFeatureFlags = { [
3680
+ "LatestScanDateCsatSurvey" ,
3681
+ "AutomaticRemovalCsatSurvey" ,
3682
+ ] }
3707
3683
/> ,
3708
3684
) ;
3709
3685
@@ -3721,6 +3697,98 @@ describe("CSAT survey banner", () => {
3721
3697
expect ( cookies . get ( "csat_survey_3-months_dismissed" ) ) . toBeDefined ( ) ;
3722
3698
expect ( cookies . get ( "last_scan_date_plus-user_dismissed" ) ) . toBeDefined ( ) ;
3723
3699
} ) ;
3700
+
3701
+ it ( "displays the petition CSAT survey for users in the control branch" , async ( ) => {
3702
+ const user = userEvent . setup ( ) ;
3703
+ const ComposedDashboard = composeStory (
3704
+ DashboardUsPremiumResolvedScanNoBreaches ,
3705
+ Meta ,
3706
+ ) ;
3707
+ render (
3708
+ < ComposedDashboard
3709
+ activeTab = "fixed"
3710
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3711
+ experimentData = { {
3712
+ ...defaultExperimentData ,
3713
+ "data-privacy-petition-banner" : {
3714
+ enabled : false ,
3715
+ } ,
3716
+ } }
3717
+ /> ,
3718
+ ) ;
3719
+
3720
+ const petitionCta = screen . queryByRole ( "link" , {
3721
+ name : "Sign petition" ,
3722
+ } ) ;
3723
+ expect ( petitionCta ) . not . toBeInTheDocument ( ) ;
3724
+
3725
+ const answerButton = screen . getByRole ( "button" , {
3726
+ name : "Neutral" ,
3727
+ } ) ;
3728
+ await user . click ( answerButton ) ;
3729
+ const cookies = new Cookies ( null , { path : "/" } ) ;
3730
+ expect ( cookies . get ( "petition_banner_plus-user_dismissed" ) ) . toBeDefined ( ) ;
3731
+ } ) ;
3732
+
3733
+ it ( "does not display the petition CSAT survey for users in the treatment branch before they interacted with the “Data privacy petition banner”" , ( ) => {
3734
+ const ComposedDashboard = composeStory (
3735
+ DashboardUsPremiumResolvedScanNoBreaches ,
3736
+ Meta ,
3737
+ ) ;
3738
+ render (
3739
+ < ComposedDashboard
3740
+ activeTab = "fixed"
3741
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3742
+ experimentData = { {
3743
+ ...defaultExperimentData ,
3744
+ "data-privacy-petition-banner" : {
3745
+ enabled : true ,
3746
+ } ,
3747
+ } }
3748
+ /> ,
3749
+ ) ;
3750
+
3751
+ const answerButton = screen . queryByRole ( "button" , {
3752
+ name : "Neutral" ,
3753
+ } ) ;
3754
+ expect ( answerButton ) . not . toBeInTheDocument ( ) ;
3755
+ } ) ;
3756
+
3757
+ it ( "displays the petition CSAT survey for users in the treatment branch after they interacted with the “Data privacy petition banner”" , async ( ) => {
3758
+ const user = userEvent . setup ( ) ;
3759
+ const ComposedDashboard = composeStory (
3760
+ DashboardUsPremiumResolvedScanNoBreaches ,
3761
+ Meta ,
3762
+ ) ;
3763
+ const ComposedDashboardComponent = ( ) => (
3764
+ < ComposedDashboard
3765
+ activeTab = "fixed"
3766
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3767
+ experimentData = { {
3768
+ ...defaultExperimentData ,
3769
+ "data-privacy-petition-banner" : {
3770
+ enabled : true ,
3771
+ } ,
3772
+ } }
3773
+ />
3774
+ ) ;
3775
+ render ( < ComposedDashboardComponent /> ) ;
3776
+
3777
+ const dismissCta = screen . getByRole ( "button" , {
3778
+ name : "No, thank you" ,
3779
+ } ) ;
3780
+ await user . click ( dismissCta ) ;
3781
+
3782
+ // The petition CSAT survey is only shown on the next visit of the dashboard
3783
+ // so that the user is not being flashed directly with a second banner after
3784
+ // interacting with the petition banner.
3785
+ render ( < ComposedDashboardComponent /> ) ;
3786
+
3787
+ const answerButton = screen . getByRole ( "button" , {
3788
+ name : "Neutral" ,
3789
+ } ) ;
3790
+ expect ( answerButton ) . toBeInTheDocument ( ) ;
3791
+ } ) ;
3724
3792
} ) ;
3725
3793
3726
3794
describe ( "Data privacy petition banner" , ( ) => {
@@ -3731,6 +3799,7 @@ describe("Data privacy petition banner", () => {
3731
3799
) ;
3732
3800
render (
3733
3801
< ComposedDashboard
3802
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3734
3803
experimentData = { {
3735
3804
...defaultExperimentData ,
3736
3805
"data-privacy-petition-banner" : {
@@ -3754,6 +3823,7 @@ describe("Data privacy petition banner", () => {
3754
3823
render (
3755
3824
< ComposedDashboard
3756
3825
activeTab = "fixed"
3826
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3757
3827
experimentData = { {
3758
3828
...defaultExperimentData ,
3759
3829
"data-privacy-petition-banner" : {
@@ -3777,6 +3847,7 @@ describe("Data privacy petition banner", () => {
3777
3847
render (
3778
3848
< ComposedDashboard
3779
3849
activeTab = "fixed"
3850
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3780
3851
experimentData = { {
3781
3852
...defaultExperimentData ,
3782
3853
"data-privacy-petition-banner" : {
@@ -3799,6 +3870,7 @@ describe("Data privacy petition banner", () => {
3799
3870
) ;
3800
3871
render (
3801
3872
< ComposedDashboard
3873
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3802
3874
experimentData = { {
3803
3875
...defaultExperimentData ,
3804
3876
"data-privacy-petition-banner" : {
@@ -3818,6 +3890,7 @@ describe("Data privacy petition banner", () => {
3818
3890
const ComposedDashboard = composeStory ( DashboardNonUsNoBreaches , Meta ) ;
3819
3891
render (
3820
3892
< ComposedDashboard
3893
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3821
3894
experimentData = { {
3822
3895
...defaultExperimentData ,
3823
3896
"data-privacy-petition-banner" : {
@@ -3852,6 +3925,7 @@ describe("Data privacy petition banner", () => {
3852
3925
render (
3853
3926
< ComposedDashboard
3854
3927
activeTab = "fixed"
3928
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3855
3929
experimentData = { {
3856
3930
...defaultExperimentData ,
3857
3931
"data-privacy-petition-banner" : {
@@ -3883,6 +3957,7 @@ describe("Data privacy petition banner", () => {
3883
3957
render (
3884
3958
< ComposedDashboard
3885
3959
activeTab = "fixed"
3960
+ enabledFeatureFlags = { [ "PetitionBannerCsatSurvey" ] }
3886
3961
experimentData = { {
3887
3962
...defaultExperimentData ,
3888
3963
"data-privacy-petition-banner" : {
0 commit comments