Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions test/e2e/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import { describe, test, expect } from "./baseFixture"

function runTestExtensionTests() {
// This will only work if the test extension is loaded into code-server.
// fake commit
test("should have access to VSCODE_PROXY_URI", async ({ codeServerPage }) => {
const address = await getMaybeProxiedCodeServer(codeServerPage)

await codeServerPage.waitForTestExtensionLoaded()
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
const normalizedAddress = address.replace(/\/+$/, "")
expect(text).toBe(`${normalizedAddress}/proxy/{{port}}`)
expect(text).toBe(`Info: proxyUri: ${normalizedAddress}/proxy/{{port}}`)
})
}

Expand Down
3 changes: 2 additions & 1 deletion test/e2e/extensions/test-extension/extension.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as vscode from "vscode"

export function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage("test extension loaded")
context.subscriptions.push(
vscode.commands.registerCommand("codeServerTest.proxyUri", () => {
if (process.env.VSCODE_PROXY_URI) {
vscode.window.showInformationMessage(process.env.VSCODE_PROXY_URI)
vscode.window.showInformationMessage(`proxyUri: ${process.env.VSCODE_PROXY_URI}`)
} else {
vscode.window.showErrorMessage("No proxy URI was set")
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/extensions/test-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.1",
"publisher": "coder",
"activationEvents": [
"onCommand:codeServerTest.proxyUri"
"onStartupFinished"
],
"engines": {
"vscode": "^1.56.0"
Expand Down
10 changes: 10 additions & 0 deletions test/e2e/models/CodeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ export class CodeServerPage {
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.
*
Expand Down