-
Notifications
You must be signed in to change notification settings - Fork 6k
feat(e2e): add support running behind proxy #5348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d64f197
docs: update maintaining
jsjoeio 2a89832
chore(e2e): add maxFailures to playwright
jsjoeio 64f39e2
fix(ci): skip submodule in e2e job
jsjoeio d9d7a5e
feat(ci): add test-e2e-proxy job
jsjoeio 070a328
refactor: make e2e work with reverse proxy
jsjoeio a784f2d
Update test/e2e/models/CodeServer.ts
jsjoeio bbf0c47
Update test/playwright.config.ts
jsjoeio fe7a276
Update test/utils/constants.ts
jsjoeio f20d2af
Update test/utils/helpers.ts
jsjoeio 4d207b6
Merge branch 'main' into jsjoeio/proxy-e2e
jsjoeio 06b91df
fixup: formatting
jsjoeio dff6a4c
Merge branch 'main' into jsjoeio/proxy-e2e
jsjoeio 7f9a9b0
Update test/utils/helpers.ts
jsjoeio b991350
Merge branch 'main' into jsjoeio/proxy-e2e
jsjoeio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
admin localhost:4444 | ||
} | ||
:8000 { | ||
@portLocalhost path_regexp port ^/([0-9]+)\/ide | ||
handle @portLocalhost { | ||
uri strip_prefix {re.port.1}/ide | ||
reverse_proxy localhost:{re.port.1} | ||
} | ||
|
||
handle { | ||
respond "Bad hostname" 400 | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
import * as path from "path" | ||
import { describe, test } from "./baseFixture" | ||
import { test as base } from "@playwright/test" | ||
import { describe, test, expect } from "./baseFixture" | ||
import { getMaybeProxiedCodeServer } from "../utils/helpers" | ||
|
||
function runTestExtensionTests() { | ||
// This will only work if the test extension is loaded into code-server. | ||
test("should have access to VSCODE_PROXY_URI", async ({ codeServerPage }) => { | ||
const address = await codeServerPage.address() | ||
const address = await getMaybeProxiedCodeServer(codeServerPage) | ||
|
||
await codeServerPage.executeCommandViaMenus("code-server: Get proxy URI") | ||
|
||
await codeServerPage.page.waitForSelector(`text=${address}/proxy/{{port}}`) | ||
const text = await codeServerPage.page.locator(".notification-list-item-message").textContent() | ||
// Remove end slash in address | ||
const normalizedAddress = address.replace(/\/+$/, "") | ||
expect(text).toBe(`${normalizedAddress}/proxy/{{port}}`) | ||
}) | ||
} | ||
|
||
const flags = ["--extensions-dir", path.join(__dirname, "./extensions")] | ||
|
||
describe("Extensions", true, flags, {}, () => { | ||
describe("Extensions", flags, {}, () => { | ||
runTestExtensionTests() | ||
}) | ||
|
||
describe("Extensions with --cert", true, [...flags, "--cert"], {}, () => { | ||
runTestExtensionTests() | ||
}) | ||
if (process.env.USE_PROXY !== "1") { | ||
describe("Extensions with --cert", [...flags, "--cert"], {}, () => { | ||
runTestExtensionTests() | ||
}) | ||
} else { | ||
base.describe("Extensions with --cert", () => { | ||
base.skip("skipped because USE_PROXY is set", () => { | ||
// Playwright will not show this without a function. | ||
}) | ||
}) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.