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

test(e2e): add end to end test setup with webdriver-io #158

Merged
merged 27 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
dd27bfd
test: add initial setup for end-to-end testing
gsaslis Dec 14, 2023
b18e33d
test(e2e): initial wdio setup
QZera Oct 13, 2024
31f6825
ci(e2e): have radicle run on an isolated network
QZera Oct 17, 2024
d330c6e
test(e2e): move repo setup from ci to test suite
QZera Nov 5, 2024
5d39e74
test(e2e): remove out of scope tests
QZera Nov 5, 2024
9b35a21
test(e2e): set up linting for e2e test files
QZera Nov 5, 2024
88061ba
test(e2e): remove previous e2e testing setup
QZera Nov 6, 2024
6269ea5
refactor(e2e): refactor onboarding flow tests
QZera Nov 8, 2024
ec3beaa
test(e2e): rename fixture workspace from "a_blog" to "basic"
QZera Nov 8, 2024
c33987f
ci(e2e): clean up e2e workflow
QZera Nov 11, 2024
7c6933a
test(e2e): specify vscode version based on package json
QZera Nov 11, 2024
ea28637
chore(deps): fix wdio-vscode-service peer-dep issue
QZera Nov 11, 2024
91fa71b
refactor(ci): rename workflow files, names, and jobs for consistency
QZera Nov 25, 2024
7d8d7e2
chore: do not include e2e tests on test command
QZera Nov 25, 2024
385be4b
refactor(e2e): update test cases for clarity
QZera Nov 25, 2024
0c3e687
refactor(e2e): rename functions for clarity
QZera Nov 26, 2024
15c70c2
chore(ci): bump ci pnpm version
QZera Nov 26, 2024
b3cd003
chore(ci): bump setup-node to v4.1.0
QZera Nov 26, 2024
c174f56
style(settings): change order of conventional commits scopes
QZera Nov 26, 2024
1228780
test(e2e): bail e2e tests if not run on CI
QZera Nov 26, 2024
5078865
refactor(e2e): rename e2e files for clarity
QZera Nov 26, 2024
d1610af
chore(ci): rename workflow files for consistency, remove redundant pn…
QZera Nov 26, 2024
c6fb92f
test(e2e): update onboarding tests
QZera Nov 26, 2024
5c2baae
docs(changelog): update changelog
QZera Nov 27, 2024
0ab6c21
chore(e2e): update wdio cache directory location
QZera Nov 27, 2024
f0db7d3
refactor(e2e): minor renames and typo fixes in onboarding tests
QZera Nov 27, 2024
7f2d61c
style(e2e): fix new lint warnings
QZera Nov 27, 2024
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
16 changes: 3 additions & 13 deletions .github/workflows/ci.yaml → .github/workflows/code-linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ on:
branches: [ main ]

jobs:
audit:
lint-code:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v4.1.0
with:
node-version: 20.x
cache: 'pnpm'
Expand All @@ -28,11 +26,3 @@ jobs:
run: pnpm run lint
- name: Test Typings
run: pnpm run test:typings
- name: Test Unit
run: pnpm run test:unit
- name: Test E2E (Linux)
if: runner.os == 'Linux'
run: xvfb-run -a pnpm run test:e2e
- name: Test E2E (non-Linux)
if: runner.os != 'Linux'
run: pnpm run test:e2e
2 changes: 1 addition & 1 deletion .github/workflows/commit-linting.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Commit linting
name: CI
on:
pull_request:
branches: [ main ]
Expand Down
92 changes: 92 additions & 0 deletions .github/workflows/e2e-testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test-e2e:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Install Radicle
env:
RAD_HOME: ${{ github.workspace }}/.radicle
run: |
echo "Installing radicle-node..."
curl -sSf https://radicle.xyz/install | sh

echo "Installing radicle-httpd..."

case "$(uname)/$(uname -m)" in
Darwin/arm64)
export TARGET="aarch64-apple-darwin" ;;
Darwin/x86_64)
export TARGET="x86_64-apple-darwin" ;;
Linux/arm64|Linux/aarch64)
export TARGET="aarch64-unknown-linux-musl" ;;
Linux/x86_64)
export TARGET="x86_64-unknown-linux-musl" ;;
*)
fatal "Your operating system is currently unsupported. Sorry!" ;;
esac
echo $TARGET
curl -s https://files.radicle.xyz/releases/radicle-httpd/0.17.0/radicle-httpd-0.17.0-$TARGET.tar.xz | tar -xJ --strip-components=2
mv radicle-httpd $RAD_HOME/bin/radicle-httpd

# add to path
echo "${RAD_HOME}/bin" >> $GITHUB_PATH
echo "RAD_HOME=${{ github.workspace }}/.radicle" >> $GITHUB_ENV
echo "RAD_PASSPHRASE=''" >> $GITHUB_ENV

- name: Create New Radicle Identity
run: |
rad auth --alias test_user

- name: Configure Radicle for Testing
run: |
# Source: https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/tree/HACKING.md
jq '.node.network = "test" | .preferredSeeds = [] | .node.connect = [] | .node.peers.type = "static"' ${RAD_HOME}/config.json > ${RAD_HOME}/config.json.tmp
mv ${RAD_HOME}/config.json.tmp ${RAD_HOME}/config.json

- name: Start Radicle Node and http API
run: |
rad node start &
echo "allowing node to start up..."
sleep 5
radicle-httpd --listen 0.0.0.0:8888 &
rad node status
rad self

- uses: pnpm/action-setup@v4
- name: Install Node.js
uses: actions/[email protected]
with:
cache-dependency-path: ./pnpm-lock.yaml
node-version: 20.x
cache: 'pnpm'

- name: Install Dependencies
run: npx npm-run-all -l verify-deps:*

- name: Build
run: pnpm run build

- name: Test E2E (Linux)
if: runner.os == 'Linux'
env:
RAD_PATH: ${{ github.workspace }}/.radicle/bin/rad
run: xvfb-run -a pnpm test:e2e

- name: Test E2E (non-Linux)
if: runner.os != 'Linux'
env:
RAD_PATH: ${{ github.workspace }}/.radicle/bin/rad
run: pnpm test:e2e
2 changes: 1 addition & 1 deletion .github/workflows/pr-linting.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR linting
name: CI
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ debug.log*

# git / radicle
.gitsigners

# wdio
.wdio-vscode-service
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"build",
"lint",
"git",
"ci",
"e2e",
"env",
"deps",
"ts",
Expand All @@ -25,7 +27,6 @@
"publish",
"marketplace",
"icons",
"ci",
"auth",
"ux",
"httpd",
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Radicle VS Code Extension Change Log

# _(WIP, yet unreleased version)_

### 🤖 CI

- **e2e:** set up new infrastructure and a related CI workflow capable of automated completely end-to-end testing. It uses a real Radicle node, which powers the latest extension build, which is running in an actual VS Code. Tests can assert behavior and state even as deep as extension webviews.

### ☑️ Tests

- **onboarding:** cover various paths of the flow with e2e tests

-----

## **v0.6.0** (November 9th, 2024)

### ✨ Highlights
Expand Down
24 changes: 21 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"vscode": "^1.91.0",
"npm": "^7"
},
"packageManager": "[email protected]",
"keywords": [
"radicle",
"git"
Expand All @@ -44,12 +45,12 @@
"lint": "run-p lint:*",
"lint:extension": "eslint . --ext .vue,.ts,.tsx,.js,.jsx --max-warnings 0 --cache --cache-location node_modules/.cache/eslint",
"lint:webviews": "cd ./src/webviews && npm run lintfix",
"test": "npm run test:typings && npm run test:unit && npm run test:e2e",
"test": "npm run test:typings && npm run test:unit",
"test:typings": "run-p test:typings:*",
"test:typings:extension": "tsc --noEmit",
"test:typings:webviews": "cd ./src/webviews && npm run type-check",
"test:unit": "echo \"Unit testing not yet implemented.\"",
"test:e2e": "echo \"End-to-end testing not yet implemented.\""
"test:e2e": "wdio run ./test/e2e/wdio.conf.ts"
},
"main": "./dist/extension.js",
"activationEvents": [
Expand Down Expand Up @@ -580,19 +581,36 @@
"@total-typescript/ts-reset": "^0.5.1",
"@types/javascript-time-ago": "^2.0.8",
"@types/lodash": "^4.17.6",
"@types/mocha": "^10.0.9",
"@types/node": "^20.11.21",
"@types/vscode": "^1.91.0",
"@wdio/cli": "^9.2.11",
"@wdio/globals": "^9.2.11",
"@wdio/local-runner": "^9.2.11",
"@wdio/mocha-framework": "^9.2.8",
"@wdio/spec-reporter": "^9.2.8",
"@wdio/types": "^9.2.2",
"esbuild": "^0.23.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-jasmine": "^4.2.2",
"eslint-plugin-prettier-vue": "^4.2.0",
"eslint-plugin-tailwindcss": "^3.14.3",
"eslint-plugin-vue-scoped-css": "^2.7.2",
"expect-webdriverio": "^5.0.4",
"npm-run-all": "^4.1.5",
"simple-git-hooks": "^2.9.0",
"ts-xor": "^1.3.0",
"typescript": "^5.3.3"
"tsx": "^4.19.2",
"typescript": "^5.3.3",
"wdio-vscode-service": "^6.1.2",
"webdriverio": "^9.2.11",
"zx": "^8.1.9"
},
"overrides": {
"wdio-vscode-service": {
"webdriverio": "^9.2.11"
}
},
"simple-git-hooks": {
"pre-commit": "npm run lint"
Expand Down
Loading