code-server/test/playwright.config.ts
Joe Previte f178f0400b
feat(e2e): add support running behind proxy (#5348)
* docs: update maintaining

* chore(e2e): add maxFailures to playwright

* fix(ci): skip submodule in e2e job

We don't need the submodules for the e2e job. This will speed up the
checkout step.

* feat(ci): add test-e2e-proxy job

This adds a new job to CI to run our tests behind Caddy and simulate
code-server running against a reverse-proxy.

* refactor: make e2e work with reverse proxy

This refactors the e2e test in a couple ways:
- remove setting cookie in localStorage (instead we pass --auth none)
- refactor address() method to account for reverse proxy logic

* Update test/e2e/models/CodeServer.ts

* Update test/playwright.config.ts

* Update test/utils/constants.ts

Co-authored-by: Asher <ash@coder.com>

* Update test/utils/helpers.ts

Co-authored-by: Asher <ash@coder.com>

Co-authored-by: Asher <ash@coder.com>
2022-08-09 18:24:37 +00:00

42 lines
1.3 KiB
TypeScript

import { PlaywrightTestConfig } from "@playwright/test"
import path from "path"
// The default configuration runs all tests in three browsers with workers equal
// to half the available threads. See 'yarn test:e2e --help' to customize from
// the command line. For example:
// yarn test:e2e --workers 1 # Run with one worker
// yarn test:e2e --project Chromium # Only run on Chromium
// yarn test:e2e --grep login # Run tests matching "login"
const config: PlaywrightTestConfig = {
testDir: path.join(__dirname, "e2e"), // Search for tests in this directory.
timeout: 60000, // Each test is given 60 seconds.
retries: process.env.CI ? 2 : 1, // Retry in CI due to flakiness.
// Limit the number of failures on CI to save resources
maxFailures: process.env.CI ? 3 : undefined,
globalSetup: require.resolve("./utils/globalE2eSetup.ts"),
reporter: "list",
// Put any shared options on the top level.
use: {
headless: true, // Run tests in headless browsers.
video: "retain-on-failure",
},
projects: [
{
name: "Chromium",
use: { browserName: "chromium" },
},
{
name: "Firefox",
use: { browserName: "firefox" },
},
{
name: "WebKit",
use: { browserName: "webkit" },
},
],
}
export default config