@@ -15,7 +15,7 @@ describe('Privacy Settings Actions', function () {
1515 describe ( 'Privacy and Safety settings' , function ( ) {
1616 describe ( 'Mutes and Blocks settings' , function ( ) {
1717 beforeEach ( ( ) => {
18- cy . get ( '[data-cy="mutes-blocks-settings-btn"]' ) . should ( 'be.visible' ) . click ( ) ;
18+ cy . get ( '[data-cy="mutes-and- blocks-settings-btn"]' ) . should ( 'be.visible' ) . click ( ) ;
1919 cy . url ( ) . should ( 'include' , '/settings/mute-and-block' ) ; // TODO: should be /settings/privacy/mute-and-block
2020 } ) ;
2121
@@ -107,5 +107,53 @@ describe('Privacy Settings Actions', function () {
107107 } ) ;
108108 } ) ;
109109 } ) ;
110+
111+ describe ( 'Safety settings' , function ( ) {
112+ beforeEach ( ( ) => {
113+ cy . get ( '[data-cy="content-you-see-settings-btn"]' ) . should ( 'be.visible' ) . click ( ) ;
114+ cy . url ( ) . should ( 'include' , '/settings/content-you-see' ) ;
115+ // data-cy="interests-settings-btn"
116+ cy . get ( '[data-cy="interests-settings-btn"]' ) . should ( 'be.visible' ) . click ( ) ;
117+ cy . url ( ) . should ( 'include' , '/settings/interests' ) ;
118+ } ) ;
119+ it ( 'should show interest entries' , function ( ) {
120+ cy . get ( '[data-cy="interest-entry"]' ) . should ( 'have.length.greaterThan' , 0 ) ;
121+ } ) ;
122+
123+ it ( 'should toggle an interest entry' , function ( ) {
124+ cy . get ( '[data-cy="interest-entry"]' )
125+ . first ( )
126+ . within ( ( ) => {
127+ // data-state="checked"
128+ cy . get ( '[data-cy="interest-checkbox"]' ) . then ( ( $checkbox ) => {
129+ const isChecked = $checkbox . attr ( 'data-state' ) === 'checked' ;
130+ cy . get ( '[data-cy="interest-checkbox"]' ) . click ( ) ;
131+ cy . get ( '[data-cy="interest-checkbox"]' ) . should ( ( $cb ) => {
132+ const newIsChecked = $cb . attr ( 'data-state' ) === 'checked' ;
133+ expect ( newIsChecked ) . to . eq ( ! isChecked ) ;
134+ } ) ;
135+ } ) ;
136+ } ) ;
137+ } ) ;
138+ it ( 'should toggle multiple interest entries and save' , function ( ) {
139+ cy . get ( '[data-cy="interest-entry"]' ) . each ( ( $el , index ) => {
140+ if ( index < 3 ) {
141+ cy . wrap ( $el ) . within ( ( ) => {
142+ cy . get ( '[data-cy="interest-checkbox"]' ) . then ( ( $checkbox ) => {
143+ const isChecked = $checkbox . attr ( 'data-state' ) === 'checked' ;
144+ cy . get ( '[data-cy="interest-checkbox"]' ) . click ( ) ;
145+ cy . get ( '[data-cy="interest-checkbox"]' ) . should ( ( $cb ) => {
146+ const newIsChecked = $cb . attr ( 'data-state' ) === 'checked' ;
147+ expect ( newIsChecked ) . to . eq ( ! isChecked ) ;
148+ } ) ;
149+ } ) ;
150+ } ) ;
151+ }
152+ } ) ;
153+ // Click save button
154+ cy . get ( 'button[data-cy="save-interests-button"]' ) . should ( 'not.be.disabled' ) . click ( ) ;
155+ cy . get ( 'button[data-cy="save-interests-button"]' ) . should ( 'be.disabled' ) ;
156+ } ) ;
157+ } ) ;
110158 } ) ;
111159} ) ;
0 commit comments