-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create initial setup for e2e + gh automation (#558)
* feat: create initial setup for e2e + gh automation * skip e2e when running unit tests * exclude e2e from unit testts * add env variables to ci * increase timeout to 15s * use gh env variables for non secrets
- Loading branch information
1 parent
c755816
commit 7359ec0
Showing
9 changed files
with
154 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Test end-to-end | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
# Declare default permissions as read only. | ||
permissions: read-all | ||
|
||
env: | ||
API_KEY: ${{ secrets.E2E_API_KEY }} | ||
API_SECRET: ${{ secrets.E2E_API_SECRET }} | ||
DEFENDER_API_URL: $E2E_DEFENDER_API_URL | ||
DEFENDER_POOL_ID: $E2E_DEFENDER_POOL_ID | ||
DEFENDER_POOL_CLIENT_ID: $E2E_DEFENDER_POOL_CLIENT_ID | ||
|
||
jobs: | ||
build-test: | ||
name: Run build & e2e test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.5.4 | ||
|
||
- name: Prepare pre-requisites | ||
uses: ./.github/actions/prepare | ||
|
||
- name: Build | ||
run: | | ||
pnpm nx-build-skip-cache | ||
- name: Test end-to-end | ||
run: | | ||
pnpm test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
API_KEY= | ||
API_SECRET= | ||
|
||
# OPTIONAL FOR LOWER ENVIRONMENTS | ||
DEFENDER_API_URL= | ||
DEFENDER_POOL_ID= | ||
DEFENDER_POOL_CLIENT_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testMatch: ['**/src/**/*.test.ts'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "e2e", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "jest", | ||
"test:watch": "jest --watch" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@types/jest": "^29.5.12", | ||
"axios": "^1.7.2", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.2" | ||
}, | ||
"dependencies": { | ||
"@openzeppelin/defender-sdk": "workspace:^", | ||
"dotenv": "^16.4.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "e2e", | ||
"root": "e2e", | ||
"sourceRoot": "e2e/src", | ||
"projectType": "application", | ||
"targets": { | ||
"test": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "pnpm test", | ||
"cwd": "e2e" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require('dotenv').config(); | ||
import { Defender } from '@openzeppelin/defender-sdk'; | ||
|
||
// Default timeout is not enough, using 15s timeout instead. | ||
jest.setTimeout(15 * 1000); | ||
|
||
describe('actions', () => { | ||
const actionClient = new Defender({ | ||
apiKey: process.env.API_KEY, | ||
apiSecret: process.env.API_SECRET, | ||
}).action; | ||
|
||
it('should list actions', async () => { | ||
const result = await actionClient.list(); | ||
expect(result.items).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
packages: | ||
- 'packages/*' | ||
- 'examples/*' | ||
- 'e2e' |