Skip to content

Commit 3cc9a08

Browse files
committed
Done
1 parent c65bb92 commit 3cc9a08

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

site/e2e/playwright.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default defineConfig({
3232
timeout: 50_000,
3333
},
3434
],
35-
//reporter: [["./reporter.ts"]],
35+
reporter: [["./reporter.ts"]],
3636
use: {
3737
baseURL: `http://localhost:${coderPort}`,
3838
video: "retain-on-failure",

site/e2e/tests/deployment/security.spec.ts

+21-12
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,30 @@ import { setupApiCalls } from "../../api";
55
test("enabled security settings", async ({ page }) => {
66
await setupApiCalls(page);
77

8+
const config = await API.getDeploymentConfig();
9+
810
await page.goto("/deployment/security", { waitUntil: "domcontentloaded" });
911

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",
1216

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+
];
1725

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+
}
2229
});
2330

24-
const expectConfigOption = async (
31+
const verifyConfigFlag = async (
2532
page: Page,
2633
config: API.DeploymentConfig,
2734
flag: string,
@@ -31,9 +38,11 @@ const expectConfigOption = async (
3138
throw new Error(`Option with env ${flag} has undefined value.`);
3239
}
3340

41+
// Map option type to test class name.
3442
let type = "",
3543
value = opt.value;
3644
if (typeof value === "boolean") {
45+
// Boolean options map to string (Enabled/Disabled).
3746
type = value ? "option-enabled" : "option-disabled";
3847
value = value ? "Enabled" : "Disabled";
3948
} else if (typeof value === "number") {
@@ -52,7 +61,7 @@ const expectConfigOption = async (
5261
// Special cases
5362
if (opt.flag === "strict-transport-security" && opt.value === 0) {
5463
type = "option-value-string";
55-
value = "Disabled";
64+
value = "Disabled"; // Display "Disabled" instead of zero seconds.
5665
}
5766

5867
const configOption = page.locator(

0 commit comments

Comments
 (0)