2022-03-03 04:02:51 +08:00
|
|
|
import * as path from "path"
|
2022-08-10 02:24:37 +08:00
|
|
|
import { test as base } from "@playwright/test"
|
|
|
|
import { describe, test, expect } from "./baseFixture"
|
|
|
|
import { getMaybeProxiedCodeServer } from "../utils/helpers"
|
2022-01-05 05:02:25 +08:00
|
|
|
|
2022-02-16 05:51:42 +08:00
|
|
|
function runTestExtensionTests() {
|
2022-01-05 05:02:25 +08:00
|
|
|
// This will only work if the test extension is loaded into code-server.
|
|
|
|
test("should have access to VSCODE_PROXY_URI", async ({ codeServerPage }) => {
|
2022-08-10 02:24:37 +08:00
|
|
|
const address = await getMaybeProxiedCodeServer(codeServerPage)
|
2022-01-05 05:02:25 +08:00
|
|
|
|
|
|
|
await codeServerPage.executeCommandViaMenus("code-server: Get proxy URI")
|
|
|
|
|
2022-08-10 02:24:37 +08:00
|
|
|
const text = await codeServerPage.page.locator(".notification-list-item-message").textContent()
|
|
|
|
// Remove end slash in address
|
|
|
|
const normalizedAddress = address.replace(/\/+$/, "")
|
|
|
|
expect(text).toBe(`${normalizedAddress}/proxy/{{port}}`)
|
2022-01-05 05:02:25 +08:00
|
|
|
})
|
2022-02-16 05:51:42 +08:00
|
|
|
}
|
|
|
|
|
2022-03-03 04:02:51 +08:00
|
|
|
const flags = ["--extensions-dir", path.join(__dirname, "./extensions")]
|
|
|
|
|
2022-08-10 02:24:37 +08:00
|
|
|
describe("Extensions", flags, {}, () => {
|
2022-02-16 05:51:42 +08:00
|
|
|
runTestExtensionTests()
|
|
|
|
})
|
|
|
|
|
2022-08-10 02:24:37 +08:00
|
|
|
if (process.env.USE_PROXY !== "1") {
|
|
|
|
describe("Extensions with --cert", [...flags, "--cert"], {}, () => {
|
|
|
|
runTestExtensionTests()
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
base.describe("Extensions with --cert", () => {
|
|
|
|
base.skip("skipped because USE_PROXY is set", () => {
|
|
|
|
// Playwright will not show this without a function.
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|