Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
128 changes: 128 additions & 0 deletions .github/workflows/ui-automation-testing-tauri.yml
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

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
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
129 changes: 129 additions & 0 deletions nym-vpn-app/tauri-webdriver-tests/README.md
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.
44 changes: 44 additions & 0 deletions nym-vpn-app/tauri-webdriver-tests/package.json
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"
}
}
10 changes: 10 additions & 0 deletions nym-vpn-app/tauri-webdriver-tests/prettier.config.js
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;
Loading
Loading