@dev-blinq/cucumber-js 1.0.71-dev → 1.0.71-stage

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.
Files changed (35) hide show
  1. package/bin/download-install.js +58 -34
  2. package/lib/api/gherkin.js +6 -1
  3. package/lib/api/gherkin.js.map +1 -1
  4. package/lib/configuration/axios_client.js +1 -1
  5. package/lib/configuration/axios_client.js.map +1 -1
  6. package/lib/formatter/api.d.ts +2 -0
  7. package/lib/formatter/api.js +57 -0
  8. package/lib/formatter/api.js.map +1 -0
  9. package/lib/formatter/bvt_analysis_formatter.d.ts +13 -1
  10. package/lib/formatter/bvt_analysis_formatter.js +221 -73
  11. package/lib/formatter/bvt_analysis_formatter.js.map +1 -1
  12. package/lib/formatter/feature_data_format.d.ts +2 -2
  13. package/lib/formatter/feature_data_format.js +52 -7
  14. package/lib/formatter/feature_data_format.js.map +1 -1
  15. package/lib/formatter/helpers/constants.d.ts +50 -0
  16. package/lib/formatter/helpers/constants.js +60 -0
  17. package/lib/formatter/helpers/constants.js.map +1 -0
  18. package/lib/formatter/helpers/report_generator.d.ts +35 -1
  19. package/lib/formatter/helpers/report_generator.js +243 -19
  20. package/lib/formatter/helpers/report_generator.js.map +1 -1
  21. package/lib/formatter/helpers/test_case_attempt_formatter.js +1 -1
  22. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  23. package/lib/formatter/helpers/upload_serivce.d.ts +15 -2
  24. package/lib/formatter/helpers/upload_serivce.js +150 -16
  25. package/lib/formatter/helpers/upload_serivce.js.map +1 -1
  26. package/lib/formatter/helpers/uploader.d.ts +2 -1
  27. package/lib/formatter/helpers/uploader.js +64 -5
  28. package/lib/formatter/helpers/uploader.js.map +1 -1
  29. package/lib/runtime/test_case_runner.d.ts +1 -0
  30. package/lib/runtime/test_case_runner.js +10 -1
  31. package/lib/runtime/test_case_runner.js.map +1 -1
  32. package/lib/version.d.ts +1 -1
  33. package/lib/version.js +1 -1
  34. package/lib/version.js.map +1 -1
  35. package/package.json +3 -2
@@ -1,10 +1,13 @@
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ /* eslint-disable no-console */
3
+ /* eslint-disable no-undef */
1
4
  const { argv } = require('node:process')
2
5
  const fs = require('fs')
3
6
  const path = require('path')
4
7
  const JSZip = require('jszip')
5
8
  const { mkdirSync, writeFileSync } = require('node:fs')
6
9
  const axios = require('axios').default
7
- const tunnel = require('tunnel');
10
+ const tunnel = require('tunnel')
8
11
 
9
12
  let token = null
10
13
  let extractPath = null
@@ -14,19 +17,50 @@ const getSSoUrl = () => {
14
17
  return 'http://localhost:5000/api/auth'
15
18
  case 'dev':
16
19
  return 'https://dev.api.blinq.io/api/auth'
17
- default:
20
+ case 'stage':
21
+ return 'https://stage.api.blinq.io/api/auth'
22
+ case 'prod':
23
+ return 'https://api.blinq.io/api/auth'
24
+ case null:
18
25
  return 'https://api.blinq.io/api/auth'
26
+ default:
27
+ return `${process.env.NODE_ENV_BLINQ}/api/auth`
19
28
  }
20
29
  }
21
30
 
31
+ const getProxy = () => {
32
+ if (!process.env.PROXY) {
33
+ return null
34
+ }
35
+
36
+ const proxy = process.env.PROXY
37
+ const url = new URL(proxy)
38
+ const proxyObject = {
39
+ host: url.hostname,
40
+ port: Number(url.port),
41
+ }
42
+
43
+ const { username, password } = url
44
+
45
+ if (username && password) {
46
+ proxyObject.proxyAuth = `${username}:${password}`
47
+ }
48
+ return tunnel.httpsOverHttp({ proxy: proxyObject })
49
+ }
22
50
  const getWorkSpaceUrl = () => {
23
51
  switch (process.env.NODE_ENV_BLINQ) {
24
52
  case 'local':
25
53
  return 'http://localhost:6000/api/workspace'
26
54
  case 'dev':
27
55
  return 'https://dev.api.blinq.io/api/workspace'
28
- default:
56
+ case "stage":
57
+ return 'https://stage.api.blinq.io/api/workspace'
58
+ case 'prod':
59
+ return 'https://api.blinq.io/api/workspace'
60
+ case null:
29
61
  return 'https://api.blinq.io/api/workspace'
62
+ default:
63
+ return `${process.env.NODE_ENV_BLINQ}/api/workspace`
30
64
  }
31
65
  }
32
66
 
@@ -79,26 +113,31 @@ const dirExists = (path) => {
79
113
  }
80
114
  const ssoUrl = getSSoUrl()
81
115
 
116
+ const getProjectByAccessKey = async (access_key) => {
117
+ const accessKeyUrl = `${ssoUrl}/getProjectByAccessKey`
118
+ const response = await axios.post(accessKeyUrl, {
119
+ access_key,
120
+ httpAgent: getProxy(),
121
+ proxy: false,
122
+ })
123
+ if (response.status !== 200) {
124
+ console.error('Error: Invalid access key')
125
+ process.exit(1)
126
+ }
127
+ return response.data
128
+ };
129
+
82
130
  const downloadAndInstall = async (extractPath, token) => {
83
131
  if (!dirExists(extractPath)) {
84
132
  fs.mkdirSync(extractPath, { recursive: true })
85
133
  }
86
134
  try {
87
- const accessKeyUrl = `${ssoUrl}/getProjectByAccessKey`
88
- const response = await axios.post(accessKeyUrl, {
89
- access_key: token,
90
- httpAgent: getProxy(),
91
- proxy: false,
92
- })
93
- if(response.status !== 200){
94
- console.error('Error: Invalid access key')
95
- process.exit(1)
96
- }
135
+ const data = await getProjectByAccessKey(token)
97
136
 
98
137
  const workspaceUrl = getWorkSpaceUrl() + '/pull-workspace'
99
138
  const res = await axios.get(workspaceUrl, {
100
139
  params: {
101
- projectId: response.data.project._id,
140
+ projectId: data.project._id,
102
141
  },
103
142
  httpAgent: getProxy(),
104
143
  proxy: false,
@@ -109,6 +148,11 @@ const downloadAndInstall = async (extractPath, token) => {
109
148
  },
110
149
  })
111
150
 
151
+ if (res.status !== 200) {
152
+ console.error('Error: Unable to fetch workspace')
153
+ process.exit(1)
154
+ }
155
+
112
156
  const zip = await JSZip.loadAsync(res.data)
113
157
  for (const filename of Object.keys(zip.files)) {
114
158
  const fileData = zip.files[filename]
@@ -129,23 +173,3 @@ const downloadAndInstall = async (extractPath, token) => {
129
173
  downloadAndInstall(extractPath, token).then(() =>
130
174
  console.log('Download completed!')
131
175
  )
132
-
133
- const getProxy = () => {
134
- if (!process.env.PROXY) {
135
- return null
136
- }
137
-
138
- const proxy = process.env.PROXY
139
- const url = new URL(proxy)
140
- const proxyObject = {
141
- host: url.hostname,
142
- port: Number(url.port),
143
- }
144
-
145
- const { username, password } = url
146
-
147
- if (username && password) {
148
- proxyObject.proxyAuth = `${username}:${password}`
149
- }
150
- return tunnel.httpsOverHttp({ proxy: proxyObject })
151
- }
@@ -9,6 +9,7 @@ const gherkin_utils_1 = require("@cucumber/gherkin-utils");
9
9
  const pickle_filter_1 = __importDefault(require("../pickle_filter"));
10
10
  const helpers_1 = require("../cli/helpers");
11
11
  const feature_data_format_1 = require("../formatter/feature_data_format");
12
+ const node_path_1 = __importDefault(require("node:path"));
12
13
  async function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeaturePaths, featurePaths, coordinates, onEnvelope, }) {
13
14
  const gherkinQuery = new gherkin_utils_1.Query();
14
15
  const parseErrors = [];
@@ -16,6 +17,10 @@ async function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeatu
16
17
  let dataFunction = null;
17
18
  let functionVars = null;
18
19
  let mjsDataFiles = null;
20
+ let projectDir = process.cwd();
21
+ if (featurePaths.length > 0) {
22
+ projectDir = node_path_1.default.join(node_path_1.default.dirname(featurePaths[0]), '..', '..');
23
+ }
19
24
  await gherkinFromPaths(featurePaths, {
20
25
  newId,
21
26
  relativeTo: cwd,
@@ -30,7 +35,7 @@ async function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeatu
30
35
  newDataAfterExamplesModify = newData;
31
36
  mjsDataFiles = mjsData;
32
37
  }
33
- const data = (0, feature_data_format_1.generateTestData)(newDataAfterExamplesModify);
38
+ const data = (0, feature_data_format_1.generateTestData)(newDataAfterExamplesModify, undefined, undefined, projectDir);
34
39
  envelope.source.data = data.newContent;
35
40
  variables = data.variables;
36
41
  fakeData = data.otherFakeData;
@@ -1 +1 @@
1
- {"version":3,"file":"gherkin.js","sourceRoot":"","sources":["../../src/api/gherkin.ts"],"names":[],"mappings":";;;;;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AAM,CAAC,GAAG,CAAC,CAAA;QACxC,OAAO,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAA;IAC1D,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACd,MAAM,eAAe,GAAG,YAAY;aACjC,mBAAmB,EAAE;aACrB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,CAAA;QACxC,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,CACvC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAChD,CAAA;QACD,OAAO;YACL,eAAe;YACf,QAAQ;YACR,MAAM;SACP,CAAA;IACH,CAAC,CAAC,CAAA;IACJ,IAAA,sBAAY,EAAC,eAAe,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACxD,OAAO;QACL,eAAe;QACf,WAAW;KACZ,CAAA;AACH,CAAC;AAzLD,kEAyLC;AAED,KAAK,UAAU,gBAAgB,CAC7B,KAAe,EACf,OAA8B,EAC9B,UAAwC;IAExC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,oBAAoB,GAAG,gCAAc,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACrE,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAC3C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACvC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n GherkinStreams,\n IGherkinStreamOptions,\n} from '@cucumber/gherkin-streams'\nimport {\n Envelope,\n GherkinDocument,\n IdGenerator,\n Location,\n ParseError,\n Pickle,\n} from '@cucumber/messages'\nimport { Query as GherkinQuery } from '@cucumber/gherkin-utils'\nimport PickleFilter from '../pickle_filter'\nimport { orderPickles } from '../cli/helpers'\nimport { ISourcesCoordinates } from './types'\nimport { ILogger } from '../logger'\nimport {\n generateExamplesFromFunction,\n generateTestData,\n generateExamplesFromFunctionGherkin,\n} from '../formatter/feature_data_format'\n\ninterface PickleWithDocument {\n gherkinDocument: GherkinDocument\n location: Location\n pickle: Pickle\n}\n\ninterface FunctionVars {\n previous: {\n header: string\n value: any\n }[]\n new: {\n header: string\n value: any\n }[]\n}\n\nexport async function getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates,\n onEnvelope,\n}: {\n newId: IdGenerator.NewId\n cwd: string\n logger: ILogger\n unexpandedFeaturePaths: string[]\n featurePaths: string[]\n coordinates: ISourcesCoordinates\n onEnvelope?: (envelope: Envelope) => void\n}): Promise<{\n filteredPickles: PickleWithDocument[]\n parseErrors: ParseError[]\n}> {\n const gherkinQuery = new GherkinQuery()\n const parseErrors: ParseError[] = []\n let variables: any,\n fakeData: {\n var: string\n fake: string\n }[],\n pickleIndex = 0\n let dataFunction: string | null = null\n let functionVars: FunctionVars | null = null\n let mjsDataFiles: any = null\n\n await gherkinFromPaths(\n featurePaths,\n {\n newId,\n relativeTo: cwd,\n defaultDialect: coordinates.defaultDialect,\n },\n (envelope) => {\n if (envelope.source) {\n let newDataAfterExamplesModify = envelope.source.data\n const functionMatch = envelope.source.data.match(\n /@data:function:(.*?)\\.(.*)/\n )\n\n if (functionMatch) {\n dataFunction = functionMatch[2]\n const { newData, mjsData } = generateExamplesFromFunction(\n envelope.source.data,\n featurePaths[0],\n dataFunction,\n functionMatch[1]\n )\n newDataAfterExamplesModify = newData\n mjsDataFiles = mjsData\n }\n\n const data = generateTestData(newDataAfterExamplesModify)\n envelope.source.data = data.newContent\n variables = data.variables\n fakeData = data.otherFakeData\n }\n\n if (envelope.gherkinDocument && envelope.gherkinDocument.feature) {\n envelope.gherkinDocument.feature.children =\n envelope.gherkinDocument.feature.children.map((scenario) => {\n if (scenario.scenario) {\n if (dataFunction) {\n const { tableHeader, tableBody } = scenario.scenario.examples[0]\n\n functionVars = {\n previous: tableHeader.cells.map((cell, index) => ({\n header: cell.value,\n value: tableBody[0].cells[index].value,\n })),\n new: [],\n }\n\n const generateResult = generateExamplesFromFunctionGherkin(\n tableHeader.cells,\n tableBody[0].cells,\n mjsDataFiles\n )\n\n functionVars.new = generateResult\n\n generateResult.map(\n ({ value }, index) =>\n (scenario.scenario.examples[0].tableBody[0].cells[\n index\n ].value = value)\n )\n }\n let fakeDataIdx = 0\n scenario.scenario.examples.forEach((example) => {\n example.tableBody.forEach((row) => {\n row.cells.forEach((cell, index) => {\n if (\n fakeDataIdx < fakeData.length &&\n fakeData[fakeDataIdx].var === cell.value\n ) {\n cell.value = fakeData[fakeDataIdx].fake\n fakeDataIdx++\n }\n })\n })\n })\n scenario.scenario.steps = scenario.scenario.steps.map((step) => {\n step.text = generateTestData(\n step.text,\n variables,\n fakeData\n ).newContent\n return step\n })\n }\n return scenario\n })\n }\n\n if (envelope.pickle) {\n envelope.pickle.steps = envelope.pickle.steps.map((step) => {\n if (functionVars) {\n functionVars.new.forEach(({ value }, index) => {\n step.text = step.text.replace(\n functionVars.previous[index].value,\n value\n )\n })\n }\n const generateData = generateTestData(step.text, variables, fakeData)\n step.text = generateData.newContent\n pickleIndex =\n generateData.fakeIndex > pickleIndex\n ? generateData.fakeIndex\n : pickleIndex\n return step\n })\n\n for (let i = 0; i < pickleIndex; i++) {\n fakeData.shift()\n }\n pickleIndex = 0\n }\n\n gherkinQuery.update(envelope)\n if (envelope.parseError) {\n parseErrors.push(envelope.parseError)\n }\n onEnvelope?.(envelope)\n }\n )\n const pickleFilter = new PickleFilter({\n cwd,\n featurePaths: unexpandedFeaturePaths,\n names: coordinates.names,\n tagExpression: coordinates.tagExpression,\n })\n const filteredPickles: PickleWithDocument[] = gherkinQuery\n .getPickles()\n .filter((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n return pickleFilter.matches({ gherkinDocument, pickle })\n })\n .map((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n const location = gherkinQuery.getLocation(\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n )\n return {\n gherkinDocument,\n location,\n pickle,\n }\n })\n orderPickles(filteredPickles, coordinates.order, logger)\n return {\n filteredPickles,\n parseErrors,\n }\n}\n\nasync function gherkinFromPaths(\n paths: string[],\n options: IGherkinStreamOptions,\n onEnvelope: (envelope: Envelope) => void\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const gherkinMessageStream = GherkinStreams.fromPaths(paths, options)\n gherkinMessageStream.on('data', onEnvelope)\n gherkinMessageStream.on('end', resolve)\n gherkinMessageStream.on('error', reject)\n })\n}\n"]}
1
+ {"version":3,"file":"gherkin.js","sourceRoot":"","sources":["../../src/api/gherkin.ts"],"names":[],"mappings":";;;;;;AAAA,+DAGkC;AASlC,2DAA+D;AAC/D,qEAA2C;AAC3C,4CAA6C;AAG7C,0EAIyC;AACzC,0DAA4B;AAkBrB,KAAK,UAAU,2BAA2B,CAAC,EAChD,KAAK,EACL,GAAG,EACH,MAAM,EACN,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,UAAU,GASX;IAIC,MAAM,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAA;IACvC,MAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,IAAI,SAAc,EAChB,QAGG,EACH,WAAW,GAAG,CAAC,CAAA;IACjB,IAAI,YAAY,GAAkB,IAAI,CAAA;IACtC,IAAI,YAAY,GAAwB,IAAI,CAAA;IAC5C,IAAI,YAAY,GAAQ,IAAI,CAAA;IAC5B,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IAC9B,IAAI,YAAY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EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,CAAA;QACxC,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,CACvC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAChD,CAAA;QACD,OAAO;YACL,eAAe;YACf,QAAQ;YACR,MAAM;SACP,CAAA;IACH,CAAC,CAAC,CAAA;IACJ,IAAA,sBAAY,EAAC,eAAe,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACxD,OAAO;QACL,eAAe;QACf,WAAW;KACZ,CAAA;AACH,CAAC;AAjMD,kEAiMC;AAED,KAAK,UAAU,gBAAgB,CAC7B,KAAe,EACf,OAA8B,EAC9B,UAAwC;IAExC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,oBAAoB,GAAG,gCAAc,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACrE,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAC3C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACvC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n GherkinStreams,\n IGherkinStreamOptions,\n} from '@cucumber/gherkin-streams'\nimport {\n Envelope,\n GherkinDocument,\n IdGenerator,\n Location,\n ParseError,\n Pickle,\n} from '@cucumber/messages'\nimport { Query as GherkinQuery } from '@cucumber/gherkin-utils'\nimport PickleFilter from '../pickle_filter'\nimport { orderPickles } from '../cli/helpers'\nimport { ISourcesCoordinates } from './types'\nimport { ILogger } from '../logger'\nimport {\n generateExamplesFromFunction,\n generateTestData,\n generateExamplesFromFunctionGherkin,\n} from '../formatter/feature_data_format'\nimport path from 'node:path'\ninterface PickleWithDocument {\n gherkinDocument: GherkinDocument\n location: Location\n pickle: Pickle\n}\n\ninterface FunctionVars {\n previous: {\n header: string\n value: any\n }[]\n new: {\n header: string\n value: any\n }[]\n}\n\nexport async function getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates,\n onEnvelope,\n}: {\n newId: IdGenerator.NewId\n cwd: string\n logger: ILogger\n unexpandedFeaturePaths: string[]\n featurePaths: string[]\n coordinates: ISourcesCoordinates\n onEnvelope?: (envelope: Envelope) => void\n}): Promise<{\n filteredPickles: PickleWithDocument[]\n parseErrors: ParseError[]\n}> {\n const gherkinQuery = new GherkinQuery()\n const parseErrors: ParseError[] = []\n let variables: any,\n fakeData: {\n var: string\n fake: string\n }[],\n pickleIndex = 0\n let dataFunction: string | null = null\n let functionVars: FunctionVars | null = null\n let mjsDataFiles: any = null\n let projectDir = process.cwd()\n if (featurePaths.length > 0) {\n projectDir = path.join(path.dirname(featurePaths[0]), '..', '..')\n }\n await gherkinFromPaths(\n featurePaths,\n {\n newId,\n relativeTo: cwd,\n defaultDialect: coordinates.defaultDialect,\n },\n (envelope) => {\n if (envelope.source) {\n let newDataAfterExamplesModify = envelope.source.data\n const functionMatch = envelope.source.data.match(\n /@data:function:(.*?)\\.(.*)/\n )\n\n if (functionMatch) {\n dataFunction = functionMatch[2]\n const { newData, mjsData } = generateExamplesFromFunction(\n envelope.source.data,\n featurePaths[0],\n dataFunction,\n functionMatch[1]\n )\n newDataAfterExamplesModify = newData\n mjsDataFiles = mjsData\n }\n\n const data = generateTestData(\n newDataAfterExamplesModify,\n undefined,\n undefined,\n projectDir\n )\n envelope.source.data = data.newContent\n variables = data.variables\n fakeData = data.otherFakeData\n }\n\n if (envelope.gherkinDocument && envelope.gherkinDocument.feature) {\n envelope.gherkinDocument.feature.children =\n envelope.gherkinDocument.feature.children.map((scenario) => {\n if (scenario.scenario) {\n if (dataFunction) {\n const { tableHeader, tableBody } = scenario.scenario.examples[0]\n\n functionVars = {\n previous: tableHeader.cells.map((cell, index) => ({\n header: cell.value,\n value: tableBody[0].cells[index].value,\n })),\n new: [],\n }\n\n const generateResult = generateExamplesFromFunctionGherkin(\n tableHeader.cells,\n tableBody[0].cells,\n mjsDataFiles\n )\n\n functionVars.new = generateResult\n\n generateResult.map(\n ({ value }, index) =>\n (scenario.scenario.examples[0].tableBody[0].cells[\n index\n ].value = value)\n )\n }\n let fakeDataIdx = 0\n scenario.scenario.examples.forEach((example) => {\n example.tableBody.forEach((row) => {\n row.cells.forEach((cell, index) => {\n if (\n fakeDataIdx < fakeData.length &&\n fakeData[fakeDataIdx].var === cell.value\n ) {\n cell.value = fakeData[fakeDataIdx].fake\n fakeDataIdx++\n }\n })\n })\n })\n scenario.scenario.steps = scenario.scenario.steps.map((step) => {\n step.text = generateTestData(\n step.text,\n variables,\n fakeData\n ).newContent\n return step\n })\n }\n return scenario\n })\n }\n\n if (envelope.pickle) {\n envelope.pickle.steps = envelope.pickle.steps.map((step) => {\n if (functionVars) {\n functionVars.new.forEach(({ value }, index) => {\n step.text = step.text.replace(\n functionVars.previous[index].value,\n value\n )\n })\n }\n const generateData = generateTestData(step.text, variables, fakeData)\n step.text = generateData.newContent\n pickleIndex =\n generateData.fakeIndex > pickleIndex\n ? generateData.fakeIndex\n : pickleIndex\n return step\n })\n\n for (let i = 0; i < pickleIndex; i++) {\n fakeData.shift()\n }\n pickleIndex = 0\n }\n\n gherkinQuery.update(envelope)\n if (envelope.parseError) {\n parseErrors.push(envelope.parseError)\n }\n onEnvelope?.(envelope)\n }\n )\n const pickleFilter = new PickleFilter({\n cwd,\n featurePaths: unexpandedFeaturePaths,\n names: coordinates.names,\n tagExpression: coordinates.tagExpression,\n })\n const filteredPickles: PickleWithDocument[] = gherkinQuery\n .getPickles()\n .filter((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n return pickleFilter.matches({ gherkinDocument, pickle })\n })\n .map((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n const location = gherkinQuery.getLocation(\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n )\n return {\n gherkinDocument,\n location,\n pickle,\n }\n })\n orderPickles(filteredPickles, coordinates.order, logger)\n return {\n filteredPickles,\n parseErrors,\n }\n}\n\nasync function gherkinFromPaths(\n paths: string[],\n options: IGherkinStreamOptions,\n onEnvelope: (envelope: Envelope) => void\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const gherkinMessageStream = GherkinStreams.fromPaths(paths, options)\n gherkinMessageStream.on('data', onEnvelope)\n gherkinMessageStream.on('end', resolve)\n gherkinMessageStream.on('error', reject)\n })\n}\n"]}
@@ -27,7 +27,7 @@ const createAxiosClient = () => {
27
27
  try {
28
28
  const agent = getProxy();
29
29
  return axios_1.default.create({
30
- httpAgent: agent,
30
+ httpsAgent: agent,
31
31
  proxy: false,
32
32
  });
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"axios_client.js","sourceRoot":"","sources":["../../src/configuration/axios_client.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA+B;AAC/B,kDAAyB;AACzB,oDAA6C;AAG7C,MAAM,QAAQ,GAAG,GAAiB,EAAE;IAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;QACtB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,KAAK,GAAkB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;IAC9C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IAC1B,MAAM,WAAW,GAAiB;QAChC,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;KACvB,CAAA;IAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAA;IAElC,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,WAAW,CAAC,SAAS,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAA;KAClD;IACD,OAAO,gBAAM,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;AACrD,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC7B,IAAI;QACF,MAAM,KAAK,GAAmB,QAAQ,EAAE,CAAA;QACxC,OAAO,eAAK,CAAC,MAAM,CAAC;YAClB,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,KAAK;SACb,CAAC,CAAA;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC1B,MAAM,IAAI,KAAK,CACb,+BACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAC1D,EAAE,CACH,CAAA;KACF;AACH,CAAC,CAAA;AAEY,QAAA,WAAW,GAAG,iBAAiB,EAAE,CAAA","sourcesContent":["/* eslint-disable no-console */\nimport axios from 'axios'\nimport tunnel, { ProxyOptions } from 'tunnel'\nimport { Agent } from 'http'\n\nconst getProxy = (): Agent | null => {\n if (!process.env.PROXY) {\n return null\n }\n\n const proxy: string | null = process.env.PROXY\n const url = new URL(proxy)\n const proxyObject: ProxyOptions = {\n host: url.hostname,\n port: Number(url.port),\n }\n\n const { username, password } = url\n\n if (username && password) {\n proxyObject.proxyAuth = `${username}:${password}`\n }\n return tunnel.httpsOverHttp({ proxy: proxyObject })\n}\n\nconst createAxiosClient = () => {\n try {\n const agent: string | Agent = getProxy()\n return axios.create({\n httpAgent: agent,\n proxy: false,\n })\n } catch (error) {\n console.log(error.message)\n throw new Error(\n `Error creating axios client ${\n error instanceof Error ? error.message : error.response.data\n }`\n )\n }\n}\n\nexport const axiosClient = createAxiosClient()\n"]}
1
+ {"version":3,"file":"axios_client.js","s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BAAiB,EAAE,CAAA","sourcesContent":["/* eslint-disable no-console */\nimport axios from 'axios'\nimport tunnel, { ProxyOptions } from 'tunnel'\nimport { Agent } from 'http'\n\nconst getProxy = (): Agent | null => {\n if (!process.env.PROXY) {\n return null\n }\n\n const proxy: string | null = process.env.PROXY\n const url = new URL(proxy)\n const proxyObject: ProxyOptions = {\n host: url.hostname,\n port: Number(url.port),\n }\n\n const { username, password } = url\n\n if (username && password) {\n proxyObject.proxyAuth = `${username}:${password}`\n }\n return tunnel.httpsOverHttp({ proxy: proxyObject })\n}\n\nconst createAxiosClient = () => {\n try {\n const agent: string | Agent = getProxy()\n return axios.create({\n httpsAgent: agent,\n proxy: false,\n })\n } catch (error) {\n console.log(error.message)\n throw new Error(\n `Error creating axios client ${\n error instanceof Error ? error.message : error.response.data\n }`\n )\n }\n}\n\nexport const axiosClient = createAxiosClient()\n"]}
@@ -0,0 +1,2 @@
1
+ declare const getProjectByAccessKey: (access_key: string) => Promise<any>;
2
+ export { getProjectByAccessKey };
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getProjectByAccessKey = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const tunnel_1 = __importDefault(require("tunnel"));
9
+ const getSSoUrl = () => {
10
+ switch (process.env.NODE_ENV_BLINQ) {
11
+ case 'local':
12
+ return 'http://localhost:5000/api/auth';
13
+ case 'dev':
14
+ return 'https://dev.api.blinq.io/api/auth';
15
+ case 'stage':
16
+ return 'https://stage.api.blinq.io/api/auth';
17
+ case 'prod':
18
+ return 'https://api.blinq.io/api/auth';
19
+ case null:
20
+ return 'https://api.blinq.io/api/auth';
21
+ default:
22
+ return `${process.env.NODE_ENV_BLINQ}/api/auth`;
23
+ }
24
+ };
25
+ const getProxy = () => {
26
+ if (!process.env.PROXY) {
27
+ return null;
28
+ }
29
+ const proxy = process.env.PROXY;
30
+ const url = new URL(proxy);
31
+ const proxyObject = {
32
+ host: url.hostname,
33
+ port: Number(url.port),
34
+ };
35
+ const { username, password } = url;
36
+ if (username && password) {
37
+ //@ts-ignore
38
+ proxyObject.proxyAuth = `${username}:${password}`;
39
+ }
40
+ return tunnel_1.default.httpsOverHttp({ proxy: proxyObject });
41
+ };
42
+ const getProjectByAccessKey = async (access_key) => {
43
+ const ssoUrl = getSSoUrl();
44
+ const accessKeyUrl = `${ssoUrl}/getProjectByAccessKey`;
45
+ const response = await axios_1.default.post(accessKeyUrl, {
46
+ access_key,
47
+ httpAgent: getProxy(),
48
+ proxy: false,
49
+ });
50
+ if (response.status !== 200) {
51
+ console.error('Error: Invalid access key');
52
+ process.exit(1);
53
+ }
54
+ return response.data;
55
+ };
56
+ exports.getProjectByAccessKey = getProjectByAccessKey;
57
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/formatter/api.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,oDAA2B;AAE3B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;QAClC,KAAK,OAAO;YACV,OAAO,gCAAgC,CAAA;QACzC,KAAK,KAAK;YACR,OAAO,mCAAmC,CAAA;QAC5C,KAAK,OAAO;YACV,OAAO,qCAAqC,CAAA;QAC9C,KAAK,MAAM;YACT,OAAO,+BAA+B,CAAA;QACxC,KAAK,IAAI;YACP,OAAO,+BAA+B,CAAA;QACxC;YACE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,WAAW,CAAA;KAClD;AACH,CAAC,CAAA;AACD,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;QACtB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;IAC/B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IAC1B,MAAM,WAAW,GAAG;QAClB,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;KACvB,CAAA;IAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAA;IAElC,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,YAAY;QACZ,WAAW,CAAC,SAAS,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAA;KAClD;IACD,OAAO,gBAAM,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;AACrD,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,KAAK,EAAE,UAAkB,EAAE,EAAE;IACzD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,YAAY,GAAG,GAAG,MAAM,wBAAwB,CAAA;IACtD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE;QAC9C,UAAU;QACV,SAAS,EAAE,QAAQ,EAAE;QACrB,KAAK,EAAE,KAAK;KACb,CAAC,CAAA;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;QAC3B,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IACD,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC,CAAA;AAEQ,sDAAqB","sourcesContent":["import axios from 'axios'\nimport tunnel from 'tunnel'\n\nconst getSSoUrl = () => {\n switch (process.env.NODE_ENV_BLINQ) {\n case 'local':\n return 'http://localhost:5000/api/auth'\n case 'dev':\n return 'https://dev.api.blinq.io/api/auth'\n case 'stage':\n return 'https://stage.api.blinq.io/api/auth'\n case 'prod':\n return 'https://api.blinq.io/api/auth'\n case null:\n return 'https://api.blinq.io/api/auth'\n default:\n return `${process.env.NODE_ENV_BLINQ}/api/auth`\n }\n}\nconst getProxy = () => {\n if (!process.env.PROXY) {\n return null\n }\n\n const proxy = process.env.PROXY\n const url = new URL(proxy)\n const proxyObject = {\n host: url.hostname,\n port: Number(url.port),\n }\n\n const { username, password } = url\n\n if (username && password) {\n //@ts-ignore\n proxyObject.proxyAuth = `${username}:${password}`\n }\n return tunnel.httpsOverHttp({ proxy: proxyObject })\n}\n\nconst getProjectByAccessKey = async (access_key: string) => {\n const ssoUrl = getSSoUrl()\n const accessKeyUrl = `${ssoUrl}/getProjectByAccessKey`\n const response = await axios.post(accessKeyUrl, {\n access_key,\n httpAgent: getProxy(),\n proxy: false,\n })\n if (response.status !== 200) {\n console.error('Error: Invalid access key')\n process.exit(1)\n }\n return response.data\n}\n\nexport { getProjectByAccessKey }\n"]}
@@ -1,11 +1,21 @@
1
1
  import Formatter, { IFormatterOptions } from '.';
2
+ import ReportGenerator from './helpers/report_generator';
2
3
  export default class BVTAnalysisFormatter extends Formatter {
4
+ static reportGenerator: ReportGenerator;
5
+ static reRunFailedStepsIndex: {
6
+ testCaseId: string;
7
+ failedStepIndex: number;
8
+ }[] | null;
3
9
  private reportGenerator;
4
10
  private uploader;
5
11
  private exit;
6
12
  private START;
7
13
  private runName;
14
+ private failedStepsIndex;
15
+ private summaryFormatter;
16
+ private rootCauseArray;
8
17
  constructor(options: IFormatterOptions);
18
+ private sendEvent;
9
19
  private uploadReport;
10
20
  finished(): Promise<any>;
11
21
  private analyzeReport;
@@ -13,6 +23,8 @@ export default class BVTAnalysisFormatter extends Formatter {
13
23
  private processTestCase;
14
24
  private uploadFinalReport;
15
25
  private retrain;
26
+ private rerun;
16
27
  private call_cucumber_client;
17
- private logReportLink;
28
+ private getAppDataDir;
18
29
  }
30
+ export declare function logReportLink(runId: string, projectId: string): void;