Skip to content

Commit

Permalink
CU-86a0vq1ak - Fully implement WcSdk e2e tests (finish the connection…
Browse files Browse the repository at this point in the history
… and use every command expecing the responses)
  • Loading branch information
Leonardo de Jesus Diz Conde committed Oct 11, 2023
1 parent c909526 commit d6a2046
Show file tree
Hide file tree
Showing 43 changed files with 1,767 additions and 28,509 deletions.
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
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
run: rush version --bump
- name: Install dependencies
run: rush update
- name: Build Projects
- name: Build BaseUrl
run: rush rebuild
- name: Publish Projects
- name: Publish BaseUrl
run: rush publish --apply --target-branch main --publish --npm-auth-token ${{ secrets.NPM_TOKEN }} --add-commit-details --include-all
- name: Merge Docs
run: rush docs
Expand Down
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

0 comments on commit d6a2046

Please sign in to comment.