@@ -64,30 +64,31 @@ describe("SegmentSelectorEditorTest", function () {
6464 } ) ;
6565
6666 it ( "should star all segments" , async function ( ) {
67- await page . click ( '.segmentList li:nth-child(2) .starSegment' ) ;
68- await page . click ( '.segmentList li:nth-child(3) .starSegment' ) ;
69- await page . click ( '.segmentList li:nth-child(4) .starSegment' ) ;
70- const firstSegment = await page . $ ( '.segmentList li:nth-child(2)' ) ;
71- expect ( firstSegment . className ) . to . contain ( 'segmentStarred' ) ;
72- expect ( firstSegment . find ( '.starSegment' ) . attr ( 'data-state' ) ) . to . equal ( '' ) ;
67+ const firstSegment = await page . $ ( '.segmentList li:nth-of-type(2)' ) ;
68+ const firstSegmentStar = await page . $ ( '.segmentList li:nth-of-type(2) .starSegment' ) ;
69+ await firstSegmentStar . click ( '.segmentList li:nth-of-type(2) .starSegment' ) ;
70+ await page . click ( '.segmentList li:nth-of-type(3) .starSegment' ) ;
71+ await page . click ( '.segmentList li:nth-of-type(4) .starSegment' ) ;
72+ expect ( firstSegment . attr ( 'class' ) ) . to . match ( / s e g m e n t S t a r r e d / ) ;
73+ expect ( firstSegmentStar . attr ( 'data-state' ) ) . to . equal ( '' ) ;
7374 expect ( await page . screenshotSelector ( selectorsToCapture ) ) . to . matchImage ( '1_selector_starred' ) ;
7475 } ) ;
7576
7677 it ( "should unstar first segment" , async function ( ) {
77- await page . click ( '.segmentList li:nth-child(2) .starSegment' ) ;
78- const firstSegment = await page . $ ( '.segmentList li:nth-child(2)' ) ;
79- expect ( firstSegment . className ) . to . not . contain ( 'segmentStarred' ) ;
80- expect ( firstSegment . find ( '.starSegment' ) . attr ( 'data-state' ) ) . to . equal ( '' ) ;
78+ const firstSegment = await page . $ ( '.segmentList li:nth-of-type(2)' ) ;
79+ const firstSegmentStar = await page . $ ( '.segmentList li:nth-of-type(2) .starSegment' ) ;
80+ await firstSegmentStar . click ( '.segmentList li:nth-of-type(2) .starSegment' ) ;
81+ expect ( firstSegment . attr ( 'class' ) ) . to . not . match ( / s e g m e n t S t a r r e d / ) ;
82+ expect ( firstSegmentStar . attr ( 'data-state' ) ) . to . equal ( '' ) ;
8183 expect ( await page . screenshotSelector ( selectorsToCapture ) ) . to . matchImage ( '1b_selector_unstarred' ) ;
8284 } ) ;
8385
8486 it ( "should have disabled star for anonymous users" , async function ( ) {
8587 await switchToAnonymousUser ( ) ;
8688 await page . goto ( url ) ;
8789 await page . click ( '.segmentationContainer .title' ) ;
88- const firstSegment = await page . $ ( '.segmentList li:nth-child(2)' ) ;
89- expect ( firstSegment . className ) . to . contain ( 'segmentStarred' ) ;
90- expect ( firstSegment . find ( '.starSegment' ) . attr ( 'data-state' ) ) . to . equal ( '' ) ;
90+ const firstSegmentStar = await page . $ ( '.segmentList li:nth-of-type(2) .starSegment' ) ;
91+ expect ( firstSegmentStar . attr ( 'data-state' ) ) . to . equal ( 'disabled' ) ;
9192 } ) ;
9293
9394 it ( "should open segment editor when edit link clicked for existing segment" , async function ( ) {
0 commit comments