Skip to content
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

Use local Magic Wormhole backend for e2e testing #189

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
26 changes: 12 additions & 14 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ on:
push:
pull_request:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false

jobs:
pre:
Expand All @@ -30,7 +24,7 @@ jobs:
build:
name: Build/Test
needs: pre
if: needs.pre.outputs.should_skip != 'true'
if: ${{ github.event_name == 'workflow_dispatch' || needs.pre.outputs.should_skip != 'true' }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
Expand All @@ -43,6 +37,14 @@ jobs:
submodules: recursive
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
#if: ${{ github.event_name == 'workflow_dispatch' }}
timeout-minutes: 30
with:
detached: true
limit-access-to-actor: true

- name: Cache images
uses: ScribeMD/[email protected]
with:
Expand All @@ -63,8 +65,8 @@ jobs:
EOF
cat <<EOF >> ./client/.env
NODE_ENV=development
MAILBOX_URL="wss://mailbox.stage.winden.app/v1"
RELAY_URL="wss://relay.stage.winden.app"
MAILBOX_URL="ws://$IP:8080/mailbox/v1"
RELAY_URL="ws://$IP:8080/relay"
EOF
printf "Client .env:\n"
cat ./client/.env
Expand Down Expand Up @@ -98,17 +100,13 @@ jobs:
docker compose -f docker-compose.yml -f docker-compose.e2e.yml --profile e2e \
run --rm --no-deps -e CI=true client-e2e npm clean-install

- name: Start devserver
- name: Start containers
run: |
docker compose --progress plain up -d client
docker compose exec client ./scripts/wait-for-webpack.sh
docker compose ps
docker compose logs client

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

- name: Run UNIT and INTEGRATION tests
run: docker compose run --rm client npm run test -- --coverage

Expand Down
2 changes: 1 addition & 1 deletion client-e2e/test/pageobjects/page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const homePageUrl = `https://client:8080`;
export const homePageUrl = `http://client:8080`;

export async function open() {
const url = await browser.url(homePageUrl);
Expand Down
2 changes: 1 addition & 1 deletion client-e2e/test/wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const config: Options.Testrunner = {
],
logLevel: "error",
bail: 0,
baseUrl: "https://client:8080",
baseUrl: "http://client:8080",
waitforTimeout: 10000,
connectionRetryTimeout: 60000,
connectionRetryCount: 2,
Expand Down
7 changes: 2 additions & 5 deletions client/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ SFTP_USERNAME=
SFTP_IDENTITY=
SFTP_HOSTNAME=

SENTRY_AUTH_TOKEN=
SENTRY_DSN="https://[email protected]/6566456"

# stage server for mailbox and relay
MAILBOX_URL="wss://mailbox.stage.mw.leastauthority.com/v1"
RELAY_URL="wss://relay.stage.mw.leastauthority.com"
MAILBOX_URL="wss://mailbox.stage.winden.app/v1"
RELAY_URL="wss://relay.stage.winden.app"

NODE_ENV=development
16 changes: 9 additions & 7 deletions client/scripts/devserver.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import express from "express";
import fs from "fs";
import { createProxyMiddleware } from "http-proxy-middleware";
import https from "https";
//import https from "https";
import http from "http";
import path from "path";
import webpack from "webpack";
import webpackDevMiddleware from "webpack-dev-middleware";
Expand Down Expand Up @@ -56,12 +57,13 @@ app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, "../src/public/index.html"));
});

const server = https.createServer(
{
key: fs.readFileSync(path.join(__dirname, "../certs/server.key")),
cert: fs.readFileSync(path.join(__dirname, "../certs/server.cert")),
passphrase: "gulp",
},
//const server = https.createServer(
const server = http.createServer(
// {
// key: fs.readFileSync(path.join(__dirname, "../certs/server.key")),
// cert: fs.readFileSync(path.join(__dirname, "../certs/server.cert")),
// passphrase: "gulp",
// },
app
);

Expand Down
2 changes: 1 addition & 1 deletion client/scripts/wait-for-webpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ printf "Waiting for webpack to compile...\n"
while :; do
sleep 1
printf .
status="$(curl -s -k "https://localhost:8080/bundle-status")"
status="$(curl -s -k "http://localhost:8080/bundle-status")"
if [[ $status =~ "true" ]]; then
break
fi
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ services:
- mailbox
- relay
- feedback-api
healthcheck:
test:
[ "CMD", "curl", "-fk",
"https://localhost:8080/",
"https://localhost:8080/v1",
"https://localhost:8080/mailbox",
"https://localhost:8080/relay",
]
interval: 30s
timeout: 10s
retries: 1
feedback-api:
build: ./feedback-api
command:
Expand Down
Loading