Skip to content

Commit 689fc17

Browse files
committed
refactor: allow codeServerArgs in e2e tests
1 parent 2a662dc commit 689fc17

8 files changed

+12
-9
lines changed

test/e2e/baseFixture.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { CodeServer, CodeServerPage } from "./models/CodeServer"
99
*
1010
* If `includeCredentials` is `true` page requests will be authenticated.
1111
*/
12-
export const describe = (name: string, includeCredentials: boolean, fn: (codeServer: CodeServer) => void) => {
12+
export const describe = (name: string, includeCredentials: boolean, codeServerArgs: string[], fn: (codeServer: CodeServer) => void) => {
1313
test.describe(name, () => {
1414
// This will spawn on demand so nothing is necessary on before.
15-
const codeServer = new CodeServer(name)
15+
const codeServer = new CodeServer(name, codeServerArgs)
1616

1717
// Kill code-server after the suite has ended. This may happen even without
1818
// doing it explicitly but it seems prudent to be sure.
@@ -36,6 +36,8 @@ export const describe = (name: string, includeCredentials: boolean, fn: (codeSer
3636
authenticated: includeCredentials,
3737
// This provides a cookie that authenticates with code-server.
3838
storageState: includeCredentials ? storageState : {},
39+
// TODO@jsjoeio add note why we do this for testing cert stuff
40+
ignoreHTTPSErrors: true
3941
})
4042

4143
fn(codeServer)

test/e2e/codeServer.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, test, expect } from "./baseFixture"
22

3-
describe("CodeServer", true, () => {
3+
describe("CodeServer", true, [], () => {
44
test("should navigate to home page", async ({ codeServerPage }) => {
55
// We navigate codeServer before each test
66
// and we start the test with a storage state

test/e2e/globalSetup.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, test, expect } from "./baseFixture"
22

33
// This test is to make sure the globalSetup works as expected
44
// meaning globalSetup ran and stored the storageState
5-
describe("globalSetup", true, () => {
5+
describe("globalSetup", true, [], () => {
66
test("should keep us logged in using the storageState", async ({ codeServerPage }) => {
77
// Make sure the editor actually loaded
88
expect(await codeServerPage.isEditorVisible()).toBe(true)

test/e2e/login.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { PASSWORD } from "../utils/constants"
22
import { describe, test, expect } from "./baseFixture"
33

4-
describe("login", false, () => {
4+
describe("login", false, [], () => {
55
test("should see the login page", async ({ codeServerPage }) => {
66
// It should send us to the login page
77
expect(await codeServerPage.page.title()).toBe("code-server login")

test/e2e/logout.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// NOTE@jsjoeio commenting out until we can figure out what's wrong
22
// import { describe, test, expect } from "./baseFixture"
33

4-
// describe("logout", true, () => {
4+
// describe("logout", true, [], () => {
55
// test("should be able logout", async ({ codeServerPage }) => {
66
// // Recommended by Playwright for async navigation
77
// // https://github.com/microsoft/playwright/issues/1987#issuecomment-620182151

test/e2e/models/CodeServer.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class CodeServer {
3131
public readonly logger: Logger
3232
private closed = false
3333

34-
constructor(name: string) {
34+
constructor(name: string, private codeServerArgs: string[]) {
3535
this.logger = logger.named(name)
3636
}
3737

@@ -78,6 +78,7 @@ export class CodeServer {
7878
"node",
7979
[
8080
process.env.CODE_SERVER_TEST_ENTRY || ".",
81+
...this.codeServerArgs,
8182
// Using port zero will spawn on a random port.
8283
"--bind-addr",
8384
"127.0.0.1:0",

test/e2e/openHelpAbout.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, test, expect } from "./baseFixture"
22

3-
describe("Open Help > About", true, () => {
3+
describe("Open Help > About", true, [], () => {
44
test("should see code-server version in about dialog", async ({ codeServerPage }) => {
55
// Open using the menu.
66
await codeServerPage.navigateMenus(["Help", "About"])

test/e2e/terminal.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import util from "util"
44
import { clean, tmpdir } from "../utils/helpers"
55
import { describe, expect, test } from "./baseFixture"
66

7-
describe("Integrated Terminal", true, () => {
7+
describe("Integrated Terminal", true, [], () => {
88
const testName = "integrated-terminal"
99
test.beforeAll(async () => {
1010
await clean(testName)

0 commit comments

Comments
 (0)