-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61d9dbd
commit a9d12e7
Showing
23 changed files
with
5,519 additions
and
20 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
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,97 @@ | ||
name: End-to-end tests | ||
|
||
concurrency: | ||
group: ${{ github.head_ref }}${{ github.ref }}-e2e | ||
cancel-in-progress: true | ||
|
||
on: | ||
schedule: | ||
- cron: "0 2 * * *" | ||
workflow_dispatch: | ||
inputs: | ||
mediatorOobUrl: | ||
required: true | ||
description: Mediator out-of-band url | ||
default: https://mediator.rootsid.cloud/oob_url | ||
prismAgentUrl: | ||
required: true | ||
description: Prism-agent server url | ||
default: https://k8s-dev.atalaprism.io/prism-agent | ||
publishedDid: | ||
required: false | ||
description: Published DID | ||
schemaId: | ||
required: false | ||
description: Schema ID | ||
apiKey: | ||
required: false | ||
description: Authorization key | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} | ||
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
MEDIATOR_OOB_URL: ${{ inputs.mediatorOobUrl || secrets.MEDIATOR_OOB_URL }} | ||
PRISM_AGENT_URL: ${{ inputs.prismAgentUrl || secrets.PRISM_AGENT_URL }} | ||
PUBLISHED_DID: ${{ inputs.publishedDid || secrets.PUBLISHED_DID }} | ||
SCHEMA_ID: ${{ inputs.schemaId || secrets.SCHEMA_ID }} | ||
APIKEY: ${{ inputs.apiKey || secrets.APIKEY }} | ||
NODE_AUTH_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
|
||
jobs: | ||
run-e2e-tests: | ||
name: "Run" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Mask apikey | ||
run: echo "::add-mask::${{env.APIKEY}}" | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.ATALA_GITHUB_TOKEN }} | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: "@input-output-hk" | ||
|
||
- name: Pack atala-prism-wallet-sdk | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
npm install | ||
npm run build | ||
npm pack | ||
echo "PACKAGE_NAME=$(find . -maxdepth 1 -name input-output* | tr -d '\n')" >> "$GITHUB_ENV" | ||
- name: Install local dependency | ||
if: github.event_name == 'pull_request' | ||
working-directory: integration-tests/e2e-tests | ||
run: | | ||
yarn | ||
yarn add "../../${{ env.PACKAGE_NAME }}" | ||
- name: Run tests | ||
working-directory: integration-tests/e2e-tests | ||
run: | | ||
yarn | ||
yarn test:sdk | ||
yarn test:sdk:report | ||
- name: Add notes to summary | ||
working-directory: integration-tests/e2e-tests | ||
run: cat notes >> $GITHUB_STEP_SUMMARY | ||
|
||
- name: Publish Serenity report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: atala-prism-sdk-ts.zip | ||
path: integration-tests/e2e-tests/target/site/wallet-sdk-ts | ||
if-no-files-found: error |
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 |
---|---|---|
|
@@ -48,6 +48,3 @@ jobs: | |
run: | | ||
npm install | ||
npx semantic-release | ||
- name: Publish artifact | ||
run: npm publish |
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
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 @@ | ||
node_modules | ||
target | ||
pluto.db | ||
.DS_Store | ||
.idea | ||
.env* | ||
notes |
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 @@ | ||
# Wallet SDK - Typescript 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,13 @@ | ||
module.exports = { | ||
default: [ | ||
`--publish-quiet`, | ||
`--format '@serenity-js/cucumber'`, | ||
`--require=tests/sdk/steps/**/*.ts`, | ||
`--require=config/serenity.config.ts`, | ||
`--require-module=ts-node/register`, | ||
'--backtrace' | ||
].join(' '), | ||
glue: [ | ||
"tests/sdk/src/**/*.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,35 @@ | ||
import { BeforeAll, defineParameterType, setDefaultTimeout } from "@cucumber/cucumber" | ||
import { actorCalled, actorInTheSpotlight, configure } from "@serenity-js/core" | ||
|
||
setDefaultTimeout(3 * 60 * 1000) | ||
|
||
BeforeAll(async function () { | ||
// Configure Serenity/JS | ||
configure({ | ||
crew: [ | ||
"@serenity-js/console-reporter", | ||
"@serenity-js/serenity-bdd", | ||
[ | ||
"@serenity-js/core:ArtifactArchiver", | ||
{ outputDirectory: "target/site/serenity" }, | ||
], | ||
] | ||
}) | ||
}) | ||
|
||
defineParameterType({ | ||
// regexp: /[A-Z][a-z]+/, | ||
regexp: /.*/, | ||
transformer(name: string) { | ||
return actorCalled(name); | ||
}, | ||
name: 'actor', | ||
}); | ||
|
||
defineParameterType({ | ||
regexp: /he|she|they|his|her|their/, | ||
transformer() { | ||
return actorInTheSpotlight(); | ||
}, | ||
name: 'pronoun', | ||
}); |
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,2 @@ | ||
### End-to-end notes: | ||
|
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,43 @@ | ||
{ | ||
"name": "atala-prism-wallet-sdk-ts-e2e", | ||
"version": "1.0.0", | ||
"main": "index.ts", | ||
"scripts": { | ||
"postinstall": "serenity-bdd update", | ||
"clean": "rimraf target", | ||
"test:sdk": "yarn clean && yarn test:sdk:run", | ||
"test:sdk:run": "cucumber-js --config config/cucumber.sdk.js tests/sdk/features -b --exit", | ||
"test:sdk:report": "serenity-bdd run --features tests/sdk/features --destination target/site/wallet-sdk-ts", | ||
"check:deps": "npm-check --skip-unused" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/input-output-hk/atala-prism-wallet-sdk-ts-e2e.git" | ||
}, | ||
"author": "Allain Magyar", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/amagyar-iohk/atala-prism-wallet-sdk-ts-e2e/issues" | ||
}, | ||
"homepage": "https://github.com/amagyar-iohk/atala-prism-wallet-sdk-ts-e2e#readme", | ||
"dependencies": { | ||
"@cucumber/cucumber": "^9.3.0", | ||
"@input-output-hk/atala-prism-wallet-sdk": "^2.0.3", | ||
"@input-output-hk/prism-typescript-client": "^1.9.2", | ||
"@serenity-js/assertions": "^3.8.0", | ||
"@serenity-js/console-reporter": "^3.8.0", | ||
"@serenity-js/core": "3.8.0", | ||
"@serenity-js/cucumber": "3.8.0", | ||
"@serenity-js/rest": "3.8.0", | ||
"@serenity-js/serenity-bdd": "3.8.0", | ||
"@types/node": "^20.4.7", | ||
"axios": "^1.3.5", | ||
"dotenv": "^16.3.1", | ||
"npm-check": "^6.0.1", | ||
"rimraf": "^5.0.0", | ||
"sql.js": "^1.8.0", | ||
"sqlite3": "^5.1.6", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6" | ||
} | ||
} |
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,19 @@ | ||
import { Expectation } from "@serenity-js/core" | ||
|
||
export class Expectations { | ||
static propertyValueToBe = (propertyValue: (actual: any) => string, expected: string) => { | ||
return Expectation.define( | ||
`propertyValueEqualTo`, 'contain a specified attribute value equal to', | ||
(actual: any, expected: string) => { | ||
return propertyValue(actual) == expected | ||
} | ||
)(expected) | ||
} | ||
|
||
static equalsTo = Expectation.define( | ||
'isEqualTo', 'is equal to', | ||
(actual: number, expected: number) => | ||
actual === expected, | ||
) | ||
|
||
} |
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,18 @@ | ||
import { Question, QuestionAdapter } from "@serenity-js/core" | ||
import { GetRequest, LastResponse, Send } from "@serenity-js/rest" | ||
|
||
export class Questions { | ||
static httpGet<T = any>(url: string): QuestionAdapter<T> { | ||
return Question.about('get response body', async actor => { | ||
const request = Send.a(GetRequest.to(url)) | ||
await request.performAs(actor) | ||
return await actor.answer(LastResponse.body()) | ||
}) | ||
} | ||
|
||
static getArraySize(description: string, array: any[]): QuestionAdapter<number> { | ||
return Question.about(description, async actor => { | ||
return await actor.answer(array.length) | ||
}) | ||
} | ||
} |
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,10 @@ | ||
import { appendFile } from "fs"; | ||
|
||
export class Utils { | ||
static appendToNotes(message: string) { | ||
console.info("Adding to notes:", message) | ||
appendFile("notes", message + "\n", (err) => { | ||
if(err) console.error(err) | ||
}) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
integration-tests/e2e-tests/tests/sdk/environment.variables.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,11 @@ | ||
import {configDotenv} from "dotenv"; | ||
|
||
configDotenv() | ||
|
||
export class EnvironmentVariables { | ||
public static oobUrl: string = process.env.MEDIATOR_OOB_URL! | ||
public static agentUrl: string = process.env.PRISM_AGENT_URL! | ||
public static publishedDid: string = process.env.PUBLISHED_DID! | ||
public static schemaId: string = process.env.SCHEMA_ID! | ||
public static apiKey: string | undefined = process.env.APIKEY | ||
} |
8 changes: 8 additions & 0 deletions
8
integration-tests/e2e-tests/tests/sdk/features/CreateConnection.feature
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,8 @@ | ||
Feature: Create connection | ||
The Edge Agent should be able to create a connection to prism-agent | ||
|
||
Scenario: Create connection | ||
Given Cloud Agent has a connection invitation | ||
And Cloud Agent shares invitation to Edge Agent | ||
When Edge Agent connects through the invite | ||
Then Cloud Agent should have its status updated |
14 changes: 14 additions & 0 deletions
14
integration-tests/e2e-tests/tests/sdk/features/Credential.feature
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,14 @@ | ||
Feature: Credential | ||
The Edge Agent should be able to receive a credential from Cloud Agent and respond to a proof-of-request | ||
|
||
Scenario: Accept credential and respond to present-proof | ||
Given Cloud Agent is connected to Edge Agent | ||
When Cloud Agent offers a credential | ||
Then Edge Agent should receive the credential | ||
When Edge Agent accepts the credential | ||
And Cloud Agent should see the credential was accepted | ||
Then Edge Agent wait to receive an issued credential | ||
And Edge Agent process the issued credential | ||
When Cloud Agent asks for present-proof | ||
And Edge Agent sends the present-proof | ||
Then Cloud Agent should see the present-proof is verified |
Oops, something went wrong.