@dev-blinq/cucumber-js 1.0.168-dev → 1.0.170-dev
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/lib/formatter/bvt_analysis_formatter.d.ts +2 -2
- package/lib/formatter/bvt_analysis_formatter.js +6 -7
- package/lib/formatter/bvt_analysis_formatter.js.map +1 -1
- package/lib/formatter/helpers/upload_serivce.js +2 -2
- package/lib/formatter/helpers/upload_serivce.js.map +1 -1
- package/lib/formatter/summary_formatter.js +4 -1
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Formatter, { IFormatterOptions } from '.';
|
|
2
|
-
import ReportGenerator from './helpers/report_generator';
|
|
2
|
+
import ReportGenerator, { JsonTestResult } from './helpers/report_generator';
|
|
3
3
|
export declare let globalReportLink: string;
|
|
4
4
|
export default class BVTAnalysisFormatter extends Formatter {
|
|
5
5
|
static reportGenerator: ReportGenerator;
|
|
@@ -28,4 +28,4 @@ export default class BVTAnalysisFormatter extends Formatter {
|
|
|
28
28
|
private call_cucumber_client;
|
|
29
29
|
private getAppDataDir;
|
|
30
30
|
}
|
|
31
|
-
export declare function logReportLink(runId: string, projectId: string): string;
|
|
31
|
+
export declare function logReportLink(runId: string, projectId: string, status: JsonTestResult): string;
|
|
@@ -20,7 +20,6 @@ const constants_1 = require("./helpers/constants");
|
|
|
20
20
|
const axios_client_1 = require("../configuration/axios_client");
|
|
21
21
|
const util_1 = require("util");
|
|
22
22
|
const child_process_2 = require("child_process");
|
|
23
|
-
const isCloudRecorder_1 = require("./helpers/isCloudRecorder");
|
|
24
23
|
//User token
|
|
25
24
|
const TOKEN = process.env.TOKEN;
|
|
26
25
|
exports.globalReportLink = '';
|
|
@@ -169,7 +168,7 @@ class BVTAnalysisFormatter extends _1.default {
|
|
|
169
168
|
let success = true;
|
|
170
169
|
try {
|
|
171
170
|
const { projectId, runId } = await this.uploader.uploadRun(finalReport, this.runName);
|
|
172
|
-
logReportLink(runId, projectId);
|
|
171
|
+
logReportLink(runId, projectId, finalReport.result);
|
|
173
172
|
}
|
|
174
173
|
catch (err) {
|
|
175
174
|
this.log('Error uploading report\n');
|
|
@@ -312,7 +311,7 @@ class BVTAnalysisFormatter extends _1.default {
|
|
|
312
311
|
}
|
|
313
312
|
}
|
|
314
313
|
exports.default = BVTAnalysisFormatter;
|
|
315
|
-
function logReportLink(runId, projectId) {
|
|
314
|
+
function logReportLink(runId, projectId, status) {
|
|
316
315
|
let reportLinkBaseUrl = 'https://app.blinq.io';
|
|
317
316
|
if (process.env.NODE_ENV_BLINQ === 'local') {
|
|
318
317
|
reportLinkBaseUrl = 'http://localhost:3000';
|
|
@@ -335,7 +334,7 @@ function logReportLink(runId, projectId) {
|
|
|
335
334
|
const reportLink = `${reportLinkBaseUrl}/${projectId}/run-report/${runId}`;
|
|
336
335
|
exports.globalReportLink = reportLink;
|
|
337
336
|
try {
|
|
338
|
-
publishReportLinkToGuacServer(reportLink);
|
|
337
|
+
publishReportLinkToGuacServer(reportLink, status.status === "PASSED");
|
|
339
338
|
}
|
|
340
339
|
catch (err) {
|
|
341
340
|
// Error with events, ignoring
|
|
@@ -343,10 +342,10 @@ function logReportLink(runId, projectId) {
|
|
|
343
342
|
return reportLink;
|
|
344
343
|
}
|
|
345
344
|
exports.logReportLink = logReportLink;
|
|
346
|
-
function publishReportLinkToGuacServer(reportLink) {
|
|
347
|
-
if (
|
|
345
|
+
function publishReportLinkToGuacServer(reportLink, result) {
|
|
346
|
+
if ((0, fs_1.existsSync)('/tmp/report_publish.sh')) {
|
|
348
347
|
const execAsync = (0, util_1.promisify)(child_process_2.exec);
|
|
349
|
-
execAsync('sh /tmp/report_publish.sh ' + reportLink);
|
|
348
|
+
execAsync('sh /tmp/report_publish.sh ' + reportLink + ' ' + result);
|
|
350
349
|
}
|
|
351
350
|
}
|
|
352
351
|
//# sourceMappingURL=bvt_analysis_formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bvt_analysis_formatter.js","sourceRoot":"","sources":["../../src/formatter/bvt_analysis_formatter.ts"],"names":[],"mappings":";;;;;;AACA,iDAAqC;AACrC,2BAA4D;AAC5D,0CAAsD;AACtD,gDAAuB;AACvB,6BAA6B;AAC7B,yCAAgD;AAChD,oDAAgD;AAChD,kFAKmC;AACnC,kEAA+C;AAC/C,4CAAmB;AACnB,+BAA6C;AAC7C,4EAAkD;AAClD,mDAAgE;AAChE,gEAA2D;AAK3D,+BAAgC;AAChC,iDAAoC;AACpC,+DAA2D;AAE3D,YAAY;AACZ,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;AAQpB,QAAA,gBAAgB,GAAG,EAAE,CAAC;AACjC,MAAqB,oBAAqB,SAAQ,UAAS;IAiBzD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QAbR,oBAAe,GAAG,IAAI,0BAAe,EAAE,CAAA;QACvC,aAAQ,GAAG,IAAI,kBAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QACnD,SAAI,GAAG,KAAK,CAAA;QAKZ,mBAAc,GAGhB,EAAE,CAAA;QAIN,IAAI,CAAC,gBAAgB,GAAG,IAAI,2BAAgB,CAAC,OAAO,CAAC,CAAA;QACrD,oBAAoB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAA;QAC3D,IAAI,CAAC,cAAc,GAAG,EAAE,CAAA;QACxB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;QAC1B,oBAAoB,CAAC,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK;YAC5D,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAC,IAAI,CAAA;QAER,IAAI,CAAC,KAAK,IAAI,O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;KACjD;SAAM,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,MAAM,EAAE;QAChD,iBAAiB,GAAG,sBAAsB,CAAA;KAC3C;SAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;QACtC,iBAAiB,GAAG,sBAAsB,CAAA;KAC3C;SAAM;QACL,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;KACrE;IACD,MAAM,UAAU,GAAG,GAAG,iBAAiB,IAAI,SAAS,eAAe,KAAK,EAAE,CAAA;IAC1E,wBAAgB,GAAG,UAAU,CAAC;IAC9B,IAAI;QACF,6BAA6B,CAAC,UAAU,CAAC,CAAA;KAC1C;IAAC,OAAO,GAAG,EAAE;QACZ,8BAA8B;KAC/B;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAvBD,sCAuBC;AAED,SAAS,6BAA6B,CAAC,UAAkB;IACvD,IAAI,iCAAe,EAAE;QACnB,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAA;QACjC,SAAS,CAAC,4BAA4B,GAAG,UAAU,CAAC,CAAA;KACrD;AACH,CAAC","sourcesContent":["import { Envelope, Meta } from '@cucumber/messages'\nimport { spawn } from 'child_process'\nimport { readFileSync, existsSync, writeFileSync } from 'fs'\nimport { mkdir, unlink, writeFile } from 'fs/promises'\nimport path from 'path'\nimport { tmpName } from 'tmp'\nimport Formatter, { IFormatterOptions } from '.'\nimport { doesHaveValue } from '../value_checker'\nimport ReportGenerator, {\n JsonReport,\n JsonTestProgress,\n JsonTestResult,\n RetrainStats,\n} from './helpers/report_generator'\nimport ReportUploader from './helpers/uploader'\nimport os from 'os'\nimport { getProjectByAccessKey } from './api'\nimport SummaryFormatter from './summary_formatter'\nimport { ActionEvents, SERVICES_URI } from './helpers/constants'\nimport { axiosClient } from '../configuration/axios_client'\nimport {\n FinishTestCaseResponse,\n RootCauseProps,\n} from './helpers/upload_serivce'\nimport { promisify } from 'util'\nimport { exec } from 'child_process'\nimport { isCloudRecorder } from './helpers/isCloudRecorder'\n\n//User token\nconst TOKEN = process.env.TOKEN\ninterface MetaMessage extends Meta {\n runName: string\n}\n\ninterface EnvelopeWithMetaMessage extends Envelope {\n meta: MetaMessage\n}\nexport let globalReportLink = '';\nexport default class BVTAnalysisFormatter extends Formatter {\n static reportGenerator: ReportGenerator\n static reRunFailedStepsIndex:\n | { testCaseId: string; failedStepIndex: number }[]\n | null\n private reportGenerator = new ReportGenerator()\n private uploader = new ReportUploader(this.reportGenerator)\n private exit = false\n private START: number\n private runName: string\n private failedStepsIndex: { testCaseId: string; failedStepIndex: number }[]\n private summaryFormatter: SummaryFormatter\n private rootCauseArray: {\n rootCause: RootCauseProps\n report: JsonTestProgress\n }[] = []\n\n constructor(options: IFormatterOptions) {\n super(options)\n this.summaryFormatter = new SummaryFormatter(options)\n BVTAnalysisFormatter.reportGenerator = this.reportGenerator\n this.rootCauseArray = []\n this.failedStepsIndex = []\n BVTAnalysisFormatter.reRunFailedStepsIndex = process.env.RERUN\n ? JSON.parse(process.env.RERUN)\n : null\n\n if (!TOKEN && process.env.BVT_FORMATTER === 'ANALYSIS') {\n throw new Error('TOKEN must be set')\n }\n this.sendEvent(ActionEvents.cli_run_tests)\n options.eventBroadcaster.on(\n 'envelope',\n async (envelope: EnvelopeWithMetaMessage, data?: any) => {\n if (doesHaveValue(envelope.testCaseFinished) && data) {\n const { rootCause, report } = data as FinishTestCaseResponse\n\n if (!rootCause.status) {\n console.error(\n `Root cause: ${rootCause.failClass}\\n, ${rootCause.analysis}\\nfailing step: ${rootCause.failedStep}`\n )\n this.rootCauseArray.push({ rootCause, report })\n this.failedStepsIndex.push({\n testCaseId: report.id,\n failedStepIndex: rootCause.failedStep,\n })\n }\n return\n }\n await this.reportGenerator.handleMessage(envelope)\n\n if (\n doesHaveValue(envelope.meta) &&\n doesHaveValue(envelope.meta.runName)\n ) {\n this.runName = envelope.meta.runName\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n this.START = Date.now()\n if (process.env.BVT_FORMATTER === 'ANALYSIS') {\n await this.analyzeReport()\n } else {\n // await this.uploadReport(report)\n }\n this.exit = true\n }\n }\n )\n }\n\n private sendEvent(event: ActionEvents) {\n axiosClient\n .post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event,\n },\n {\n headers: {\n Authorization: `Bearer ${TOKEN}`,\n 'x-source': 'cucumber_js',\n },\n }\n )\n .catch((err) => {\n // Error with events, ignoring\n })\n }\n\n private async uploadReport(report: JsonReport) {\n const uploadSuccessful = await this.uploadFinalReport(report)\n if (uploadSuccessful && report.result.status !== 'FAILED') {\n process.exit(0)\n }\n process.exit(1)\n }\n\n async finished(): Promise<any> {\n await new Promise((resolve) => {\n const checkInterval = setInterval(() => {\n let anyRem\n if (process.env.UPLOADING_TEST_CASE) {\n anyRem = JSON.parse(process.env.UPLOADING_TEST_CASE) as string[]\n } else {\n anyRem = undefined\n }\n\n if (this.exit && (!anyRem || anyRem.length === 0)) {\n // clearInterval(checkInterval)\n // resolve(null)\n if (this.reportGenerator.getReport().result.status === 'FAILED') {\n process.exit(1)\n } else {\n process.exit(0)\n }\n }\n }, 100) // check every 100ms\n })\n }\n private async analyzeReport() {\n if (\n this.rootCauseArray.length === 0 ||\n process.env.NO_RETRAIN === 'false'\n ) {\n if (this.rootCauseArray.length === 0) {\n this.log('No test failed. No need to retrain\\n')\n }\n if (process.env.NO_RETRAIN === 'false') {\n this.log(\n 'Retraining is skipped since the failed step contains an API request\\n'\n )\n }\n // const uploadSuccessful = await this.uploadFinalReport(report)\n // process.exit(0)\n this.exit = true\n return\n }\n\n //checking if the type of report.result is JsonResultFailed or not\n\n this.log('Some tests failed, starting the retraining...\\n')\n await this.processTestCases()\n if (this.reportGenerator.getReport().result.status === 'FAILED') {\n process.exit(1)\n }\n process.exit(0)\n }\n private async processTestCases() {\n for (const { rootCause, report } of this.rootCauseArray) {\n await this.processTestCase(rootCause, report)\n }\n }\n private async processTestCase(\n rootCause: RootCauseProps,\n report: JsonTestProgress\n ) {\n const failedTestSteps = rootCause.failedStep\n\n if (\n BVTAnalysisFormatter.reRunFailedStepsIndex &&\n BVTAnalysisFormatter.reRunFailedStepsIndex.length > 0\n ) {\n const previousRun = BVTAnalysisFormatter.reRunFailedStepsIndex[0]\n if (previousRun.failedStepIndex === failedTestSteps) {\n console.log('Same step has failed again, skipping retraining')\n BVTAnalysisFormatter.reRunFailedStepsIndex.shift()\n return\n }\n BVTAnalysisFormatter.reRunFailedStepsIndex.shift()\n }\n\n const retrainStats = await this.retrain(failedTestSteps, report)\n\n if (!retrainStats) {\n return\n }\n\n await this.uploader.modifyTestCase({\n ...report,\n retrainStats,\n })\n\n await this.rerun(report)\n }\n\n private async uploadFinalReport(finalReport: JsonReport) {\n let success = true\n try {\n const { projectId, runId } = await this.uploader.uploadRun(\n finalReport,\n this.runName\n )\n logReportLink(runId, projectId)\n } catch (err) {\n this.log('Error uploading report\\n')\n if ('stack' in err) {\n this.log(err.stack)\n }\n success = false\n } finally {\n try {\n writeFileSync(\n path.join(this.reportGenerator.reportFolder, 'report.json'),\n JSON.stringify(finalReport, null, 2),\n 'utf-8'\n )\n } catch (e) {\n console.error('failed to write report.json to local disk')\n }\n }\n\n //this.log(JSON.stringify(finalReport, null, 2))\n return success\n }\n private async retrain(\n failedTestCases: number,\n testCase: JsonTestProgress\n ): Promise<RetrainStats | null> {\n const data = await getProjectByAccessKey(TOKEN)\n const currentTimestampInSeconds = Math.floor(Date.now() / 1000)\n if (data.project.expriration_date < currentTimestampInSeconds) {\n console.log(\n 'Warning: Your project has expired, retraining is restricted. Please contact sales.'\n )\n process.exit(1)\n }\n return await this.call_cucumber_client(failedTestCases, testCase)\n }\n\n private async rerun(report: JsonTestProgress) {\n await new Promise<void>((resolve) => {\n const node_path = process.argv.shift()\n const args = [\n path.join(\n process.cwd(),\n 'node_modules',\n '@dev-blinq',\n 'cucumber-js',\n 'bin',\n 'cucumber.js'\n ),\n '--name',\n `^${report.scenarioName}$`,\n '--exit',\n '--format',\n 'bvt',\n '--run-name',\n `${report.scenarioName}@debug`,\n path.join(process.cwd(), 'features', `${report.featureName}.feature`),\n ]\n const cucumberClient = spawn(node_path, args, {\n env: {\n ...process.env,\n RERUN: JSON.stringify(this.failedStepsIndex),\n },\n })\n\n cucumberClient.stdout.on('data', (data) => {\n console.log(data.toString())\n })\n\n cucumberClient.stderr.on('data', (data) => {\n console.error(data.toString())\n })\n\n cucumberClient.on('close', () => {\n resolve()\n })\n })\n }\n\n private async call_cucumber_client(\n stepsToRetrain: number,\n testCase: JsonTestProgress\n ): Promise<RetrainStats | null> {\n return new Promise((resolve, reject) => {\n const cucumber_client_path = path.resolve(\n process.cwd(),\n 'node_modules',\n '@dev-blinq',\n 'cucumber_client',\n 'bin',\n 'client',\n 'cucumber.js'\n )\n\n const args: string[] = [\n process.cwd(),\n path.join(process.cwd(), testCase.uri),\n `${testCase.scenarioName}`,\n 'undefined',\n `${stepsToRetrain},`,\n ]\n\n if (process.env.BLINQ_ENV) {\n args.push(`--env=${process.env.BLINQ_ENV}`)\n }\n\n if (!existsSync(path.join(this.getAppDataDir(), 'blinq.io', '.temp'))) {\n mkdir(path.join(this.getAppDataDir(), 'blinq.io', '.temp'), {\n recursive: true,\n })\n }\n\n tmpName(async (err, name) => {\n const tempFile = path.join(\n this.getAppDataDir(),\n 'blinq.io',\n '.temp',\n path.basename(name)\n )\n console.log('File path: ', tempFile)\n // check if the file directory exists, if not create it\n if (!existsSync(path.dirname(tempFile))) {\n await mkdir(path.dirname(tempFile), { recursive: true })\n }\n await writeFile(tempFile, '', 'utf-8')\n\n args.push(`--temp-file=${tempFile}`)\n const cucumberClient = spawn('node', [cucumber_client_path, ...args], {\n env: {\n ...process.env,\n TEMP_FILE_PATH: tempFile,\n },\n })\n\n cucumberClient.stdout.on('data', (data) => {\n console.log(data.toString())\n })\n\n cucumberClient.stderr.on('data', (data) => {\n console.error(data.toString())\n })\n\n cucumberClient.on('close', async (code) => {\n if (code === 0) {\n const reportData = readFileSync(tempFile, 'utf-8')\n const retrainStats = JSON.parse(reportData) as RetrainStats\n await unlink(tempFile)\n resolve(retrainStats)\n } else {\n this.log('Error retraining\\n')\n try {\n const reportData = readFileSync(tempFile, 'utf-8')\n const retrainStats = JSON.parse(reportData) as RetrainStats\n await unlink(tempFile)\n resolve(retrainStats)\n } catch (e) {\n this.log('Error reading scenario report\\n ' + e)\n resolve(null)\n }\n }\n })\n })\n })\n }\n\n private getAppDataDir() {\n if (process.env.BLINQ_APPDATA_DIR) {\n return process.env.BLINQ_APPDATA_DIR\n }\n\n let appDataDir: string\n\n switch (process.platform) {\n case 'win32':\n appDataDir = process.env.APPDATA!\n break\n case 'darwin':\n appDataDir = path.join(os.homedir(), 'Library', 'Application Support')\n break\n default:\n appDataDir = path.join(os.homedir(), '.config')\n break\n }\n return appDataDir\n }\n}\n\nexport function logReportLink(runId: string, projectId: string) {\n let reportLinkBaseUrl = 'https://app.blinq.io'\n if (process.env.NODE_ENV_BLINQ === 'local') {\n reportLinkBaseUrl = 'http://localhost:3000'\n } else if (process.env.NODE_ENV_BLINQ === 'dev') {\n reportLinkBaseUrl = 'https://dev.app.blinq.io'\n } else if (process.env.NODE_ENV_BLINQ === 'stage') {\n reportLinkBaseUrl = 'https://stage.app.blinq.io'\n } else if (process.env.NODE_ENV_BLINQ === 'prod') {\n reportLinkBaseUrl = 'https://app.blinq.io'\n } else if (!process.env.NODE_ENV_BLINQ) {\n reportLinkBaseUrl = 'https://app.blinq.io'\n } else {\n reportLinkBaseUrl = process.env.NODE_ENV_BLINQ.replace('api', 'app')\n }\n const reportLink = `${reportLinkBaseUrl}/${projectId}/run-report/${runId}`\n globalReportLink = reportLink;\n try {\n publishReportLinkToGuacServer(reportLink)\n } catch (err) {\n // Error with events, ignoring\n }\n return reportLink;\n}\n\nfunction publishReportLinkToGuacServer(reportLink: string) {\n if (isCloudRecorder) {\n const execAsync = promisify(exec)\n execAsync('sh /tmp/report_publish.sh ' + reportLink)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bvt_analysis_formatter.js","sourceRoot":"","sources":["../../src/formatter/bvt_analysis_formatter.ts"],"names":[],"mappings":";;;;;;AACA,iDAAqC;AACrC,2BAA4D;AAC5D,0CAAsD;AACtD,gDAAuB;AACvB,6BAA6B;AAC7B,yCAAgD;AAChD,oDAAgD;AAChD,kFAKmC;AACnC,kEAA+C;AAC/C,4CAAmB;AACnB,+BAA6C;AAC7C,4EAAkD;AAClD,mDAAgE;AAChE,gEAA2D;AAK3D,+BAAgC;AAChC,iDAAoC;AAGpC,YAAY;AACZ,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;AAQpB,QAAA,gBAAgB,GAAG,EAAE,CAAC;AACjC,MAAqB,oBAAqB,SAAQ,UAAS;IAiBzD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QAbR,oBAAe,GAAG,IAAI,0BAAe,EAAE,CAAA;QACvC,aAAQ,GAAG,IAAI,kBAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QACnD,SAAI,GAAG,KAAK,CAAA;QAKZ,mBAAc,GAGhB,EAAE,CAAA;QAIN,IAAI,CAAC,gBAAgB,GAAG,IAAI,2BAAgB,CAAC,OAAO,CAAC,CAAA;QACrD,oBAAoB,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAA;QAC3D,IAAI,CAAC,cAAc,GAAG,EAAE,CAAA;QACxB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;QAC1B,oBAAoB,CAAC,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK;YAC5D,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAC,IAAI,CAAA;QAER,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAA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AAA;KACjD;SAAM,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,MAAM,EAAE;QAChD,iBAAiB,GAAG,sBAAsB,CAAA;KAC3C;SAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;QACtC,iBAAiB,GAAG,sBAAsB,CAAA;KAC3C;SAAM;QACL,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;KACrE;IACD,MAAM,UAAU,GAAG,GAAG,iBAAiB,IAAI,SAAS,eAAe,KAAK,EAAE,CAAA;IAC1E,wBAAgB,GAAG,UAAU,CAAC;IAC9B,IAAI;QACF,6BAA6B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAA;KACtE;IAAC,OAAO,GAAG,EAAE;QACZ,8BAA8B;KAC/B;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAvBD,sCAuBC;AAED,SAAS,6BAA6B,CAAC,UAAkB,EAAE,MAAe;IACxE,IAAI,IAAA,eAAU,EAAC,wBAAwB,CAAC,EAAE;QACxC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAA;QACjC,SAAS,CAAC,4BAA4B,GAAG,UAAU,GAAG,GAAG,GAAG,MAAM,CAAC,CAAA;KACpE;AACH,CAAC","sourcesContent":["import { Envelope, Meta } from '@cucumber/messages'\nimport { spawn } from 'child_process'\nimport { readFileSync, existsSync, writeFileSync } from 'fs'\nimport { mkdir, unlink, writeFile } from 'fs/promises'\nimport path from 'path'\nimport { tmpName } from 'tmp'\nimport Formatter, { IFormatterOptions } from '.'\nimport { doesHaveValue } from '../value_checker'\nimport ReportGenerator, {\n JsonReport,\n JsonTestProgress,\n JsonTestResult,\n RetrainStats,\n} from './helpers/report_generator'\nimport ReportUploader from './helpers/uploader'\nimport os from 'os'\nimport { getProjectByAccessKey } from './api'\nimport SummaryFormatter from './summary_formatter'\nimport { ActionEvents, SERVICES_URI } from './helpers/constants'\nimport { axiosClient } from '../configuration/axios_client'\nimport {\n FinishTestCaseResponse,\n RootCauseProps,\n} from './helpers/upload_serivce'\nimport { promisify } from 'util'\nimport { exec } from 'child_process'\nimport { isCloudRecorder } from './helpers/isCloudRecorder'\n\n//User token\nconst TOKEN = process.env.TOKEN\ninterface MetaMessage extends Meta {\n runName: string\n}\n\ninterface EnvelopeWithMetaMessage extends Envelope {\n meta: MetaMessage\n}\nexport let globalReportLink = '';\nexport default class BVTAnalysisFormatter extends Formatter {\n static reportGenerator: ReportGenerator\n static reRunFailedStepsIndex:\n | { testCaseId: string; failedStepIndex: number }[]\n | null\n private reportGenerator = new ReportGenerator()\n private uploader = new ReportUploader(this.reportGenerator)\n private exit = false\n private START: number\n private runName: string\n private failedStepsIndex: { testCaseId: string; failedStepIndex: number }[]\n private summaryFormatter: SummaryFormatter\n private rootCauseArray: {\n rootCause: RootCauseProps\n report: JsonTestProgress\n }[] = []\n\n constructor(options: IFormatterOptions) {\n super(options)\n this.summaryFormatter = new SummaryFormatter(options)\n BVTAnalysisFormatter.reportGenerator = this.reportGenerator\n this.rootCauseArray = []\n this.failedStepsIndex = []\n BVTAnalysisFormatter.reRunFailedStepsIndex = process.env.RERUN\n ? JSON.parse(process.env.RERUN)\n : null\n\n if (!TOKEN && process.env.BVT_FORMATTER === 'ANALYSIS') {\n throw new Error('TOKEN must be set')\n }\n this.sendEvent(ActionEvents.cli_run_tests)\n options.eventBroadcaster.on(\n 'envelope',\n async (envelope: EnvelopeWithMetaMessage, data?: any) => {\n if (doesHaveValue(envelope.testCaseFinished) && data) {\n const { rootCause, report } = data as FinishTestCaseResponse\n\n if (!rootCause.status) {\n console.error(\n `Root cause: ${rootCause.failClass}\\n, ${rootCause.analysis}\\nfailing step: ${rootCause.failedStep}`\n )\n this.rootCauseArray.push({ rootCause, report })\n this.failedStepsIndex.push({\n testCaseId: report.id,\n failedStepIndex: rootCause.failedStep,\n })\n }\n return\n }\n await this.reportGenerator.handleMessage(envelope)\n\n if (\n doesHaveValue(envelope.meta) &&\n doesHaveValue(envelope.meta.runName)\n ) {\n this.runName = envelope.meta.runName\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n this.START = Date.now()\n if (process.env.BVT_FORMATTER === 'ANALYSIS') {\n await this.analyzeReport()\n } else {\n // await this.uploadReport(report)\n }\n this.exit = true\n }\n }\n )\n }\n\n private sendEvent(event: ActionEvents) {\n axiosClient\n .post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event,\n },\n {\n headers: {\n Authorization: `Bearer ${TOKEN}`,\n 'x-source': 'cucumber_js',\n },\n }\n )\n .catch((err) => {\n // Error with events, ignoring\n })\n }\n\n private async uploadReport(report: JsonReport) {\n const uploadSuccessful = await this.uploadFinalReport(report)\n if (uploadSuccessful && report.result.status !== 'FAILED') {\n process.exit(0)\n }\n process.exit(1)\n }\n\n async finished(): Promise<any> {\n await new Promise((resolve) => {\n const checkInterval = setInterval(() => {\n let anyRem\n if (process.env.UPLOADING_TEST_CASE) {\n anyRem = JSON.parse(process.env.UPLOADING_TEST_CASE) as string[]\n } else {\n anyRem = undefined\n }\n\n if (this.exit && (!anyRem || anyRem.length === 0)) {\n // clearInterval(checkInterval)\n // resolve(null)\n if (this.reportGenerator.getReport().result.status === 'FAILED') {\n process.exit(1)\n } else {\n process.exit(0)\n }\n }\n }, 100) // check every 100ms\n })\n }\n private async analyzeReport() {\n if (\n this.rootCauseArray.length === 0 ||\n process.env.NO_RETRAIN === 'false'\n ) {\n if (this.rootCauseArray.length === 0) {\n this.log('No test failed. No need to retrain\\n')\n }\n if (process.env.NO_RETRAIN === 'false') {\n this.log(\n 'Retraining is skipped since the failed step contains an API request\\n'\n )\n }\n // const uploadSuccessful = await this.uploadFinalReport(report)\n // process.exit(0)\n this.exit = true\n return\n }\n\n //checking if the type of report.result is JsonResultFailed or not\n\n this.log('Some tests failed, starting the retraining...\\n')\n await this.processTestCases()\n if (this.reportGenerator.getReport().result.status === 'FAILED') {\n process.exit(1)\n }\n process.exit(0)\n }\n private async processTestCases() {\n for (const { rootCause, report } of this.rootCauseArray) {\n await this.processTestCase(rootCause, report)\n }\n }\n private async processTestCase(\n rootCause: RootCauseProps,\n report: JsonTestProgress\n ) {\n const failedTestSteps = rootCause.failedStep\n\n if (\n BVTAnalysisFormatter.reRunFailedStepsIndex &&\n BVTAnalysisFormatter.reRunFailedStepsIndex.length > 0\n ) {\n const previousRun = BVTAnalysisFormatter.reRunFailedStepsIndex[0]\n if (previousRun.failedStepIndex === failedTestSteps) {\n console.log('Same step has failed again, skipping retraining')\n BVTAnalysisFormatter.reRunFailedStepsIndex.shift()\n return\n }\n BVTAnalysisFormatter.reRunFailedStepsIndex.shift()\n }\n\n const retrainStats = await this.retrain(failedTestSteps, report)\n\n if (!retrainStats) {\n return\n }\n\n await this.uploader.modifyTestCase({\n ...report,\n retrainStats,\n })\n\n await this.rerun(report)\n }\n\n private async uploadFinalReport(finalReport: JsonReport) {\n let success = true\n try {\n const { projectId, runId } = await this.uploader.uploadRun(\n finalReport,\n this.runName\n )\n logReportLink(runId, projectId, finalReport.result)\n } catch (err) {\n this.log('Error uploading report\\n')\n if ('stack' in err) {\n this.log(err.stack)\n }\n success = false\n } finally {\n try {\n writeFileSync(\n path.join(this.reportGenerator.reportFolder, 'report.json'),\n JSON.stringify(finalReport, null, 2),\n 'utf-8'\n )\n } catch (e) {\n console.error('failed to write report.json to local disk')\n }\n }\n\n //this.log(JSON.stringify(finalReport, null, 2))\n return success\n }\n private async retrain(\n failedTestCases: number,\n testCase: JsonTestProgress\n ): Promise<RetrainStats | null> {\n const data = await getProjectByAccessKey(TOKEN)\n const currentTimestampInSeconds = Math.floor(Date.now() / 1000)\n if (data.project.expriration_date < currentTimestampInSeconds) {\n console.log(\n 'Warning: Your project has expired, retraining is restricted. Please contact sales.'\n )\n process.exit(1)\n }\n return await this.call_cucumber_client(failedTestCases, testCase)\n }\n\n private async rerun(report: JsonTestProgress) {\n await new Promise<void>((resolve) => {\n const node_path = process.argv.shift()\n const args = [\n path.join(\n process.cwd(),\n 'node_modules',\n '@dev-blinq',\n 'cucumber-js',\n 'bin',\n 'cucumber.js'\n ),\n '--name',\n `^${report.scenarioName}$`,\n '--exit',\n '--format',\n 'bvt',\n '--run-name',\n `${report.scenarioName}@debug`,\n path.join(process.cwd(), 'features', `${report.featureName}.feature`),\n ]\n const cucumberClient = spawn(node_path, args, {\n env: {\n ...process.env,\n RERUN: JSON.stringify(this.failedStepsIndex),\n },\n })\n\n cucumberClient.stdout.on('data', (data) => {\n console.log(data.toString())\n })\n\n cucumberClient.stderr.on('data', (data) => {\n console.error(data.toString())\n })\n\n cucumberClient.on('close', () => {\n resolve()\n })\n })\n }\n\n private async call_cucumber_client(\n stepsToRetrain: number,\n testCase: JsonTestProgress\n ): Promise<RetrainStats | null> {\n return new Promise((resolve, reject) => {\n const cucumber_client_path = path.resolve(\n process.cwd(),\n 'node_modules',\n '@dev-blinq',\n 'cucumber_client',\n 'bin',\n 'client',\n 'cucumber.js'\n )\n\n const args: string[] = [\n process.cwd(),\n path.join(process.cwd(), testCase.uri),\n `${testCase.scenarioName}`,\n 'undefined',\n `${stepsToRetrain},`,\n ]\n\n if (process.env.BLINQ_ENV) {\n args.push(`--env=${process.env.BLINQ_ENV}`)\n }\n\n if (!existsSync(path.join(this.getAppDataDir(), 'blinq.io', '.temp'))) {\n mkdir(path.join(this.getAppDataDir(), 'blinq.io', '.temp'), {\n recursive: true,\n })\n }\n\n tmpName(async (err, name) => {\n const tempFile = path.join(\n this.getAppDataDir(),\n 'blinq.io',\n '.temp',\n path.basename(name)\n )\n console.log('File path: ', tempFile)\n // check if the file directory exists, if not create it\n if (!existsSync(path.dirname(tempFile))) {\n await mkdir(path.dirname(tempFile), { recursive: true })\n }\n await writeFile(tempFile, '', 'utf-8')\n\n args.push(`--temp-file=${tempFile}`)\n const cucumberClient = spawn('node', [cucumber_client_path, ...args], {\n env: {\n ...process.env,\n TEMP_FILE_PATH: tempFile,\n },\n })\n\n cucumberClient.stdout.on('data', (data) => {\n console.log(data.toString())\n })\n\n cucumberClient.stderr.on('data', (data) => {\n console.error(data.toString())\n })\n\n cucumberClient.on('close', async (code) => {\n if (code === 0) {\n const reportData = readFileSync(tempFile, 'utf-8')\n const retrainStats = JSON.parse(reportData) as RetrainStats\n await unlink(tempFile)\n resolve(retrainStats)\n } else {\n this.log('Error retraining\\n')\n try {\n const reportData = readFileSync(tempFile, 'utf-8')\n const retrainStats = JSON.parse(reportData) as RetrainStats\n await unlink(tempFile)\n resolve(retrainStats)\n } catch (e) {\n this.log('Error reading scenario report\\n ' + e)\n resolve(null)\n }\n }\n })\n })\n })\n }\n\n private getAppDataDir() {\n if (process.env.BLINQ_APPDATA_DIR) {\n return process.env.BLINQ_APPDATA_DIR\n }\n\n let appDataDir: string\n\n switch (process.platform) {\n case 'win32':\n appDataDir = process.env.APPDATA!\n break\n case 'darwin':\n appDataDir = path.join(os.homedir(), 'Library', 'Application Support')\n break\n default:\n appDataDir = path.join(os.homedir(), '.config')\n break\n }\n return appDataDir\n }\n}\n\nexport function logReportLink(runId: string, projectId: string, status: JsonTestResult) {\n let reportLinkBaseUrl = 'https://app.blinq.io'\n if (process.env.NODE_ENV_BLINQ === 'local') {\n reportLinkBaseUrl = 'http://localhost:3000'\n } else if (process.env.NODE_ENV_BLINQ === 'dev') {\n reportLinkBaseUrl = 'https://dev.app.blinq.io'\n } else if (process.env.NODE_ENV_BLINQ === 'stage') {\n reportLinkBaseUrl = 'https://stage.app.blinq.io'\n } else if (process.env.NODE_ENV_BLINQ === 'prod') {\n reportLinkBaseUrl = 'https://app.blinq.io'\n } else if (!process.env.NODE_ENV_BLINQ) {\n reportLinkBaseUrl = 'https://app.blinq.io'\n } else {\n reportLinkBaseUrl = process.env.NODE_ENV_BLINQ.replace('api', 'app')\n }\n const reportLink = `${reportLinkBaseUrl}/${projectId}/run-report/${runId}`\n globalReportLink = reportLink;\n try {\n publishReportLinkToGuacServer(reportLink, status.status === \"PASSED\")\n } catch (err) {\n // Error with events, ignoring\n }\n return reportLink;\n}\n\nfunction publishReportLinkToGuacServer(reportLink: string, result: boolean) {\n if (existsSync('/tmp/report_publish.sh')) {\n const execAsync = promisify(exec)\n execAsync('sh /tmp/report_publish.sh ' + reportLink + ' ' + result)\n }\n}\n"]}
|
|
@@ -152,7 +152,7 @@ class RunUploadService {
|
|
|
152
152
|
catch (error) {
|
|
153
153
|
// no event tracking
|
|
154
154
|
}
|
|
155
|
-
(0, bvt_analysis_formatter_1.logReportLink)(runId, projectId);
|
|
155
|
+
(0, bvt_analysis_formatter_1.logReportLink)(runId, projectId, testCaseReport.result);
|
|
156
156
|
return data;
|
|
157
157
|
}
|
|
158
158
|
catch (e) {
|
|
@@ -235,7 +235,7 @@ class RunUploadService {
|
|
|
235
235
|
if (res.data.status !== true) {
|
|
236
236
|
throw new Error("");
|
|
237
237
|
}
|
|
238
|
-
(0, bvt_analysis_formatter_1.logReportLink)(runId, projectId);
|
|
238
|
+
(0, bvt_analysis_formatter_1.logReportLink)(runId, projectId, testProgressReport.result);
|
|
239
239
|
}
|
|
240
240
|
catch (e) {
|
|
241
241
|
console.error(`failed to modify the test case: ${testProgressReport.id} ${e}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload_serivce.js","sourceRoot":"","sources":["../../../src/formatter/helpers/upload_serivce.ts"],"names":[],"mappings":";;;;;;;AAEA,2BAAwE;AACxE,2DAA6B;AAG7B,mEAA+D;AAC/D,gDAAwB;AACxB,sEAA0D;AAC1D,2CAAyD;AAEzD,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB,mCAAI,GAAG,CAAC;AACjE,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,oBAAoB,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,KAAK,mCAAI,OAAO,CAAC,GAAG,CA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E,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC,WAAW;oBAC3C,UAAU,EAAE,aAAa;iBAC1B;aACF,CACF,CAAC;YACF,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;gBACtB,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;aACrB;YACD,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;gBAC5B,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;aACrB;YACD,IAAA,sCAAa,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC;SACjC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,mCAAmC,kBAAkB,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;SAChF;IACH,CAAC;CACF;AAEQ,4CAAgB","sourcesContent":["/* eslint-disable no-console */\nimport FormData from \"form-data\";\nimport { createReadStream, existsSync, write, writeFileSync } from \"fs\";\nimport fs from \"fs/promises\";\n\nimport { JsonReport, JsonTestProgress } from \"./report_generator\";\nimport { axiosClient } from \"../../configuration/axios_client\";\nimport path from \"path\";\nimport { logReportLink } from \"../bvt_analysis_formatter\";\nimport { ActionEvents, SERVICES_URI } from \"./constants\";\n\nconst REPORT_SERVICE_URL = process.env.REPORT_SERVICE_URL ?? URL;\nconst BATCH_SIZE = 10;\nconst MAX_RETRIES = 3;\nconst REPORT_SERVICE_TOKEN = process.env.TOKEN ?? process.env.REPORT_SERVICE_TOKEN;\n\nexport interface RootCauseProps {\n status: boolean;\n analysis: string;\n failedStep: number;\n failClass: string;\n}\n\nexport interface FinishTestCaseResponse {\n status: true;\n rootCause: RootCauseProps;\n report: JsonTestProgress;\n}\n\nclass RunUploadService {\n constructor(private runsApiBaseURL: string, private accessToken: string) {}\n async createRunDocument(name: string) {\n try {\n const runDocResult = await axiosClient.post(\n this.runsApiBaseURL + \"/cucumber-runs/create\",\n {\n name: name ? name : \"TEST\",\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n if (runDocResult.status !== 200) {\n throw new Error(\"Failed to create run document in the server\");\n }\n if (runDocResult.data.status !== true) {\n throw new Error(\"Failed to create run document in the server\");\n }\n return runDocResult.data.run;\n } catch (error) {\n if (error.response && error.response.status === 403) {\n console.log(\"Warning: Your trial plan has ended. Cannot create or upload reports.\");\n process.exit(1);\n }\n throw new Error(\"Failed to create run document in the server: \" + error);\n }\n }\n async upload(formData: FormData) {\n const response = await axiosClient.post(this.runsApiBaseURL + \"/cucumber-runs/upload\", formData, {\n headers: {\n ...formData.getHeaders(),\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n });\n if (response.status === 401) {\n console.log(\"Warning: Your trial plan has ended. Cannot upload reports and perform retraining\");\n throw new Error(\"Warning: Your trial plan has ended. Cannot upload reports and perform retraining\");\n }\n if (response.status !== 200) {\n throw new Error(\"Failed to upload run to the server\");\n }\n if (response.data.status !== true) {\n throw new Error(\"Failed to upload run to the server\");\n }\n }\n async getPreSignedUrls(fileUris: string[], runId: string) {\n const response = await axiosClient.post(\n this.runsApiBaseURL + \"/cucumber-runs/generateuploadurls\",\n {\n fileUris,\n runId,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n if (response.status === 403) {\n console.log(\"Warning: Your trial plan has ended. Cannot upload reports and perform retraining\");\n throw new Error(\"Warning: Your trial plan has ended. Cannot upload reports and perform retraining\");\n }\n if (response.status !== 200) {\n throw new Error(\"Failed to get pre-signed urls for the files\");\n }\n if (response.data.status !== true) {\n throw new Error(\"Failed to get pre-signed urls for the files\");\n }\n\n return response.data.uploadUrls;\n }\n\n async uploadTestCase(\n testCaseReport: JsonTestProgress,\n runId: string,\n projectId: string,\n reportFolder: string,\n rerunId?: string\n ) {\n const fileUris = [];\n //iterate over all the files in the JsonCommand.screenshotId and insert them into the fileUris array\n for (const step of testCaseReport.steps) {\n for (const command of step.commands) {\n if (command.screenshotId) {\n fileUris.push(\"screenshots\" + \"/\" + String(command.screenshotId) + \".png\");\n }\n }\n if (step.traceFilePath) {\n fileUris.push(\"trace\" + \"/\" + step.traceFilePath);\n }\n }\n // console.log({ fileUris })\n const preSignedUrls = await this.getPreSignedUrls(fileUris, runId);\n //upload all the files in the fileUris array\n try {\n for (let i = 0; i < fileUris.length; i += BATCH_SIZE) {\n const batch = fileUris.slice(i, Math.min(i + BATCH_SIZE, fileUris.length));\n await Promise.all(\n batch\n .filter((fileUri) => preSignedUrls[fileUri])\n .map(async (fileUri) => {\n for (let j = 0; j < MAX_RETRIES; j++) {\n if (existsSync(path.join(reportFolder, fileUri))) {\n const success = await this.uploadFile(path.join(reportFolder, fileUri), preSignedUrls[fileUri]);\n if (success) {\n return;\n }\n }\n const success = await this.uploadFile(\n path.join(reportFolder, fileUri),\n preSignedUrls[fileUri]\n )\n if (success) {\n return\n }\n }\n console.error(\"Failed to upload file:\", fileUri);\n })\n );\n }\n\n // writeFileSync(\"report.json\", JSON.stringify(testCaseReport, null, 2))\n const { data } = await axiosClient.post<FinishTestCaseResponse>(\n this.runsApiBaseURL + \"/cucumber-runs/createNewTestCase\",\n {\n runId,\n projectId,\n testProgressReport: testCaseReport,\n browser: process.env.BROWSER ? process.env.BROWSER : \"chromium\",\n mode: process.env.MODE === \"cloud\" ? \"cloud\" : \"local\",\n rerunId,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n\n try {\n await axiosClient.post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event: ActionEvents.upload_report,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n \"x-bvt-project-id\": projectId,\n },\n }\n );\n } catch (error) {\n // no event tracking\n }\n logReportLink(runId, projectId);\n return data;\n } catch (e) {\n console.error(`failed to upload the test case: ${testCaseReport.id} ${e}`);\n return null;\n }\n }\n async uploadFile(filePath: string, preSignedUrl: string) {\n const fileStream = createReadStream(filePath);\n let success = true;\n try {\n const fileStats = await fs.stat(filePath);\n const fileSize = fileStats.size;\n\n await axiosClient.put(preSignedUrl, fileStream, {\n headers: {\n \"Content-Type\": \"application/octet-stream\",\n \"Content-Length\": fileSize,\n },\n });\n } catch (error) {\n if (process.env.NODE_ENV_BLINQ === \"dev\") {\n console.error(\"Error uploading file:\", error);\n }\n success = false;\n } finally {\n fileStream.close();\n }\n return success;\n }\n async uploadComplete(runId: string, projectId: string) {\n const response = await axiosClient.post(\n this.runsApiBaseURL + \"/cucumber-runs/uploadCompletion\",\n {\n runId,\n projectId,\n browser: process.env.BROWSER ? process.env.BROWSER : \"chromium\",\n mode: process.env.MODE === \"cloud\" ? \"cloud\" : \"local\",\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n if (response.status !== 200) {\n throw new Error(\"Failed to mark run as complete\");\n }\n if (response.data.status !== true) {\n throw new Error(\"Failed to mark run as complete\");\n }\n\n try {\n await axiosClient.post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event: ActionEvents.upload_report,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n \"x-bvt-project-id\": projectId,\n },\n }\n );\n } catch (error) {\n // no event tracking\n }\n }\n async modifyTestCase(runId: string, projectId: string, testProgressReport: JsonTestProgress) {\n try {\n const res = await axiosClient.post(\n this.runsApiBaseURL + \"/cucumber-runs/modifyTestCase\",\n {\n runId,\n projectId,\n testProgressReport,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n if (res.status !== 200) {\n throw new Error(\"\");\n }\n if (res.data.status !== true) {\n throw new Error(\"\");\n }\n logReportLink(runId, projectId);\n } catch (e) {\n console.error(`failed to modify the test case: ${testProgressReport.id} ${e}`);\n }\n }\n}\n\nexport { RunUploadService };\n"]}
|
|
1
|
+
{"version":3,"file":"upload_serivce.js","sourceRoot":"","sources":["../../../src/formatter/helpers/upload_serivce.ts"],"names":[],"mappings":";;;;;;;AAEA,2BAAwE;AACxE,2DAA6B;AAG7B,mEAA+D;AAC/D,gDAAwB;AACxB,sEAA0D;AAC1D,2CAAyD;AAEzD,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,kBAAkB,mCAAI,GAAG,CAAC;AACjE,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,oBAAoB,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,KAAK,mCAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;AAenF,MAAM,gBAAgB;IACpB,YAAoB,cAAsB,EAAU,WAAmB;QAAnD,mBAAc,GAAd,cAAc,CAAQ;QAAU,gBAAW,GAAX,WAAW,CAAQ;IAAG,CAAC;IAC3E,KAAK,CAAC,iBAAiB,CAAC,IAAY;QAClC,IAAI;YACF,MAAM,YAAY,GAAG,MAAM,0BAAW,CAAC,IAAI,CACzC,IAAI,CAAC,cAAc,GAAG,uBAAuB,EAC7C;gBACE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;aAC3B,EACD;gBACE,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC,WAAW;oBAC3C,UAAU,EAAE,aAAa;iBAC1B;aACF,CACF,CAAC;YACF,IAAI,YAAY,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC/B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAChE;YACD,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;gBACrC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAChE;YACD,OAAO,YAAY,CAAC,IAAI,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G,wBAAY,CAAC,OAAO,QAAQ,EAC/B;gBACE,KAAK,EAAE,wBAAY,CAAC,aAAa;aAClC,EACD;gBACE,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC,WAAW;oBAC3C,UAAU,EAAE,aAAa;oBACzB,kBAAkB,EAAE,SAAS;iBAC9B;aACF,CACF,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,oBAAoB;SACrB;IACH,CAAC;IACD,KAAK,CAAC,cAAc,CAAC,KAAa,EAAE,SAAiB,EAAE,kBAAoC;QACzF,IAAI;YACF,MAAM,GAAG,GAAG,MAAM,0BAAW,CAAC,IAAI,CAChC,IAAI,CAAC,cAAc,GAAG,+BAA+B,EACrD;gBACE,KAAK;gBACL,SAAS;gBACT,kBAAkB;aACnB,EACD;gBACE,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC,WAAW;oBAC3C,UAAU,EAAE,aAAa;iBAC1B;aACF,CACF,CAAC;YACF,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;gBACtB,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;aACrB;YACD,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;gBAC5B,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;aACrB;YACD,IAAA,sCAAa,EAAC,KAAK,EAAE,SAAS,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;SAC5D;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,mCAAmC,kBAAkB,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;SAChF;IACH,CAAC;CACF;AAEQ,4CAAgB","sourcesContent":["/* eslint-disable no-console */\nimport FormData from \"form-data\";\nimport { createReadStream, existsSync, write, writeFileSync } from \"fs\";\nimport fs from \"fs/promises\";\n\nimport { JsonReport, JsonTestProgress } from \"./report_generator\";\nimport { axiosClient } from \"../../configuration/axios_client\";\nimport path from \"path\";\nimport { logReportLink } from \"../bvt_analysis_formatter\";\nimport { ActionEvents, SERVICES_URI } from \"./constants\";\n\nconst REPORT_SERVICE_URL = process.env.REPORT_SERVICE_URL ?? URL;\nconst BATCH_SIZE = 10;\nconst MAX_RETRIES = 3;\nconst REPORT_SERVICE_TOKEN = process.env.TOKEN ?? process.env.REPORT_SERVICE_TOKEN;\n\nexport interface RootCauseProps {\n status: boolean;\n analysis: string;\n failedStep: number;\n failClass: string;\n}\n\nexport interface FinishTestCaseResponse {\n status: true;\n rootCause: RootCauseProps;\n report: JsonTestProgress;\n}\n\nclass RunUploadService {\n constructor(private runsApiBaseURL: string, private accessToken: string) {}\n async createRunDocument(name: string) {\n try {\n const runDocResult = await axiosClient.post(\n this.runsApiBaseURL + \"/cucumber-runs/create\",\n {\n name: name ? name : \"TEST\",\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n if (runDocResult.status !== 200) {\n throw new Error(\"Failed to create run document in the server\");\n }\n if (runDocResult.data.status !== true) {\n throw new Error(\"Failed to create run document in the server\");\n }\n return runDocResult.data.run;\n } catch (error) {\n if (error.response && error.response.status === 403) {\n console.log(\"Warning: Your trial plan has ended. Cannot create or upload reports.\");\n process.exit(1);\n }\n throw new Error(\"Failed to create run document in the server: \" + error);\n }\n }\n async upload(formData: FormData) {\n const response = await axiosClient.post(this.runsApiBaseURL + \"/cucumber-runs/upload\", formData, {\n headers: {\n ...formData.getHeaders(),\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n });\n if (response.status === 401) {\n console.log(\"Warning: Your trial plan has ended. Cannot upload reports and perform retraining\");\n throw new Error(\"Warning: Your trial plan has ended. Cannot upload reports and perform retraining\");\n }\n if (response.status !== 200) {\n throw new Error(\"Failed to upload run to the server\");\n }\n if (response.data.status !== true) {\n throw new Error(\"Failed to upload run to the server\");\n }\n }\n async getPreSignedUrls(fileUris: string[], runId: string) {\n const response = await axiosClient.post(\n this.runsApiBaseURL + \"/cucumber-runs/generateuploadurls\",\n {\n fileUris,\n runId,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n if (response.status === 403) {\n console.log(\"Warning: Your trial plan has ended. Cannot upload reports and perform retraining\");\n throw new Error(\"Warning: Your trial plan has ended. Cannot upload reports and perform retraining\");\n }\n if (response.status !== 200) {\n throw new Error(\"Failed to get pre-signed urls for the files\");\n }\n if (response.data.status !== true) {\n throw new Error(\"Failed to get pre-signed urls for the files\");\n }\n\n return response.data.uploadUrls;\n }\n\n async uploadTestCase(\n testCaseReport: JsonTestProgress,\n runId: string,\n projectId: string,\n reportFolder: string,\n rerunId?: string\n ) {\n const fileUris = [];\n //iterate over all the files in the JsonCommand.screenshotId and insert them into the fileUris array\n for (const step of testCaseReport.steps) {\n for (const command of step.commands) {\n if (command.screenshotId) {\n fileUris.push(\"screenshots\" + \"/\" + String(command.screenshotId) + \".png\");\n }\n }\n if (step.traceFilePath) {\n fileUris.push(\"trace\" + \"/\" + step.traceFilePath);\n }\n }\n // console.log({ fileUris })\n const preSignedUrls = await this.getPreSignedUrls(fileUris, runId);\n //upload all the files in the fileUris array\n try {\n for (let i = 0; i < fileUris.length; i += BATCH_SIZE) {\n const batch = fileUris.slice(i, Math.min(i + BATCH_SIZE, fileUris.length));\n await Promise.all(\n batch\n .filter((fileUri) => preSignedUrls[fileUri])\n .map(async (fileUri) => {\n for (let j = 0; j < MAX_RETRIES; j++) {\n if (existsSync(path.join(reportFolder, fileUri))) {\n const success = await this.uploadFile(path.join(reportFolder, fileUri), preSignedUrls[fileUri]);\n if (success) {\n return;\n }\n }\n const success = await this.uploadFile(\n path.join(reportFolder, fileUri),\n preSignedUrls[fileUri]\n )\n if (success) {\n return\n }\n }\n console.error(\"Failed to upload file:\", fileUri);\n })\n );\n }\n\n // writeFileSync(\"report.json\", JSON.stringify(testCaseReport, null, 2))\n const { data } = await axiosClient.post<FinishTestCaseResponse>(\n this.runsApiBaseURL + \"/cucumber-runs/createNewTestCase\",\n {\n runId,\n projectId,\n testProgressReport: testCaseReport,\n browser: process.env.BROWSER ? process.env.BROWSER : \"chromium\",\n mode: process.env.MODE === \"cloud\" ? \"cloud\" : \"local\",\n rerunId,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n\n try {\n await axiosClient.post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event: ActionEvents.upload_report,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n \"x-bvt-project-id\": projectId,\n },\n }\n );\n } catch (error) {\n // no event tracking\n }\n logReportLink(runId, projectId, testCaseReport.result);\n return data;\n } catch (e) {\n console.error(`failed to upload the test case: ${testCaseReport.id} ${e}`);\n return null;\n }\n }\n async uploadFile(filePath: string, preSignedUrl: string) {\n const fileStream = createReadStream(filePath);\n let success = true;\n try {\n const fileStats = await fs.stat(filePath);\n const fileSize = fileStats.size;\n\n await axiosClient.put(preSignedUrl, fileStream, {\n headers: {\n \"Content-Type\": \"application/octet-stream\",\n \"Content-Length\": fileSize,\n },\n });\n } catch (error) {\n if (process.env.NODE_ENV_BLINQ === \"dev\") {\n console.error(\"Error uploading file:\", error);\n }\n success = false;\n } finally {\n fileStream.close();\n }\n return success;\n }\n async uploadComplete(runId: string, projectId: string) {\n const response = await axiosClient.post(\n this.runsApiBaseURL + \"/cucumber-runs/uploadCompletion\",\n {\n runId,\n projectId,\n browser: process.env.BROWSER ? process.env.BROWSER : \"chromium\",\n mode: process.env.MODE === \"cloud\" ? \"cloud\" : \"local\",\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n if (response.status !== 200) {\n throw new Error(\"Failed to mark run as complete\");\n }\n if (response.data.status !== true) {\n throw new Error(\"Failed to mark run as complete\");\n }\n\n try {\n await axiosClient.post(\n `${SERVICES_URI.STORAGE}/event`,\n {\n event: ActionEvents.upload_report,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n \"x-bvt-project-id\": projectId,\n },\n }\n );\n } catch (error) {\n // no event tracking\n }\n }\n async modifyTestCase(runId: string, projectId: string, testProgressReport: JsonTestProgress) {\n try {\n const res = await axiosClient.post(\n this.runsApiBaseURL + \"/cucumber-runs/modifyTestCase\",\n {\n runId,\n projectId,\n testProgressReport,\n },\n {\n headers: {\n Authorization: \"Bearer \" + this.accessToken,\n \"x-source\": \"cucumber_js\",\n },\n }\n );\n if (res.status !== 200) {\n throw new Error(\"\");\n }\n if (res.data.status !== true) {\n throw new Error(\"\");\n }\n logReportLink(runId, projectId, testProgressReport.result);\n } catch (e) {\n console.error(`failed to modify the test case: ${testProgressReport.id} ${e}`);\n }\n }\n}\n\nexport { RunUploadService };\n"]}
|
|
@@ -44,7 +44,10 @@ class SummaryFormatter extends _1.default {
|
|
|
44
44
|
if (warnings.length > 0) {
|
|
45
45
|
this.logIssues({ issues: warnings, title: 'Warnings' });
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
if (bvt_analysis_formatter_1.globalReportLink) {
|
|
48
|
+
console.log(`Report link: ${bvt_analysis_formatter_1.globalReportLink}\n`);
|
|
49
|
+
}
|
|
50
|
+
console.log('check1');
|
|
48
51
|
this.log((0, helpers_1.formatSummary)({
|
|
49
52
|
colorFns: this.colorFns,
|
|
50
53
|
testCaseAttempts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAA4E;AAC5E,0CAAiD;AACjD,oDAAgD;AAGhD,2DAAuE;AACvE,kCAAmD;AACnD,qEAA2D;AAO3D,MAAqB,gBAAiB,SAAQ,UAAS;IAIrD,YAAY,OAA0B;QACp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H,CAAC;IAED,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAqB;QAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,CAAA;QACzB,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CACN,IAAA,qBAAW,EAAC;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,KAAK,GAAG,CAAC;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;gBACf,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;aACxC,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;;AApFH,mCAqFC;AApFwB,8BAAa,GAClC,yCAAyC,CAAA","sourcesContent":["import { formatIssue, formatSummary, isFailure, isWarning } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport { ITestCaseAttempt } from './helpers/event_data_collector'\nimport { formatUndefinedParameterTypes } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\nimport { globalReportLink } from './bvt_analysis_formatter'\n\ninterface ILogIssuesRequest {\n issues: ITestCaseAttempt[]\n title: string\n}\n\nexport default class SummaryFormatter extends Formatter {\n public static readonly documentation: string =\n 'Summary output of feature and scenarios'\n\n constructor(options: IFormatterOptions) {\n super(options)\n let testRunStartedTimestamp: messages.Timestamp\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunStarted)) {\n testRunStartedTimestamp = envelope.testRunStarted.timestamp\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n const testRunFinishedTimestamp = envelope.testRunFinished.timestamp\n this.logSummary(\n durationBetweenTimestamps(\n testRunStartedTimestamp,\n testRunFinishedTimestamp\n )\n )\n }\n })\n }\n\n logSummary(testRunDuration: messages.Duration): void {\n const failures: ITestCaseAttempt[] = []\n const warnings: ITestCaseAttempt[] = []\n const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts()\n testCaseAttempts.forEach((testCaseAttempt) => {\n if (\n isFailure(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n failures.push(testCaseAttempt)\n } else if (\n isWarning(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n warnings.push(testCaseAttempt)\n }\n })\n if (this.eventDataCollector.undefinedParameterTypes.length > 0) {\n this.log(\n formatUndefinedParameterTypes(\n this.eventDataCollector.undefinedParameterTypes\n )\n )\n }\n if (failures.length > 0) {\n this.logIssues({ issues: failures, title: 'Failures' })\n }\n if (warnings.length > 0) {\n this.logIssues({ issues: warnings, title: 'Warnings' })\n }\n if (globalReportLink) {\n console.log(`Report link: ${globalReportLink}\\n`);\n }\n console.log('check1');\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts,\n testRunDuration,\n })\n )\n }\n\n logIssues({ issues, title }: ILogIssuesRequest): void {\n this.log(`${title}:\\n\\n`)\n issues.forEach((testCaseAttempt, index) => {\n this.log(\n formatIssue({\n colorFns: this.colorFns,\n number: index + 1,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n printAttachments: this.printAttachments,\n })\n )\n })\n }\n}\n"]}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.0.
|
|
1
|
+
export declare const version = "1.0.170-dev";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,aAAa,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '1.0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,aAAa,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '1.0.170-dev'\n"]}
|