-
Notifications
You must be signed in to change notification settings - Fork 30
UI Automation for tauri based vpn apps #2705
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
Draft
tommyv1987
wants to merge
12
commits into
develop
Choose a base branch
from
feature/add-automation-ui
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
79274b9
vpn ui tests - first batch
dd62ecb
action is not tested yet
tommyv1987 3bc0cb8
formatting
tommyv1987 ea483da
amend system deps
tommyv1987 993a517
amend conf
tommyv1987 6f3202d
add the ability to use debug build as well
tommyv1987 7484796
looks quite heavy - but we can refine later - add debug script commands
tommyv1987 f94d3fd
More debug mode configurations
tommyv1987 9370517
A few more changes
tommyv1987 b269276
debugging logs
tommyv1987 22e1109
windows is working
tommyv1987 2f93fe1
prettier
tommyv1987 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
name: Tauri NymVPN Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
debug: | ||
description: 'Run with debug logging' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
build-and-test: | ||
name: Build and Test on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21 | ||
cache: 'npm' | ||
|
||
- name: Install npm dependencies | ||
run: npm ci | ||
|
||
- name: Create dist directory | ||
run: mkdir -p dist | ||
|
||
- name: Install Rust stable | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: stable | ||
|
||
- name: Install Tauri dependencies (Ubuntu) | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y \ | ||
libgtk-3-dev \ | ||
libwebkit2gtk-4.0-dev \ | ||
libappindicator3-dev \ | ||
librsvg2-dev \ | ||
patchelf \ | ||
webkit2gtk-driver \ | ||
xvfb \ | ||
protobuf-compiler | ||
|
||
- name: Install Protobuf (Windows) | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
choco install protoc | ||
|
||
- name: Install cargo-hack from crates.io | ||
uses: baptiste0928/cargo-install@v3 | ||
with: | ||
crate: tauri-driver | ||
version: '2.0.4' | ||
|
||
# Build the Tauri app (without code signing) | ||
- name: Build Tauri application | ||
env: | ||
RUST_LOG: info,nym_vpn_app=trace | ||
run: npm run tauri build | ||
|
||
- name: Install WebdriverIO dependencies | ||
run: npm install @wdio/cli @wdio/local-runner @wdio/mocha-framework @wdio/spec-reporter | ||
|
||
- name: Run WebdriverIO tests (Linux) | ||
if: matrix.os == 'ubuntu-latest' | ||
env: | ||
CI: true | ||
RUST_LOG: info,nym_vpn_app=trace | ||
run: xvfb-run npx wdio run wdio.conf.js | ||
|
||
- name: Run WebdriverIO tests (Windows) | ||
if: matrix.os == 'windows-latest' | ||
env: | ||
CI: true | ||
RUST_LOG: info,nym_vpn_app=trace | ||
run: npx wdio run wdio.conf.js | ||
|
||
- name: Run WebdriverIO tests (macOS) | ||
if: matrix.os == 'macos-latest' | ||
env: | ||
CI: true | ||
RUST_LOG: info,nym_vpn_app=trace | ||
run: npx wdio run wdio.conf.js | ||
|
||
- name: Upload test screenshots | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-screenshots-${{ matrix.os }} | ||
path: ./screenshots | ||
if-no-files-found: ignore | ||
|
||
- name: Upload test reports | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-reports-${{ matrix.os }} | ||
path: ./reports | ||
if-no-files-found: ignore | ||
|
||
- name: Package Linux artifacts | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: nym-vpn-linux | ||
path: | | ||
src-tauri/target/release/bundle/deb/*.deb | ||
src-tauri/target/release/bundle/appimage/*.AppImage | ||
if-no-files-found: warn | ||
|
||
- name: Package Windows artifacts | ||
if: matrix.os == 'windows-latest' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: nym-vpn-windows | ||
path: src-tauri/target/release/bundle/msi/*.msi | ||
if-no-files-found: warn | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Node dependencies | ||
node_modules/ | ||
package-lock.json | ||
yarn.lock | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# WebDriverIO specific | ||
errorShots/ | ||
allure-results/ | ||
allure-report/ | ||
mochawesome-report/ | ||
reports/ | ||
screenshots/ | ||
videos/ | ||
logs/ | ||
.tmp/ | ||
|
||
target/ | ||
**/*.rs.bk | ||
Cargo.lock | ||
|
||
# OS specific files | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
.vscode/ | ||
.idea/ | ||
*.sublime-workspace | ||
*.sublime-project | ||
*.swp | ||
*.swo | ||
.project | ||
.classpath | ||
.settings/ | ||
*.iml | ||
.vs/ | ||
|
||
# Environment files | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# Build files | ||
dist/ | ||
build/ | ||
out/ | ||
|
||
# Coverage | ||
coverage/ | ||
.nyc_output/ | ||
|
||
# Temporary files | ||
temp/ | ||
tmp/ | ||
*.tmp | ||
*.bak |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# NymVPN UI Tests | ||
|
||
This repository contains the end-to-end UI tests for the NymVPN application using WebdriverIO and Tauri Driver. | ||
|
||
### Prerequisites | ||
|
||
- Node.js (v21+) | ||
- Firefox (for macOS testing) | ||
- Tauri CLI | ||
- Rust and Cargo | ||
- GeckoDriver (for macOS testing) | ||
|
||
### Installation | ||
|
||
1. Clone the repository: | ||
|
||
``` | ||
git clone https://github.com/nymtech/nym-vpn-client.git | ||
cd nym-vpn-client | ||
``` | ||
|
||
2. Install dependencies: | ||
|
||
``` | ||
cd nym-vpn-app | ||
npm install | ||
``` | ||
|
||
### Install WebdriverIO dependencies | ||
|
||
``` | ||
cd tauri-webdriver-tests | ||
npm install -D @wdio/cli @wdio/local-runner @wdio/mocha-framework @wdio/spec-reporter | ||
``` | ||
|
||
### macOS only: Install geckodriver | ||
|
||
``` | ||
brew install geckodriver | ||
``` | ||
|
||
### For Linux/Windows, ensure tauri-driver is installed: | ||
|
||
``` | ||
cargo install tauri-driver | ||
``` | ||
|
||
### Run all tests | ||
|
||
``` | ||
npm run test | ||
``` | ||
|
||
### Run specific test files | ||
|
||
``` | ||
# Run home page tests | ||
npm run testlocal | ||
|
||
# Run settings page tests | ||
npm run testsettings | ||
|
||
# Run support page tests | ||
npm run testsupport | ||
|
||
# Run location selection tests | ||
npm run testlocation | ||
``` | ||
|
||
### Run all tests except connection tests | ||
|
||
``` | ||
npx wdio run wdio.conf.js --exclude ./src/tests/specs/connection.spec.js | ||
``` | ||
|
||
### Run tests in CI mode (with mock connections) | ||
|
||
``` | ||
npm run testci | ||
``` | ||
|
||
## Test Structure | ||
|
||
- `src/tests/pageobjects/`: Page Object Models | ||
- `src/tests/specs/`: Test specifications | ||
- `src/tests/utils/`: Helper utilities for testing | ||
|
||
## CI/CD Integration | ||
|
||
This project includes GitHub Actions workflows for automated testing on multiple platforms: | ||
|
||
- Ubuntu Linux | ||
- Windows | ||
|
||
## Important Configuration | ||
|
||
- macOS tests run in browser mode with Firefox and GeckoDriver | ||
- Linux/Windows tests run against the compiled Tauri application | ||
- Test screenshots are saved automatically on failure | ||
- Connection tests are excluded in CI mode | ||
|
||
## Troubleshooting | ||
|
||
### Common Issues | ||
|
||
1. **GeckoDriver issues on macOS**: | ||
|
||
- Don't run tests with sudo | ||
- Ensure Firefox is installed at `/Applications/Firefox.app` | ||
- Check if GeckoDriver is in PATH or at homebrew locations | ||
|
||
2. **Firefox freezing**: | ||
|
||
- Make sure you're using a compatible Firefox version | ||
- Try running the cleanup script before starting tests | ||
|
||
3. **Tauri-driver issues**: | ||
- Ensure it's installed via `cargo install tauri-driver` | ||
- Check if it's in your PATH | ||
|
||
### Debugging | ||
|
||
For more verbose logs: | ||
|
||
``` | ||
WDIO_LOG_LEVEL=debug npm run test | ||
``` | ||
|
||
Check the screenshots directory after failed tests to see the application state at the time of failure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "nym-vpn-app-ui-tests", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "wdio run wdio.conf.js", | ||
"test:headless": "cross-env HEADLESS=true wdio run wdio.conf.js", | ||
"testci": "cross-env CI=true wdio run wdio.conf.js", | ||
"testci:headless": "cross-env CI=true HEADLESS=true wdio run wdio.conf.js", | ||
"testlocal": "wdio run wdio.conf.js --spec ./src/tests/specs/home.spec.js", | ||
"testlocal:headless": "cross-env HEADLESS=true wdio run wdio.conf.js --spec ./src/tests/specs/home.spec.js", | ||
"testlocation": "wdio run wdio.conf.js --spec ./src/tests/specs/locationselection.spec.js", | ||
"testlocation:headless": "cross-env HEADLESS=true wdio run wdio.conf.js --spec ./src/tests/specs/locationselection.spec.js", | ||
"testconnection": "wdio run wdio.conf.js --spec ./src/tests/specs/connection.spec.js", | ||
"testconnection:headless": "cross-env HEADLESS=true wdio run wdio.conf.js --spec ./src/tests/specs/connection.spec.js", | ||
"testsettings": "wdio run wdio.conf.js --spec ./src/tests/specs/settings.spec.js", | ||
"testsettings:headless": "cross-env HEADLESS=true wdio run wdio.conf.js --spec ./src/tests/specs/settings.spec.js", | ||
"testsupport": "wdio run wdio.conf.js --spec ./src/tests/specs/support.spec.js", | ||
"testsupport:headless": "cross-env HEADLESS=true wdio run wdio.conf.js --spec ./src/tests/specs/support.spec.js", | ||
"testall-except-connection": "wdio run wdio.conf.js --exclude ./src/tests/specs/connection.spec.js", | ||
"testall-except-connection:headless": "cross-env HEADLESS=true wdio run wdio.conf.js --exclude ./src/tests/specs/connection.spec.js", | ||
"testall-except-multiple": "wdio run wdio.conf.js --exclude ./src/tests/specs/connection.spec.js --exclude ./src/tests/specs/locationselection.spec.js", | ||
"testall-except-multiple:headless": "cross-env HEADLESS=true wdio run wdio.conf.js --exclude ./src/tests/specs/connection.spec.js --exclude ./src/tests/specs/locationselection.spec.js", | ||
"fmt": "prettier --write --ignore-unknown \"**/*\"", | ||
"fmt:check": "prettier --check --ignore-unknown \"**/*\"" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"description": "", | ||
"devDependencies": { | ||
"@types/node": "^22.14.1", | ||
"@wdio/cli": "^9.12.7", | ||
"@wdio/local-runner": "^9.12.7", | ||
"@wdio/mocha-framework": "^9.12.6", | ||
"@wdio/spec-reporter": "^9.12.6", | ||
"@wdio/visual-service": "^7.0.0", | ||
"cross-env": "^7.0.3", | ||
"geckodriver": "^5.0.0", | ||
"globals": "^16.0.0", | ||
"prettier": "^3.5.3", | ||
"typescript": "^5.8.3" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import("prettier").Config} */ | ||
|
||
const config = { | ||
tabWidth: 2, | ||
semi: true, | ||
singleQuote: true, | ||
endOfLine: 'lf', | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium