mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
Make testing more reliable
- Stop any running containers - Start dev server from playwright so that we don't keep spawning new node instances
This commit is contained in:
parent
3ee26e14d7
commit
097d2296e0
@ -19,7 +19,7 @@
|
|||||||
"build": "vite build && ./scripts/cleanup.sh",
|
"build": "vite build && ./scripts/cleanup.sh",
|
||||||
"build:sdk": "./scripts/sdk/build.sh",
|
"build:sdk": "./scripts/sdk/build.sh",
|
||||||
"watch:sdk": "./scripts/sdk/build.sh && yarn run vite build -c vite.sdk-lib-config.js --watch",
|
"watch:sdk": "./scripts/sdk/build.sh && yarn run vite build -c vite.sdk-lib-config.js --watch",
|
||||||
"test:app": "vite --port 3000 & playwright test"
|
"test:app": "./scripts/test-app.sh"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
import type { PlaywrightTestConfig } from '@playwright/test';
|
import type { PlaywrightTestConfig } from "@playwright/test";
|
||||||
|
|
||||||
const BASE_URL = process.env["BASE_URL"] ?? "http://127.0.0.1:3000";
|
const BASE_URL = process.env["BASE_URL"] ?? "http://127.0.0.1:3000";
|
||||||
|
|
||||||
const config: PlaywrightTestConfig = {
|
const config: PlaywrightTestConfig = {
|
||||||
use: {
|
use: {
|
||||||
headless: false,
|
headless: false,
|
||||||
viewport: { width: 1280, height: 720 },
|
viewport: { width: 1280, height: 720 },
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
video: 'on-first-retry',
|
video: "on-first-retry",
|
||||||
baseURL: BASE_URL,
|
baseURL: BASE_URL,
|
||||||
},
|
},
|
||||||
testDir: "./playwright/tests",
|
testDir: "./playwright/tests",
|
||||||
globalSetup: require.resolve("./playwright/global-setup"),
|
globalSetup: require.resolve("./playwright/global-setup"),
|
||||||
|
webServer: {
|
||||||
|
command: "yarn start",
|
||||||
|
url: `${BASE_URL}/#/login`,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
export default config;
|
export default config;
|
||||||
|
@ -77,7 +77,7 @@ export async function dexStart(): Promise<DexInstance> {
|
|||||||
console.log(`Starting dex with config dir ${dexCfg.configDir}...`);
|
console.log(`Starting dex with config dir ${dexCfg.configDir}...`);
|
||||||
const dexId = await dockerRun({
|
const dexId = await dockerRun({
|
||||||
image: "bitnami/dex:latest",
|
image: "bitnami/dex:latest",
|
||||||
containerName: "dex",
|
containerName: "hydrogen-dex",
|
||||||
dockerParams: [
|
dockerParams: [
|
||||||
"--rm",
|
"--rm",
|
||||||
"-v", `${dexCfg.configDir}:/data`,
|
"-v", `${dexCfg.configDir}:/data`,
|
||||||
|
@ -108,7 +108,7 @@ export async function synapseStart(template: string): Promise<SynapseInstance> {
|
|||||||
await dockerCreateNetwork({ networkName: "hydrogen" });
|
await dockerCreateNetwork({ networkName: "hydrogen" });
|
||||||
const synapseId = await dockerRun({
|
const synapseId = await dockerRun({
|
||||||
image: "matrixdotorg/synapse:develop",
|
image: "matrixdotorg/synapse:develop",
|
||||||
containerName: `react-sdk-cypress-synapse-${crypto.randomBytes(4).toString("hex")}`,
|
containerName: `hydrogen-synapse`,
|
||||||
dockerParams: [
|
dockerParams: [
|
||||||
"--rm",
|
"--rm",
|
||||||
"-v", `${synCfg.configDir}:/data`,
|
"-v", `${synCfg.configDir}:/data`,
|
||||||
|
19
scripts/test-app.sh
Executable file
19
scripts/test-app.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Make sure docker is available
|
||||||
|
if ! docker info > /dev/null 2>&1; then
|
||||||
|
echo "You need to intall docker before you can run the tests!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop running containers
|
||||||
|
if docker stop hydrogen-synapse > /dev/null 2>&1; then
|
||||||
|
echo "Existing 'hydrogen-synapse' container stopped ✔"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if docker stop hydrogen-dex > /dev/null 2>&1; then
|
||||||
|
echo "Existing 'hydrogen-dex' container stopped ✔"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run playwright
|
||||||
|
yarn playwright test
|
Loading…
Reference in New Issue
Block a user