@@ -119,7 +119,9 @@ for (const product in products) {
119119 const productUrl = products [ product ] ;
120120 const productUsers = users [ product ] ;
121121 for ( const user of productUsers ) {
122- const role = user . role ;
122+ // expected roles for users: "USER"
123+ const role = "USER" ;
124+ expect ( user . role ) . toBe ( role ) ;
123125
124126 test . describe . serial ( `Navigation Bar: ${ product } ` , ( ) => {
125127 let page = null ;
@@ -144,21 +146,47 @@ for (const product in products) {
144146 await browser . close ( ) ;
145147 } ) ;
146148
147- test ( `Options per Role in User Menu ${ role } ` , async ( ) => {
148- expect ( userMenuButtonsPerRole [ role ] ) . toBeDefined ( ) ;
149+ test ( `Check poweredByOsparc icon ` , async ( ) => {
150+ expect ( expectedElements [ product ] [ "poweredByOsparc" ] ) . toBeDefined ( ) ;
149151
150- // open user menu
151- await page . getByTestId ( "userMenuBtn" ) . click ( ) ;
152-
153- const buttons = userMenuButtonsPerRole [ role ] ;
154- for ( const buttonText in buttons ) {
155- const expected = buttons [ buttonText ] ;
156- const isVisible = await page . getByText ( buttonText ) . isVisible ( ) ;
157- expect ( isVisible ) . toEqual ( expected ) ;
152+ const isVisible = expectedElements [ product ] [ "poweredByOsparc" ] ;
153+ const button = page . getByTestId ( "poweredByOsparc" ) ;
154+ if ( isVisible ) {
155+ await expect ( button ) . toBeVisible ( ) ;
156+ } else {
157+ await expect ( button ) . toHaveCount ( 0 ) ;
158158 }
159+ } ) ;
160+
161+ test ( `Check Dashboard tabs` , async ( ) => {
162+ expect ( expectedElements [ product ] [ "studies" ] ) . toBeDefined ( ) ;
163+ expect ( expectedElements [ product ] [ "templates" ] ) . toBeDefined ( ) ;
164+ expect ( expectedElements [ product ] [ "services" ] ) . toBeDefined ( ) ;
165+ expect ( expectedElements [ product ] [ "data" ] ) . toBeDefined ( ) ;
166+
167+ const isStudiesVisible = expectedElements [ product ] [ "studies" ] [ "visible" ] ;
168+ const studiesLabel = expectedElements [ product ] [ "studies" ] [ "label" ] ;
169+ const isTemplatesVisible = expectedElements [ product ] [ "templates" ] [ "visible" ] ;
170+ const templatesLabel = expectedElements [ product ] [ "templates" ] [ "label" ] ;
171+ const isServicesVisible = expectedElements [ product ] [ "services" ] [ "visible" ] ;
172+ const servicesLabel = expectedElements [ product ] [ "services" ] [ "label" ] ;
173+ const isDataVisible = expectedElements [ product ] [ "data" ] [ "visible" ] ;
174+ const dataLabel = expectedElements [ product ] [ "data" ] [ "label" ] ;
175+
176+ const checkButton = async ( locator , isVisible , label ) => {
177+ const tabBtn = page . getByTestId ( locator ) ;
178+ if ( isVisible ) {
179+ await expect ( tabBtn ) . toBeVisible ( ) ;
180+ await expect ( tabBtn ) . toContainText ( label ) ;
181+ } else {
182+ await expect ( tabBtn ) . toHaveCount ( 0 ) ;
183+ }
184+ } ;
159185
160- // close user menu
161- await page . getByTestId ( "userMenuBtn" ) . click ( ) ;
186+ await checkButton ( "studiesTabBtn" , isStudiesVisible , studiesLabel ) ;
187+ await checkButton ( "templatesTabBtn" , isTemplatesVisible , templatesLabel ) ;
188+ await checkButton ( "servicesTabBtn" , isServicesVisible , servicesLabel ) ;
189+ await checkButton ( "dataTabBtn" , isDataVisible , dataLabel ) ;
162190 } ) ;
163191 } ) ;
164192 }
0 commit comments