@@ -3,11 +3,6 @@ const path = require('path');
3
3
const { expect } = require ( '@playwright/test' ) ;
4
4
const fs = require ( 'fs' ) ;
5
5
6
- const ADMIN_EMAIL = 'john.doe@admin.com' ;
7
- const ADMIN_PASSWORD = 'adminPassword' ;
8
-
9
-
10
-
11
6
let headless = false , port = '8000' , url , email , pass = 'Servantes' , ignoreHTTPSErrors = false ;
12
7
process . argv . forEach ( a => {
13
8
if ( / ^ - - h e a d l e s s / . test ( a ) ) {
@@ -28,18 +23,22 @@ process.argv.forEach(a => {
28
23
if ( ! email ) {
29
24
log ( `Skipping the setup of Control center because of missing --email= parameter\n` )
30
25
return ;
26
+ } else {
27
+
31
28
}
32
29
33
30
const log = s => process . stderr . write ( ` ${ s } ` ) ;
34
31
const screenshots = "screenshots.out"
35
32
let sscount = 0 ;
36
33
async function takeScreenshot ( page , name ) {
37
- const path = `${ screenshots } /${ ++ sscount } -${ name } .png` ;
34
+ var scr = path . basename ( __filename ) ;
35
+ const file = `${ screenshots } /${ scr } -${ ++ sscount } -${ name } .png` ;
38
36
await page . waitForTimeout ( 1000 ) ;
39
- await page . screenshot ( { path } ) ;
40
- log ( `Screenshot taken: ${ path } \n` ) ;
37
+ await page . screenshot ( { path : file } ) ;
38
+ log ( `Screenshot taken: ${ file } \n` ) ;
41
39
}
42
40
41
+
43
42
( async ( ) => {
44
43
const browser = await chromium . launch ( {
45
44
headless : headless ,
@@ -73,14 +72,20 @@ async function takeScreenshot(page, name) {
73
72
await page . getByLabel ( 'Image' , { exact : true } ) . fill ( 'k8sdemos/bakery-cc:latest' )
74
73
await page . getByLabel ( 'Application URI' , { exact : true } ) . locator ( 'input[type="text"]' ) . fill ( 'app1-local.alcala.org' )
75
74
76
- await page . getByLabel ( 'Upload' ) . click ( ) ;
77
- const fileChooserPromise = page . waitForEvent ( 'filechooser' ) ;
78
- await page . getByText ( 'Browse' ) . click ( ) ;
79
- const fileChooser = await fileChooserPromise ;
80
- await fileChooser . setFiles ( 'domain.pem' ) ;
81
- fileChooserPromise . then ( await page . locator ( '.detail-layout' ) . getByRole ( 'button' , { name : 'Deploy' } ) . click ( ) )
82
- await takeScreenshot ( page , 'pem-uploaded' ) ;
83
75
76
+ const cert = [ 'alcala.org' , 'app1-local.alcala.org' ] . map ( a => `/tmp/${ a } .pem` ) . filter ( a => fs . existsSync ( a ) ) [ 0 ]
77
+ if ( cert ) {
78
+ await page . getByLabel ( 'Upload' ) . click ( ) ;
79
+ const fileChooserPromise = page . waitForEvent ( 'filechooser' ) ;
80
+ await page . getByText ( 'Browse' ) . click ( ) ;
81
+ const fileChooser = await fileChooserPromise ;
82
+ await fileChooser . setFiles ( cert ) ;
83
+ fileChooserPromise . then ( await page . locator ( '.detail-layout' ) . getByRole ( 'button' , { name : 'Deploy' } ) . click ( ) )
84
+ } else {
85
+ await page . getByLabel ( 'Generate' ) . click ( ) ;
86
+ }
87
+
88
+ await takeScreenshot ( page , 'form-filled' ) ;
84
89
await page . getByRole ( 'listitem' ) . filter ( { hasText : 'Settings' } ) . click ( )
85
90
86
91
await expect ( await page . getByRole ( 'listitem' )
0 commit comments