Skip to content
Draft
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
136 changes: 136 additions & 0 deletions .github/workflows/ui-automation-testing-tauri.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
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 \
librsvg2-dev \
patchelf \
webkit2gtk-driver \
xvfb \
protobuf-compiler \
libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libxdo-dev \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev


- 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
65 changes: 65 additions & 0 deletions nym-vpn-app/tauri-webdriver-tests/.gitignore
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
175 changes: 175 additions & 0 deletions nym-vpn-app/tauri-webdriver-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# 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+)
- Rust and Cargo
- Protocol Buffer Compiler (`protoc`) - **Required for building the Nym VPN client**
- Tauri Driver - **Required for WebDriver tests**
- Microsoft Edge WebDriver (for Windows testing)
- Firefox (for macOS testing)
- GeckoDriver (for macOS testing)

### Installing Protocol Buffer Compiler (protoc)

#### Windows

```
choco install protoc
```

#### macOS

```
brew install protobuf
```

#### Linux

```
sudo apt-get install protobuf-compiler
```

### Installing Tauri Driver

```
cargo install tauri-driver
```

### Installing Microsoft Edge WebDriver (Windows only)

1. Download the WebDriver for your Edge version from [Microsoft Edge WebDriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
2. Place `msedgedriver.exe` in a directory that's in your PATH (recommended: create a `Webdriver` folder in your user directory)
3. Add the directory to your PATH:
```
setx PATH "%PATH%;%USERPROFILE%\Webdriver"
```

### macOS only: Install geckodriver

```
brew install geckodriver
```

## 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
```

## Running Tests

### 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. **Protocol Buffer Compiler (protoc) issues**:

- Make sure `protoc` is installed and in your PATH
- On Windows, you can set the `PROTOC` environment variable to point to the executable
- Verify installation with `protoc --version`

2. **Tauri-driver issues**:

- Ensure it's installed via `cargo install tauri-driver`
- Check if it's in your PATH (usually in `~/.cargo/bin/`)
- The tests will automatically look for tauri-driver in common locations

3. **Microsoft Edge WebDriver issues (Windows)**:

- Make sure `msedgedriver.exe` is in your PATH
- Download the correct version from Microsoft that matches your Edge browser version
- Place it in a directory like `C:\Users\YourUsername\Webdriver\`

4. **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

5. **Firefox freezing**:
- Make sure you're using a compatible Firefox version
- Try running the cleanup script before starting tests

### 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.
Loading