-
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.
test: major refactor + retry (#166) Signed-off-by: Francisco Javier R…
…ibó Labrador <[email protected]> Signed-off-by: Francisco Javier Ribo Labrador <[email protected]>
- Loading branch information
1 parent
9a8e3bb
commit 749f4dd
Showing
25 changed files
with
668 additions
and
2,141 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
This file was deleted.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
default: { | ||
format: [ | ||
"@serenity-js/cucumber", | ||
["html", "target/sdk-ts-e2e-results.html"], | ||
], | ||
formatOptions: { | ||
junit: { | ||
suiteName: "E2E: Prism Wallet SDK - TS" | ||
} | ||
}, | ||
requireModule: ["ts-node/register"], | ||
require: [ | ||
"src/**/*.ts" | ||
], | ||
retry: 1 | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
integration-tests/e2e-tests/features/create_connection.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,17 @@ | ||
@connection | ||
Feature: Create connection | ||
The Edge Agent should be able to create a connection to prism-agent | ||
|
||
Scenario Outline: Create connection | ||
Given Cloud Agent has a connection invitation with '<label>', '<goalCode>' and '<goal>' parameters | ||
And Cloud Agent shares invitation to Edge Agent | ||
And Edge Agent connects through the invite | ||
Then Cloud Agent should have the connection status updated to 'ConnectionResponseSent' | ||
Examples: | ||
| label | goalCode | goal | | ||
| alice | automation | automation description | | ||
| | | | | ||
| alice | null | null | | ||
| null | automation | null | | ||
| null | null | automation description | | ||
| null | null | null | |
3 changes: 2 additions & 1 deletion
3
...s/tests/sdk/features/ProvideProof.feature → .../e2e-tests/features/provide_proof.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
4 changes: 3 additions & 1 deletion
4
...tests/tests/sdk/features/Anoncred.feature → ...tures/receive_anoncred_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
4 changes: 3 additions & 1 deletion
4
...sts/tests/sdk/features/Credential.feature → ...s/features/receive_jwt_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
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,37 @@ | ||
import {appendFile, writeFileSync} from "fs" | ||
|
||
export class Utils { | ||
static prepareNotes() { | ||
writeFileSync("notes", "### End-to-end notes:\n\n") | ||
} | ||
|
||
static appendToNotes(message: string) { | ||
console.info("Adding to notes:", message) | ||
appendFile("notes", message + "\n", (err) => { | ||
if(err) console.error(err) | ||
}) | ||
} | ||
|
||
static async repeat(times: number, callback: () => Promise<void>) { | ||
for (let i = 0; i < times; i++) { | ||
await callback() | ||
} | ||
} | ||
|
||
static async retry<T>(times: number, callback: () => Promise<T>) { | ||
let retry = 0 | ||
let delegateError = null | ||
while (retry < times) { | ||
try { | ||
return await callback() | ||
} catch (err) { | ||
Utils.appendToNotes(`Failure: ${err.message}. Trying to run again.`) | ||
delegateError = err | ||
} | ||
retry++ | ||
} | ||
let error = Error(`${delegateError.message} afer retrying [${times}] times`) | ||
error.stack = delegateError.stack | ||
throw 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
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
6 changes: 3 additions & 3 deletions
6
...e-tests/tests/sdk/steps/EdgeAgentSteps.ts → ...sts/e2e-tests/src/steps/EdgeAgentSteps.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
12 changes: 2 additions & 10 deletions
12
...e-tests/tests/sdk/steps/LifecycleSteps.ts → ...sts/e2e-tests/src/steps/LifecycleSteps.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
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
4 changes: 2 additions & 2 deletions
4
...-tests/tests/sdk/src/EdgeAgentWorkflow.ts → ...e-tests/src/workflow/EdgeAgentWorkflow.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
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
integration-tests/e2e-tests/tests/sdk/features/CreateConnection.feature
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.