2022-03-02 17:26:53 +00:00
|
|
|
import { PlaywrightTestConfig } from "@playwright/test"
|
2022-04-05 14:27:41 +00:00
|
|
|
import * as path from "path"
|
2022-06-29 18:25:56 +00:00
|
|
|
import { basePort } from "./constants"
|
2022-03-02 17:26:53 +00:00
|
|
|
|
|
|
|
const config: PlaywrightTestConfig = {
|
|
|
|
testDir: "tests",
|
|
|
|
globalSetup: require.resolve("./globalSetup"),
|
|
|
|
|
|
|
|
// Create junit report file for upload to DataDog
|
|
|
|
reporter: [["junit", { outputFile: "test-results/junit.xml" }]],
|
|
|
|
|
2022-06-29 18:25:56 +00:00
|
|
|
// NOTE: if Playwright complains about the port being taken
|
|
|
|
// do not change the basePort (it must match our api server).
|
|
|
|
// Instead, simply run the test suite without running our local server.
|
2022-03-02 17:26:53 +00:00
|
|
|
use: {
|
2022-06-29 18:25:56 +00:00
|
|
|
baseURL: `http://localhost:${basePort}`,
|
2022-03-02 17:26:53 +00:00
|
|
|
video: "retain-on-failure",
|
|
|
|
},
|
|
|
|
|
|
|
|
// `webServer` tells Playwright to launch a test server - more details here:
|
|
|
|
// https://playwright.dev/docs/test-advanced#launching-a-development-web-server-during-the-tests
|
|
|
|
webServer: {
|
2022-03-08 01:50:37 +00:00
|
|
|
// Run the coder daemon directly.
|
2022-06-27 14:53:44 +00:00
|
|
|
command: `go run -tags embed ${path.join(
|
|
|
|
__dirname,
|
2022-08-17 16:02:25 +00:00
|
|
|
"../../enterprise/cmd/coder/main.go",
|
2022-10-07 13:05:56 +00:00
|
|
|
)} server --in-memory --access-url 127.0.0.1:${basePort}`,
|
2022-06-29 18:25:56 +00:00
|
|
|
port: basePort,
|
2022-03-02 17:26:53 +00:00
|
|
|
timeout: 120 * 10000,
|
|
|
|
reuseExistingServer: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
export default config
|