11import { test , expect , Page , BrowserContext } from "@support/coverage/test" ;
2+
23import RHDHDeployment from "../../utils/authentication-providers/rhdh-deployment" ;
34import { Common , setupBrowser } from "../../utils/common" ;
4- import { UIhelper } from "../../utils/ui-helper" ;
55import { NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE } from "../../utils/constants" ;
6+ import { UIhelper } from "../../utils/ui-helper" ;
67let page : Page ;
78let context : BrowserContext ;
89
@@ -133,9 +134,7 @@ test.describe("Configure Github Provider", async () => {
133134
134135 test . beforeEach ( ( ) => {
135136 test . info ( ) . setTimeout ( 600 * 1000 ) ;
136- console . log (
137- `Running test case ${ test . info ( ) . title } - Attempt #${ test . info ( ) . retry } ` ,
138- ) ;
137+ console . log ( `Running test case ${ test . info ( ) . title } - Attempt #${ test . info ( ) . retry } ` ) ;
139138 } ) ;
140139
141140 test ( "Login with Github default resolver" , async ( ) => {
@@ -178,10 +177,7 @@ test.describe("Configure Github Provider", async () => {
178177
179178 test ( "Login with Github emailMatchingUserEntityProfileEmail resolver" , async ( ) => {
180179 //A common sign-in resolver that looks up the user using the local part of their email address as the entity name.
181- await deployment . setGithubResolver (
182- "emailMatchingUserEntityProfileEmail" ,
183- false ,
184- ) ;
180+ await deployment . setGithubResolver ( "emailMatchingUserEntityProfileEmail" , false ) ;
185181 await deployment . updateAllConfigs ( ) ;
186182 await deployment . restartLocalDeployment ( ) ;
187183 await deployment . waitForConfigReconciled ( ) ;
@@ -197,18 +193,13 @@ test.describe("Configure Github Provider", async () => {
197193 ) ;
198194 expect ( login ) . toBe ( "Login successful" ) ;
199195
200- await uiHelper . verifyAlertErrorMessage (
201- NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE ,
202- ) ;
196+ await uiHelper . verifyAlertErrorMessage ( NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE ) ;
203197 await context . clearCookies ( ) ;
204198 } ) ;
205199
206200 test ( "Login with Github emailLocalPartMatchingUserEntityName resolver" , async ( ) => {
207201 //A common sign-in resolver that looks up the user using the local part of their email address as the entity name.
208- await deployment . setGithubResolver (
209- "emailLocalPartMatchingUserEntityName" ,
210- false ,
211- ) ;
202+ await deployment . setGithubResolver ( "emailLocalPartMatchingUserEntityName" , false ) ;
212203 await deployment . updateAllConfigs ( ) ;
213204 await deployment . restartLocalDeployment ( ) ;
214205 await deployment . waitForConfigReconciled ( ) ;
@@ -227,17 +218,12 @@ test.describe("Configure Github Provider", async () => {
227218
228219 expect ( login ) . toBe ( "Login successful" ) ;
229220
230- await uiHelper . verifyAlertErrorMessage (
231- NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE ,
232- ) ;
221+ await uiHelper . verifyAlertErrorMessage ( NO_USER_FOUND_IN_CATALOG_ERROR_MESSAGE ) ;
233222 await context . clearCookies ( ) ;
234223 } ) ;
235224
236225 test ( `Set Github sessionDuration and confirm in auth cookie duration has been set` , async ( ) => {
237- deployment . setAppConfigProperty (
238- "auth.providers.github.production.sessionDuration" ,
239- "3days" ,
240- ) ;
226+ deployment . setAppConfigProperty ( "auth.providers.github.production.sessionDuration" , "3days" ) ;
241227 await deployment . updateAllConfigs ( ) ;
242228 await deployment . restartLocalDeployment ( ) ;
243229 await deployment . waitForConfigReconciled ( ) ;
@@ -256,9 +242,7 @@ test.describe("Configure Github Provider", async () => {
256242 await page . reload ( ) ;
257243
258244 const cookies = await context . cookies ( ) ;
259- const authCookie = cookies . find (
260- ( cookie ) => cookie . name === "github-refresh-token" ,
261- ) ;
245+ const authCookie = cookies . find ( ( cookie ) => cookie . name === "github-refresh-token" ) ;
262246 expect ( authCookie ) . toBeDefined ( ) ;
263247
264248 // expected duration of 3 days in ms
@@ -281,35 +265,18 @@ test.describe("Configure Github Provider", async () => {
281265 test . setTimeout ( 300 * 1000 ) ;
282266
283267 await expect
284- . poll (
285- ( ) =>
286- deployment . checkUserIsIngestedInCatalog ( [
287- "RHDH QE User 1" ,
288- "RHDH QE Admin" ,
289- ] ) ,
290- { timeout : 120_000 } ,
291- )
268+ . poll ( ( ) => deployment . checkUserIsIngestedInCatalog ( [ "RHDH QE User 1" , "RHDH QE Admin" ] ) , {
269+ timeout : 120_000 ,
270+ } )
292271 . toBe ( true ) ;
293272 expect (
294- await deployment . checkGroupIsIngestedInCatalog ( [
295- "test_admins" ,
296- "test_all" ,
297- "test_users" ,
298- ] ) ,
299- ) . toBe ( true ) ;
300- expect (
301- await deployment . checkUserIsInGroup ( "rhdhqeauthadmin" , "test_admins" ) ,
302- ) . toBe ( true ) ;
303- expect (
304- await deployment . checkUserIsInGroup ( "rhdhqeauth1" , "test_users" ) ,
273+ await deployment . checkGroupIsIngestedInCatalog ( [ "test_admins" , "test_all" , "test_users" ] ) ,
305274 ) . toBe ( true ) ;
275+ expect ( await deployment . checkUserIsInGroup ( "rhdhqeauthadmin" , "test_admins" ) ) . toBe ( true ) ;
276+ expect ( await deployment . checkUserIsInGroup ( "rhdhqeauth1" , "test_users" ) ) . toBe ( true ) ;
306277
307- expect (
308- await deployment . checkGroupIsChildOfGroup ( "test_users" , "test_all" ) ,
309- ) . toBe ( true ) ;
310- expect (
311- await deployment . checkGroupIsChildOfGroup ( "test_admins" , "test_all" ) ,
312- ) . toBe ( true ) ;
278+ expect ( await deployment . checkGroupIsChildOfGroup ( "test_users" , "test_all" ) ) . toBe ( true ) ;
279+ expect ( await deployment . checkGroupIsChildOfGroup ( "test_admins" , "test_all" ) ) . toBe ( true ) ;
313280
314281 expect (
315282 await deployment . checkUserHasAnnotation (
@@ -319,11 +286,7 @@ test.describe("Configure Github Provider", async () => {
319286 ) ,
320287 ) . toBe ( true ) ;
321288 expect (
322- await deployment . checkUserHasAnnotation (
323- "rhdhqeauth1" ,
324- "MY_CUSTOM_ANNOTATION" ,
325- "rhdhqeauth1" ,
326- ) ,
289+ await deployment . checkUserHasAnnotation ( "rhdhqeauth1" , "MY_CUSTOM_ANNOTATION" , "rhdhqeauth1" ) ,
327290 ) . toBe ( true ) ;
328291 } ) ;
329292
0 commit comments