@@ -4,14 +4,14 @@ import { IS_EE } from './config/constants';
44import { Users } from './fixtures/userStates' ;
55import { expect , test } from './utils/test' ;
66
7- const CardIds = {
8- Users : 'homepage-add- users-card ' ,
9- Chan : 'homepage-create- channels-card ' ,
10- Rooms : 'homepage-join- rooms-card ' ,
11- Mobile : 'homepage-mobile- apps-card ' ,
12- Desktop : 'homepage-desktop- apps-card ' ,
13- Docs : 'homepage-documentation-card ' ,
14- Custom : 'homepage-custom-card ' ,
7+ const CardNames = {
8+ Users : 'Add users' ,
9+ Chan : 'Create channels' ,
10+ Rooms : 'Join rooms' ,
11+ Mobile : 'Mobile apps' ,
12+ Desktop : 'Desktop apps' ,
13+ Docs : 'Documentation ' ,
14+ Custom : 'Custom content ' ,
1515} ;
1616test . use ( { storageState : Users . admin . state } ) ;
1717
@@ -38,7 +38,7 @@ test.describe.serial('homepage', () => {
3838 } ) ;
3939
4040 await test . step ( 'expect all cards to be visible' , async ( ) => {
41- await Promise . all ( Object . values ( CardIds ) . map ( ( id ) => expect ( adminPage . locator ( `[data-qa-id=" ${ id } "]` ) ) . toBeVisible ( ) ) ) ;
41+ await Promise . all ( Object . values ( CardNames ) . map ( ( name ) => expect ( adminPage . getByRole ( 'region' , { name } ) ) . toBeVisible ( ) ) ) ;
4242 } ) ;
4343 } ) ;
4444
@@ -107,7 +107,7 @@ test.describe.serial('homepage', () => {
107107 } ) ;
108108
109109 test . describe ( 'for regular users' , ( ) => {
110- const notVisibleCards = [ CardIds . Users , CardIds . Custom ] ;
110+ const notVisibleCards = [ CardNames . Users , CardNames . Custom ] ;
111111
112112 test . beforeAll ( async ( { api, browser } ) => {
113113 expect ( ( await api . post ( '/settings/Layout_Home_Body' , { value : '' } ) ) . status ( ) ) . toBe ( 200 ) ;
@@ -126,14 +126,14 @@ test.describe.serial('homepage', () => {
126126 } ) ;
127127
128128 await test . step ( `expect ${ notVisibleCards . join ( ' and ' ) } cards to not be visible` , async ( ) => {
129- await Promise . all ( notVisibleCards . map ( ( id ) => expect ( regularUserPage . locator ( `[data-qa-id=" ${ id } "]` ) ) . not . toBeVisible ( ) ) ) ;
129+ await Promise . all ( notVisibleCards . map ( ( name ) => expect ( regularUserPage . getByRole ( 'region' , { name } ) ) . not . toBeVisible ( ) ) ) ;
130130 } ) ;
131131
132132 await test . step ( 'expect all other cards to be visible' , async ( ) => {
133133 await Promise . all (
134- Object . values ( CardIds )
135- . filter ( ( id ) => ! notVisibleCards . includes ( id ) )
136- . map ( ( id ) => expect ( regularUserPage . locator ( `[data-qa-id=" ${ id } "]` ) ) . toBeVisible ( ) ) ,
134+ Object . values ( CardNames )
135+ . filter ( ( name ) => ! notVisibleCards . includes ( name ) )
136+ . map ( ( name ) => expect ( regularUserPage . getByRole ( 'region' , { name } ) ) . toBeVisible ( ) ) ,
137137 ) ;
138138 } ) ;
139139
0 commit comments