1+ /* eslint-disable no-undef */
2+ describe ( 'Unsubscribe form' , ( ) => {
3+ let shortcodePostURL ;
4+ let blockPostPostURL ;
5+
6+ before ( ( ) => {
7+ // TODO: Initialize tests from a blank state
8+ // TODO: Wipe WP data related to a users options
9+ // TODO: Delete all contacts in a users Mailchimp account
10+ // TODO: Ensure the default audience list is "10up"
11+ // TODO: Include all merge fields as "Visible" in the users Mailchimp account
12+
13+ // Load the post URLs from the JSON file
14+ cy . fixture ( 'postUrls.json' ) . then ( ( urls ) => {
15+ shortcodePostURL = urls . shortcodePostURL ;
16+ blockPostPostURL = urls . blockPostPostURL ;
17+ } ) ;
18+
19+ cy . login ( ) ; // WP
20+ cy . mailchimpLoginIfNotAlreadyLoggedIn ( ) ;
21+
22+ // Check unsubscription link
23+ cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
24+ cy . get ( '#mc_use_unsub_link' ) . check ( ) ;
25+ cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
26+ } ) ;
27+
28+ after ( ( ) => {
29+ // Uncheck unsubscription link
30+ cy . visit ( '/wp-admin/admin.php?page=mailchimp_sf_options' ) ;
31+ cy . get ( '#mc_use_unsub_link' ) . uncheck ( ) ;
32+ cy . get ( 'input[value="Update Subscribe Form Settings"]' ) . first ( ) . click ( ) ;
33+ } )
34+
35+ it ( 'unsubscribes valid emails that were previously subscribed to a list' , ( ) => {
36+ // Visit the mailchimp block page
37+ // Subscribe to email (to be a valid unsubscriber)
38+ // Assert unsubscribe link exists
39+ // Visit unsubscribe link
40+ // Unsubscribe
41+ // Select a reason
42+ // Navigate back to the website (this is a bug, it's broken currently)
43+ } ) ;
44+
45+ it ( 'throws an error when unsubscribing an email that was never subscribed to a list' , ( ) => {
46+ // Visit the mailchimp block page
47+ // Assert unsubscribe link exists
48+ // Visit unsubscribe link
49+ // Unsubscribe
50+ // Assert that the unsubscribe didn't work because the email isn't subscribed
51+ } ) ;
52+ } ) ;
0 commit comments