@@ -5,23 +5,30 @@ import { setupApiCalls } from "../../api";
5
5
test ( "enabled security settings" , async ( { page } ) => {
6
6
await setupApiCalls ( page ) ;
7
7
8
+ const config = await API . getDeploymentConfig ( ) ;
9
+
8
10
await page . goto ( "/deployment/security" , { waitUntil : "domcontentloaded" } ) ;
9
11
10
- // Load deployment settings
11
- const config = await API . getDeploymentConfig ( ) ;
12
+ const flags = [
13
+ "ssh-keygen-algorithm" ,
14
+ "secure-auth-cookie" ,
15
+ "disable-owner-workspace-access" ,
12
16
13
- // Check flags
14
- await expectConfigOption ( page , config , "ssh-keygen-algorithm" ) ;
15
- await expectConfigOption ( page , config , "secure-auth-cookie" ) ;
16
- await expectConfigOption ( page , config , "disable-owner-workspace-access" ) ;
17
+ "tls-redirect-http-to-https" ,
18
+ "strict-transport-security" ,
19
+ "tls-address" ,
20
+ "tls-allow-insecure-ciphers" ,
21
+ "tls-client-auth" ,
22
+ "tls-enable" ,
23
+ "tls-min-version" ,
24
+ ] ;
17
25
18
- await expectConfigOption ( page , config , "tls-redirect-http-to-https" ) ;
19
- await expectConfigOption ( page , config , "strict-transport-security" ) ;
20
- await expectConfigOption ( page , config , "tls-address" ) ;
21
- await expectConfigOption ( page , config , "tls-allow-insecure-ciphers" ) ;
26
+ for ( const flag of flags ) {
27
+ await verifyConfigFlag ( page , config , flag ) ;
28
+ }
22
29
} ) ;
23
30
24
- const expectConfigOption = async (
31
+ const verifyConfigFlag = async (
25
32
page : Page ,
26
33
config : API . DeploymentConfig ,
27
34
flag : string ,
@@ -31,9 +38,11 @@ const expectConfigOption = async (
31
38
throw new Error ( `Option with env ${ flag } has undefined value.` ) ;
32
39
}
33
40
41
+ // Map option type to test class name.
34
42
let type = "" ,
35
43
value = opt . value ;
36
44
if ( typeof value === "boolean" ) {
45
+ // Boolean options map to string (Enabled/Disabled).
37
46
type = value ? "option-enabled" : "option-disabled" ;
38
47
value = value ? "Enabled" : "Disabled" ;
39
48
} else if ( typeof value === "number" ) {
@@ -52,7 +61,7 @@ const expectConfigOption = async (
52
61
// Special cases
53
62
if ( opt . flag === "strict-transport-security" && opt . value === 0 ) {
54
63
type = "option-value-string" ;
55
- value = "Disabled" ;
64
+ value = "Disabled" ; // Display "Disabled" instead of zero seconds.
56
65
}
57
66
58
67
const configOption = page . locator (
0 commit comments