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

CU-86a0vq1ak - Fully implement WcSdk e2e tests (finish the connection and use every command ... #93

Merged
merged 2 commits into from
Oct 16, 2023
Merged
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
24 changes: 23 additions & 1 deletion .github/workflows/check-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,27 @@ jobs:
run: rush check
- name: Install Dependencies
run: rush update
- name: Build Projects
- name: Build Packages
run: rush rebuild --verbose
- name: Rush Purge
continue-on-error: true
run: rush purge
- name: Install E2E Tester
working-directory: ./e2e
run: pnpm i
- name: Install Examples Dependencies
working-directory: ./e2e
run: pnpm ex:install:unix
- name: Build Examples
working-directory: ./e2e
run: pnpm ex:build:unix
- name: Test E2E
working-directory: ./e2e
run: pnpm test:headless
- name: Upload Playwright Report
uses: actions/upload-artifact@v3
if: failure()
with:
name: playwright-report
path: ./e2e/playwright-report/
retention-days: 1
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,13 @@ examples/*/dist/

# Examples test result
examples/*/test-results/

# Reporters
e2e/playwright-report
e2e/test-results
e2e/tests-results

# examples lock
examples/**/pnpm-lock.yaml
examples/**/yarn.lock
examples/**/package-lock.json
15 changes: 15 additions & 0 deletions e2e/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.DS_Store
node_modules
playwright.config.ts

# Package manager files
pnpm-lock.yaml
yarn.lock
package-lock.json

# Ignore files for NPM lock file
package-lock.json

test-results/
tests-results/
playwright-report/
13 changes: 13 additions & 0 deletions e2e/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
parser: '@typescript-eslint/parser',
},
root: true,
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
}
12 changes: 12 additions & 0 deletions e2e/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules
playwright.config.ts

# Package manager files
pnpm-lock.yaml
yarn.lock
package-lock.json

test-results/
tests-results/
playwright-report/
7 changes: 7 additions & 0 deletions e2e/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2
}
35 changes: 35 additions & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "e2e",
"version": "1.0.0",
"description": "wallet-connect-sdk e2e(end to end) tester",
"private": true,
"scripts": {
"ex:build:unix": "cd ../examples && for d in */; do (cd \"$d\" && pnpm build && cd ..); done",
"ex:build:windows": "cd ../examples && for /d %i in (*) do (cd %i && pnpm build && cd ..)",
"ex:clean:unix": "rush purge && cd ../examples && for d in */; do (cd \"$d\" && rm -rf node_modules pnpm-lock.yaml && cd ..); done",
"ex:clean:windows": "rush purge && cd ../examples && for /d %i in (*) do (cd %i && rm -rf node_modules pnpm-lock.yaml && cd ..)",
"ex:install:unix": "cd ../examples && for d in */; do (cd \"$d\" && pnpm install && cd ..); done",
"ex:install:windows": "cd ../examples && for /d %i in (*) do (cd %i && pnpm install && cd ..)",
"format": "prettier . --write && eslint --fix",
"lint": "prettier . --check && eslint",
"prepare": "npm install serve -g && pnpm exec playwright install",
"report:clean": "rm -rf playwright-report test-results tests-results",
"report:open": "npx pnpm playwright show-report",
"test": "playwright test --headed",
"test:headless": "playwright test"
},
"devDependencies": {
"@playwright/test": "^1.38.1",
"@types/node": "^20.8.2",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.50.0",
"playwright": "^1.38.1",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
"dependencies": {
"concurrently": "^8.2.1",
"cross-env": "^7.0.3"
}
}
37 changes: 37 additions & 0 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { PlaywrightTestConfig } from '@playwright/test'
import { JSON_REPORT_PATH, TESTS_DIR } from './src/constants/PathsDefinitions';
import { MAX_RETRIES, RUN_CONCURRENTLY_COMMAND } from './src/constants/DevConstants';


const config: PlaywrightTestConfig = {
fullyParallel: true,
testMatch: '**/*.spec.ts',
webServer: {
command: RUN_CONCURRENTLY_COMMAND,
port: 3000, // It needs a port to run the command above
},
reporter: [
['list', { printSteps: true}],
['html', { open: 'never'}],
['json', { outputFile: JSON_REPORT_PATH}]
],
testDir: TESTS_DIR,

retries: MAX_RETRIES,
use: {
offline: false,
permissions: [
"clipboard-read",
"clipboard-write",
"background-sync",
"payment-handler",
"notifications",

],
screenshot: 'on',
video: 'on'
},
timeout: 100000,
}

export default config
Loading
Loading