@mojaloop/ml-testing-toolkit-client-lib 1.0.0 → 1.1.0-snapshot.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,23 +11,23 @@ The **Mojaloop Testing Toolkit CLI** is a command line client for connecting to
11
11
 
12
12
  **Table of Contents**
13
13
 
14
- 1. [Getting Started](#1-getting-started)
15
-
16
- 1.1. [Installation](#11-installation)
17
-
18
- 1.2. [Usage](#12-usage)
19
-
20
- 2. [Command Reference](#2-command-reference)
21
-
22
- 2.1. [Help screen](#21-help-screen)
23
-
24
- 2.2. [Monitoring Mode](#22-monitoring-mode)
25
-
26
- 2.3. [Outbound Mode](#23-outbound-mode)
27
-
28
- 2.4. [AWS S3 Upload](#24-aws-s3-upload)
29
-
30
- 2.5. [Slack Notification](#25-slack-notification)
14
+ - [Mojaloop Testing Toolkit Client Library and Tools](#mojaloop-testing-toolkit-client-library-and-tools)
15
+ - [Testing Toolkit Command Line Client](#testing-toolkit-command-line-client)
16
+ - [1. Getting Started](#1-getting-started)
17
+ - [1.1 Installation](#11-installation)
18
+ - [1.2 Usage](#12-usage)
19
+ - [2. Command Reference](#2-command-reference)
20
+ - [2.1 Help screen](#21-help-screen)
21
+ - [2.2 Monitoring Mode](#22-monitoring-mode)
22
+ - [2.3 Outbound Mode](#23-outbound-mode)
23
+ - [Default values](#default-values)
24
+ - [Exit codes](#exit-codes)
25
+ - [Example](#example)
26
+ - [2.4 AWS S3 Upload](#24-aws-s3-upload)
27
+ - [2.5 Slack Notification](#25-slack-notification)
28
+ - [Auditing Dependencies](#auditing-dependencies)
29
+ - [Container Scans](#container-scans)
30
+ - [Automated Releases](#automated-releases)
31
31
 
32
32
  ### 1. Getting Started
33
33
 
@@ -80,6 +80,8 @@ Options:
80
80
  -u, --base-url <baseUrl> default: "http://localhost:5050"
81
81
  -i, --input-files <inputFiles> csv list of json files or directories; required when the mode is "outbound" --- supported formats: "json"
82
82
  -e, --environment-file <environmentFile> required when the mode is "outbound" --- supported formats: "json"
83
+ -s, --save-report <saveReport> To save the report on TTK backend server. default: false --- supported values: "false/true"
84
+ --save-report-base-url <saveReportBaseUrl> Incase if the base-url is not accessible publicly, this option replaces the base URL in the report URLs published in console log and slack messages default: same as base-url
83
85
  --report-format <reportFormat> default: "json" --- supported formats: "json", "html", "printhtml"
84
86
  --report-auto-filename-enable <reportAutoFilenameEnable> default: false, if true the file name will be generated by the backend
85
87
  --report-target <reportTarget> default: "file://<file_name_genrated_by_backend>" --- supported targets: "file://path_to_file", "s3://<bucket_name>[/<file_path>]"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mojaloop/ml-testing-toolkit-client-lib",
3
3
  "description": "Testing Toolkit Client Library",
4
- "version": "1.0.0",
4
+ "version": "1.1.0-snapshot.1",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Vijaya Kumar Guthi, ModusBox Inc. ",
7
7
  "contributors": [
@@ -61,16 +61,16 @@
61
61
  "snapshot": "npx standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'"
62
62
  },
63
63
  "dependencies": {
64
- "@mojaloop/central-services-logger": "^11.0.1",
64
+ "@mojaloop/central-services-logger": "^11.2.0",
65
65
  "@mojaloop/ml-testing-toolkit-shared-lib": "^13.0.0",
66
66
  "@mojaloop/sdk-standard-components": "17.1.1",
67
67
  "@slack/webhook": "^6.1.0",
68
68
  "atob": "2.1.2",
69
- "aws-sdk": "^2.1183.0",
70
- "axios": "^0.27.2",
71
- "cli-table3": "0.6.2",
72
- "commander": "9.4.0",
73
- "dotenv": "^16.0.1",
69
+ "aws-sdk": "^2.1273.0",
70
+ "axios": "^1.2.1",
71
+ "cli-table3": "0.6.3",
72
+ "commander": "9.4.1",
73
+ "dotenv": "^16.0.3",
74
74
  "fs": "0.0.1-security",
75
75
  "lodash": "^4.17.21",
76
76
  "mv": "^2.1.1",
@@ -81,18 +81,18 @@
81
81
  "rc": "1.2.8",
82
82
  "request": "^2.88.2",
83
83
  "request-promise-native": "1.0.8",
84
- "socket.io-client": "^4.5.1"
84
+ "socket.io-client": "^4.5.4"
85
85
  },
86
86
  "devDependencies": {
87
- "audit-ci": "^6.3.0",
88
- "jest": "^28.1.3",
89
- "jest-junit": "^14.0.0",
90
- "npm-check-updates": "16.0.1",
87
+ "audit-ci": "^6.4.0",
88
+ "jest": "^29.3.1",
89
+ "jest-junit": "^15.0.0",
90
+ "npm-check-updates": "16.5.6",
91
91
  "nyc": "^15.1.0",
92
92
  "parse-strings-in-object": "1.6.0",
93
93
  "pre-commit": "1.2.2",
94
- "replace": "^1.2.1",
95
- "sinon": "14.0.0",
94
+ "replace": "^1.2.2",
95
+ "sinon": "15.0.0",
96
96
  "standard": "^17.0.0",
97
97
  "standard-version": "^9.5.0"
98
98
  },
package/src/client.js CHANGED
@@ -33,6 +33,8 @@ program
33
33
  .option('-e, --environment-file <environmentFile>', 'required when the mode is "outbound" --- supported formats: "json"')
34
34
  .option('-l, --log-level <logLevel>', 'default: 0 --- supported levels: "0-Show only requests and assertion counts, 1-Show failed assertions only, 2-Show all assertions"')
35
35
  .option('-b, --break-run-on-error <breakRunOnError>', 'default: false --- supported values: "false/true"')
36
+ .option('-s, --save-report <saveReport>', 'To save the report on TTK backend server. default: false --- supported values: "false/true"')
37
+ .option('--save-report-base-url <saveReportBaseUrl>', 'Incase if the base-url is not accessible publicly, this option replaces the base URL in the report URLs published in console log and slack messages default: same as base-url. default: same as base-url')
36
38
  .option('--labels <labels>', 'csv list of labels, examples: "p2p,settlements,quotes"')
37
39
  .option('--report-format <reportFormat>', 'default: "none" --- supported formats: "none", "json", "html", "printhtml"')
38
40
  .option('--report-auto-filename-enable <reportAutoFilenameEnable>', 'default: false, if true the file name will be generated by the backend')
@@ -126,6 +126,7 @@ const sendTemplate = async (sessionId) => {
126
126
  const selectedLabels = config.labels ? config.labels.split(',') : []
127
127
  const template = await TemplateGenerator.generateTemplate(inputFiles, selectedLabels)
128
128
  template.inputValues = JSON.parse(await readFileAsync(config.environmentFile, 'utf8')).inputValues
129
+ template.saveReport = config.saveReport
129
130
 
130
131
  template.test_cases.forEach(testCase => {
131
132
  totalProgress.totalTestCases++
@@ -147,11 +148,24 @@ const sendTemplate = async (sessionId) => {
147
148
  }
148
149
 
149
150
  const handleIncomingProgress = async (progress) => {
151
+ const config = objectStore.get('config')
150
152
  if (progress.status === 'FINISHED') {
151
153
  let passed
152
154
  try {
153
155
  passed = logger.outbound(progress.totalResult)
154
156
  const resultReport = await report.outbound(progress.totalResult)
157
+ // SaveReport status
158
+ if (progress.totalResult.saveReport) {
159
+ if (progress.saveReportStatus?.isSaved) {
160
+ const ttkReportUrl = `${config.saveReportBaseUrl || config.baseURL}/api/history/test-reports/${progress.totalResult.runtimeInformation.testReportId}?format=html`
161
+ console.log(fStr.green(`Report saved on TTK backend server successfully and is available at ${ttkReportUrl}`))
162
+ if (!resultReport.uploadedReportURL) {
163
+ resultReport.uploadedReportURL = ttkReportUrl
164
+ }
165
+ } else if (progress.saveReportStatus && !progress.saveReportStatus.isSaved) {
166
+ console.log(fStr.red(`Report not saved: ${progress.saveReportStatus.message}`))
167
+ }
168
+ }
155
169
  await slackBroadcast.sendSlackNotification(progress.totalResult, resultReport.uploadedReportURL)
156
170
  } catch (err) {
157
171
  console.log(err)
package/src/router.js CHANGED
@@ -35,7 +35,9 @@ const cli = (commanderOptions) => {
35
35
  baseURL: 'http://localhost:5050',
36
36
  logLevel: '0',
37
37
  reportAutoFilenameEnable: false,
38
- breakRunOnError: false
38
+ breakRunOnError: false,
39
+ saveReport: false,
40
+ saveReportBaseUrl: null
39
41
  }
40
42
 
41
43
  if (fs.existsSync(commanderOptions.config)) {
@@ -48,6 +50,8 @@ const cli = (commanderOptions) => {
48
50
  inputFiles: commanderOptions.inputFiles,
49
51
  logLevel: commanderOptions.logLevel || configFile.logLevel,
50
52
  breakRunOnError: commanderOptions.breakRunOnError || configFile.breakRunOnError,
53
+ saveReport: commanderOptions.saveReport || configFile.saveReport,
54
+ saveReportBaseUrl: commanderOptions.saveReportBaseUrl || configFile.saveReportBaseUrl,
51
55
  environmentFile: commanderOptions.environmentFile,
52
56
  reportFormat: commanderOptions.reportFormat || configFile.reportFormat,
53
57
  reportAutoFilenameEnable: commanderOptions.reportAutoFilenameEnable === 'true' || configFile.reportAutoFilenameEnable === true,