Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ca8f832

Browse files
committed
refactor: check for editor consistently in tests
1 parent 6180c2d commit ca8f832

File tree

7 files changed

+16
-37
lines changed

7 files changed

+16
-37
lines changed

‎.eslintrc.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ extends:
1515
- plugin:import/recommended
1616
- plugin:import/typescript
1717
- plugin:prettier/recommended
18-
- prettier # Removes eslint rules that conflict with prettier.
1918
# Recommended by jest-playwright
2019
# https://github.com/playwright-community/jest-playwright#globals
2120
- plugin:jest-playwright/recommended
21+
# Prettier should always be last
22+
# Removes eslint rules that conflict with prettier.
23+
- prettier
2224

2325
rules:
2426
# Sometimes you need to add args to implement a function signature even

‎test/e2e/globalSetup.test.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@ describe("globalSetup", () => {
1010
const storageState = JSON.parse(STORAGE) || {}
1111
await jestPlaywright.resetContext({
1212
storageState,
13-
logger: {
14-
isEnabled: (name, severity) => name === "browser",
15-
log: (name, severity, message, args) => console.log(`${name} ${message}`),
16-
},
1713
})
1814
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
1915
})
2016

2117
it("should keep us logged in using the storageState", async () => {
22-
// See the editor
23-
const codeServerEditor = await page.isVisible(".monaco-workbench")
24-
expect(codeServerEditor).toBeTruthy()
18+
// Make sure the editor actually loaded
19+
expect(await page.isVisible("div.monaco-workbench"))
2520
})
2621
})

‎test/e2e/login.test.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
33

44
describe("login", () => {
55
beforeEach(async () => {
6-
await jestPlaywright.resetBrowser({
7-
logger: {
8-
isEnabled: (name, severity) => name === "browser",
9-
log: (name, severity, message, args) => console.log(`${name} ${message}`),
10-
},
11-
})
6+
await jestPlaywright.resetBrowser()
127
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
138
})
149

@@ -18,8 +13,7 @@ describe("login", () => {
1813
// Click the submit button and login
1914
await page.click(".submit")
2015
await page.waitForLoadState("networkidle")
21-
// See the editor
22-
const codeServerEditor = await page.isVisible(".monaco-workbench")
23-
expect(codeServerEditor).toBeTruthy()
16+
// Make sure the editor actually loaded
17+
expect(await page.isVisible("div.monaco-workbench"))
2418
})
2519
})

‎test/e2e/logout.test.ts‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
33

44
describe("logout", () => {
55
beforeEach(async () => {
6-
await jestPlaywright.resetBrowser({
7-
logger: {
8-
isEnabled: (name, severity) => name === "browser",
9-
log: (name, severity, message, args) => console.log(`${name} ${message}`),
10-
},
11-
})
6+
await jestPlaywright.resetBrowser()
127
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
138
})
149

@@ -18,9 +13,8 @@ describe("logout", () => {
1813
// Click the submit button and login
1914
await page.click(".submit")
2015
await page.waitForLoadState("networkidle")
21-
// See the editor
22-
const codeServerEditor = await page.isVisible(".monaco-workbench")
23-
expect(codeServerEditor).toBeTruthy()
16+
// Make sure the editor actually loaded
17+
expect(await page.isVisible("div.monaco-workbench"))
2418

2519
// Click the Application menu
2620
await page.click("[aria-label='Application Menu']")

‎test/e2e/openHelpAbout.test.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ describe("Open Help > About", () => {
88
const storageState = JSON.parse(STORAGE) || {}
99
await jestPlaywright.resetContext({
1010
storageState,
11-
logger: {
12-
isEnabled: (name, severity) => name === "browser",
13-
log: (name, severity, message, args) => console.log(`${name} ${message}`),
14-
},
1511
})
1612
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
1713
})

‎test/package.json‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
"@types/node-fetch": "^2.5.8",
88
"@types/supertest": "^2.0.10",
99
"jest": "^26.6.3",
10+
"jest-playwright-preset": "^1.5.1",
1011
"jsdom": "^16.4.0",
1112
"node-fetch": "^2.6.1",
1213
"playwright": "^1.8.0",
13-
"supertest": "^6.1.1",
14-
"ts-jest": "^26.4.4"
15-
},
16-
"dependencies": {
17-
"jest-playwright-preset": "^1.5.1",
1814
"playwright-chromium": "^1.10.0",
1915
"playwright-firefox": "^1.10.0",
20-
"playwright-webkit": "^1.10.0"
16+
"playwright-webkit": "^1.10.0",
17+
"supertest": "^6.1.1",
18+
"ts-jest": "^26.4.4"
2119
}
2220
}

‎test/utils/globalSetup.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// so that it authenticates us into code-server
33
// ensuring that we're logged in before we run any tests
44
import { chromium } from "playwright"
5-
import { PASSWORD } from "./constants"
65
import { hash } from "../../src/node/util"
6+
import { PASSWORD } from "./constants"
77
import * as wtfnode from "./wtfnode"
88

99
const cookieToStore = {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /