@@ -7,13 +7,20 @@ describe('Username shows on comments when appropriate', () => {
77 const fileName = 'gt.redeye' ;
88 const normalizeText = ( s ) => s . replace ( / \s / g, '' ) . toLowerCase ( ) ;
99
10+ function getUserName ( ) {
11+ cy
12+ . get ( '[cy-test=user]' )
13+ . should ( 'be.visible' )
14+ . then ( ( $name ) => {
15+ user = normalizeText ( $name . text ( ) ) ;
16+ } ) ;
17+ }
18+
1019 it ( 'Username should not appear when favoriting a comment' , ( ) => {
1120 // Upload campaign and log username
1221 cy . uploadCampaign ( camp , fileName ) ;
1322
14- cy . get ( '[cy-test=user]' ) . then ( ( $name ) => {
15- user = normalizeText ( $name . text ( ) ) ;
16- } ) ;
23+ getUserName ( ) ;
1724
1825 // Open campaign, find an existing comment, and mark it as a favorite
1926 cy . selectCampaign ( camp ) ;
@@ -34,9 +41,10 @@ describe('Username shows on comments when appropriate', () => {
3441
3542 it ( 'Username should appear when comment is edited' , ( ) => {
3643 // Log username and open campaign
37- cy . get ( '[cy-test=user]' ) . then ( ( $name ) => {
38- user = normalizeText ( $name . text ( ) ) ;
39- } ) ;
44+
45+ cy . get ( '[cy-test=appTitle]' ) . should ( 'be.visible' ) ;
46+
47+ getUserName ( ) ;
4048
4149 cy . selectCampaign ( camp ) ;
4250
@@ -47,6 +55,7 @@ describe('Username shows on comments when appropriate', () => {
4755
4856 // Verify username shows in the comment box info
4957 cy . wait ( 500 ) ;
58+
5059 cy
5160 . get ( '[cy-test=comment-group]' )
5261 . eq ( 0 )
@@ -58,10 +67,10 @@ describe('Username shows on comments when appropriate', () => {
5867 } ) ;
5968
6069 it ( 'Username should appear when new comment is made' , ( ) => {
70+ cy . get ( '[cy-test=appTitle]' ) . should ( 'be.visible' ) ;
71+
6172 // Log username and open campaign
62- cy . get ( '[cy-test=user]' ) . then ( ( $name ) => {
63- user = normalizeText ( $name . text ( ) ) ;
64- } ) ;
73+ getUserName ( ) ;
6574
6675 cy . selectCampaign ( camp ) ;
6776
0 commit comments