mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-28 13:15:25 +00:00
refactor: check for editor consistently in tests
This commit is contained in:
parent
dd80eed5b0
commit
ad0f12e664
@ -15,10 +15,12 @@ extends:
|
||||
- plugin:import/recommended
|
||||
- plugin:import/typescript
|
||||
- plugin:prettier/recommended
|
||||
- prettier # Removes eslint rules that conflict with prettier.
|
||||
# Recommended by jest-playwright
|
||||
# https://github.com/playwright-community/jest-playwright#globals
|
||||
- plugin:jest-playwright/recommended
|
||||
# Prettier should always be last
|
||||
# Removes eslint rules that conflict with prettier.
|
||||
- prettier
|
||||
|
||||
rules:
|
||||
# Sometimes you need to add args to implement a function signature even
|
||||
|
@ -10,17 +10,12 @@ describe("globalSetup", () => {
|
||||
const storageState = JSON.parse(STORAGE) || {}
|
||||
await jestPlaywright.resetContext({
|
||||
storageState,
|
||||
logger: {
|
||||
isEnabled: (name, severity) => name === "browser",
|
||||
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||
},
|
||||
})
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
||||
it("should keep us logged in using the storageState", async () => {
|
||||
// See the editor
|
||||
const codeServerEditor = await page.isVisible(".monaco-workbench")
|
||||
expect(codeServerEditor).toBeTruthy()
|
||||
// Make sure the editor actually loaded
|
||||
expect(await page.isVisible("div.monaco-workbench"))
|
||||
})
|
||||
})
|
||||
|
@ -3,12 +3,7 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
|
||||
|
||||
describe("login", () => {
|
||||
beforeEach(async () => {
|
||||
await jestPlaywright.resetBrowser({
|
||||
logger: {
|
||||
isEnabled: (name, severity) => name === "browser",
|
||||
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||
},
|
||||
})
|
||||
await jestPlaywright.resetBrowser()
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
||||
@ -18,8 +13,7 @@ describe("login", () => {
|
||||
// Click the submit button and login
|
||||
await page.click(".submit")
|
||||
await page.waitForLoadState("networkidle")
|
||||
// See the editor
|
||||
const codeServerEditor = await page.isVisible(".monaco-workbench")
|
||||
expect(codeServerEditor).toBeTruthy()
|
||||
// Make sure the editor actually loaded
|
||||
expect(await page.isVisible("div.monaco-workbench"))
|
||||
})
|
||||
})
|
||||
|
@ -3,12 +3,7 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
|
||||
|
||||
describe("logout", () => {
|
||||
beforeEach(async () => {
|
||||
await jestPlaywright.resetBrowser({
|
||||
logger: {
|
||||
isEnabled: (name, severity) => name === "browser",
|
||||
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||
},
|
||||
})
|
||||
await jestPlaywright.resetBrowser()
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
||||
@ -18,9 +13,8 @@ describe("logout", () => {
|
||||
// Click the submit button and login
|
||||
await page.click(".submit")
|
||||
await page.waitForLoadState("networkidle")
|
||||
// See the editor
|
||||
const codeServerEditor = await page.isVisible(".monaco-workbench")
|
||||
expect(codeServerEditor).toBeTruthy()
|
||||
// Make sure the editor actually loaded
|
||||
expect(await page.isVisible("div.monaco-workbench"))
|
||||
|
||||
// Click the Application menu
|
||||
await page.click("[aria-label='Application Menu']")
|
||||
|
@ -8,10 +8,6 @@ describe("Open Help > About", () => {
|
||||
const storageState = JSON.parse(STORAGE) || {}
|
||||
await jestPlaywright.resetContext({
|
||||
storageState,
|
||||
logger: {
|
||||
isEnabled: (name, severity) => name === "browser",
|
||||
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||
},
|
||||
})
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
@ -7,16 +7,14 @@
|
||||
"@types/node-fetch": "^2.5.8",
|
||||
"@types/supertest": "^2.0.10",
|
||||
"jest": "^26.6.3",
|
||||
"jest-playwright-preset": "^1.5.1",
|
||||
"jsdom": "^16.4.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"playwright": "^1.8.0",
|
||||
"supertest": "^6.1.1",
|
||||
"ts-jest": "^26.4.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"jest-playwright-preset": "^1.5.1",
|
||||
"playwright-chromium": "^1.10.0",
|
||||
"playwright-firefox": "^1.10.0",
|
||||
"playwright-webkit": "^1.10.0"
|
||||
"playwright-webkit": "^1.10.0",
|
||||
"supertest": "^6.1.1",
|
||||
"ts-jest": "^26.4.4"
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
// so that it authenticates us into code-server
|
||||
// ensuring that we're logged in before we run any tests
|
||||
import { chromium } from "playwright"
|
||||
import { PASSWORD } from "./constants"
|
||||
import { hash } from "../../src/node/util"
|
||||
import { PASSWORD } from "./constants"
|
||||
import * as wtfnode from "./wtfnode"
|
||||
|
||||
const cookieToStore = {
|
||||
|
Loading…
Reference in New Issue
Block a user