mirror of
https://github.com/coder/code-server.git
synced 2024-12-28 12:14:18 +03:00
fix(testing): reduce flakiness in extension e2e tests (#5481)
This commit is contained in:
parent
33ee184ed7
commit
8352a22e33
@ -8,12 +8,14 @@ function runTestExtensionTests() {
|
|||||||
test("should have access to VSCODE_PROXY_URI", async ({ codeServerPage }) => {
|
test("should have access to VSCODE_PROXY_URI", async ({ codeServerPage }) => {
|
||||||
const address = await getMaybeProxiedCodeServer(codeServerPage)
|
const address = await getMaybeProxiedCodeServer(codeServerPage)
|
||||||
|
|
||||||
|
await codeServerPage.waitForTestExtensionLoaded()
|
||||||
await codeServerPage.executeCommandViaMenus("code-server: Get proxy URI")
|
await codeServerPage.executeCommandViaMenus("code-server: Get proxy URI")
|
||||||
|
|
||||||
const text = await codeServerPage.page.locator(".notification-list-item-message").textContent()
|
await codeServerPage.page.waitForSelector("text=proxyUri", { timeout: 3000 })
|
||||||
|
const text = await codeServerPage.page.locator("text=proxyUri").first().textContent()
|
||||||
// Remove end slash in address
|
// Remove end slash in address
|
||||||
const normalizedAddress = address.replace(/\/+$/, "")
|
const normalizedAddress = address.replace(/\/+$/, "")
|
||||||
expect(text).toBe(`${normalizedAddress}/proxy/{{port}}`)
|
expect(text).toBe(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import * as vscode from "vscode"
|
import * as vscode from "vscode"
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
|
vscode.window.showInformationMessage("test extension loaded")
|
||||||
context.subscriptions.push(
|
context.subscriptions.push(
|
||||||
vscode.commands.registerCommand("codeServerTest.proxyUri", () => {
|
vscode.commands.registerCommand("codeServerTest.proxyUri", () => {
|
||||||
if (process.env.VSCODE_PROXY_URI) {
|
if (process.env.VSCODE_PROXY_URI) {
|
||||||
vscode.window.showInformationMessage(process.env.VSCODE_PROXY_URI)
|
vscode.window.showInformationMessage(`proxyUri: ${process.env.VSCODE_PROXY_URI}`)
|
||||||
} else {
|
} else {
|
||||||
vscode.window.showErrorMessage("No proxy URI was set")
|
vscode.window.showErrorMessage("No proxy URI was set")
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"publisher": "coder",
|
"publisher": "coder",
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"onCommand:codeServerTest.proxyUri"
|
"onStartupFinished"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.56.0"
|
"vscode": "^1.56.0"
|
||||||
|
@ -296,6 +296,16 @@ export class CodeServerPage {
|
|||||||
return visible
|
return visible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the test extension loaded
|
||||||
|
*/
|
||||||
|
async waitForTestExtensionLoaded(): Promise<void> {
|
||||||
|
const selector = "text=test extension loaded"
|
||||||
|
this.codeServer.logger.debug("Waiting for test extension to load...")
|
||||||
|
|
||||||
|
await this.page.waitForSelector(selector)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focuses the integrated terminal by navigating through the command palette.
|
* Focuses the integrated terminal by navigating through the command palette.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user