Files
tmail-flutter/scripts/patrol-web-local-integration-test-with-docker.sh
Dat Dang b18813a096 Patrol web POC (#4450)
* Patrol POC add UIKeys to production widgets for web testability

Add semantic UIKeys to composer widgets, login controller, mailbox
dashboard, thread view, and web finger extension to enable reliable
widget targeting in Patrol web integration tests.

* Patrol POC add web login and send email Patrol integration test scenarios

Add web-specific test scenarios (login with basic auth, send email),
a new web_send_email_test entry point, and a web tag in TestTags.
Update test_base, requires_login_mixin, composer_robot, and
thread_robot to support web platform.

* Patrol POC add Patrol web integration test workflow and scripts

Add GitHub Actions workflow for running Patrol web integration tests.
Add patrol-web-integration-test-with-docker.sh and
patrol-web-local-integration-test-with-docker.sh scripts.
Minor fix to patrol-local-integration-test-with-docker.sh.

* Patrol POC update gitignore and web/index.html for Patrol web support

* poc: implement cross-platform robot factory architecture

Introduces Abstract Factory + conditional export infrastructure from
ADR-0081. Platform selection resolved at compile time via dart.library.html
— no if/else in any logic class.

New structure:
- factories/: RobotFactory, Mobile/WebRobotFactory, conditional provider
- robots/abstract/: AbstractLogin/Thread/ComposerRobot interfaces
- robots/mobile/: thin wrappers over existing robots
- robots/web/: WebComposerRobot overrides addContent for web
2026-04-21 14:34:47 +07:00

61 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
## Pre-requisites
# Install patrol CLI
# Stop previous environment if any
cd backend-docker
docker compose down || true
cd ..
# Forward traffic to tmail-backend
export BASIC_AUTH_URL="http://localhost/"
export WEBSOCKET_URL="ws://localhost/"
cd backend-docker
# Generate keys for tmail backend
echo "Generating keys for tmail-backend..."
openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:4096 -out jwt_privatekey
openssl rsa -in jwt_privatekey -pubout -out jwt_publickey
# Replace jmap.properties URLs so James reports the correct public base URL
# in its JMAP session responses (the app uses these URLs for subsequent requests).
sed -i '' "s|url.prefix=.*|url.prefix=$BASIC_AUTH_URL|" jmap.properties
sed -i '' "s|websocket.url.prefix=.*|websocket.url.prefix=$WEBSOCKET_URL|" jmap.properties
echo "Starting services and adding users..."
docker compose up -d
# Wait till the service is started to add users
until (docker compose logs tmail-backend | grep -i "JAMES server started"); do
echo "Waiting for tmail-backend to start..."
sleep 2
done
export BOB="bob"
export ALICE="alice"
export DOMAIN="example.com"
docker exec tmail-backend ./root/conf/integration_test/provisioning.sh
cd ..
echo "Copying integration_test/integration_test_env.file to env.file..."
cp integration_test/integration_test_env.file env.file
echo "Building the app and running tests..."
patrol test -v \
--tags=web \
--device=chrome \
--web-port=3000 \
--web-browser-args='["--lang=en-US","--accept-lang=en-US,en"]' \
--dart-define=USERNAME="$BOB" \
--dart-define=PASSWORD="$BOB" \
--dart-define=ADDITIONAL_MAIL_RECIPIENT="$ALICE@$DOMAIN" \
--dart-define=BASIC_AUTH_EMAIL="$BOB@$DOMAIN" \
--dart-define=BASIC_AUTH_URL="$BASIC_AUTH_URL"
# Clean up
echo "Cleaning up test environment..."
cd backend-docker
docker compose down
cd ..