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 9, 2023
1 parent 6904766 commit c419e5c
Show file tree
Hide file tree
Showing 39 changed files with 1,530 additions and 28,427 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/check-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
node-version: ${{ env.NODE_VERSION }}
- name: Install PNPM
run: npm install -g pnpm
- name: Install Yarn
run: npm install -g yarn
- name: Install RushJS
run: npm install -g @microsoft/rush
- name: Verify Change Logs
Expand All @@ -29,5 +31,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: Publish Docs
uses: actions/upload-pages-artifact@v2
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@ examples/*/dist/

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

# Rporters
e2e/playwright-report
e2e/test-results
e2e/tests-results
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"
}
}
27 changes: 27 additions & 0 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { PlaywrightTestConfig } from '@playwright/test'
import { JSON_REPORT_PATH, TESTS_DIR } from './src/constants/PathsDefinitions';
import { 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: 3,
use: {
permissions: ["clipboard-read"],
screenshot: 'on',
video: 'on'
},
timeout: 50000,
}

export default config
Loading

0 comments on commit c419e5c

Please sign in to comment.