From bcdff02463e3bd7c42176c934afaaa5c34790898 Mon Sep 17 00:00:00 2001 From: rconner46 Date: Tue, 30 Jan 2024 11:10:39 -0600 Subject: [PATCH] Update heartbeat call --- dist/index.cjs | 24 +++--------------------- dist/index.cjs.map | 2 +- dist/index.min.js | 2 +- dist/index.min.js.map | 2 +- dist/index.mjs | 5 +++-- dist/index.mjs.map | 2 +- src/auto-api.ts | 9 +++------ 7 files changed, 13 insertions(+), 33 deletions(-) diff --git a/dist/index.cjs b/dist/index.cjs index bd68b79..edba57b 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -4,28 +4,8 @@ var axios = require('axios'); var fs = require('fs'); var path = require('path'); var Validator = require('validator'); -var queryString = require('querystring'); var mailparser = require('mailparser'); -function _interopNamespaceDefault(e) { - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== 'default') { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var queryString__namespace = /*#__PURE__*/_interopNamespaceDefault(queryString); - const API_VERSION = '1.0.0'; const validator = Validator.default; @@ -205,7 +185,9 @@ class AutoApi { this.callsInFlight += 1; try { // this filters out falsy values (null, undefined, 0) - return await this.client.post('/api/v2.0/sdk-heartbeat', queryString__namespace.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }); + return await this.client.post('/api/v2.0/sdk-heartbeat', { + testRunId: testRunId, + }); } finally { this.callsInFlight -= 1; diff --git a/dist/index.cjs.map b/dist/index.cjs.map index d753701..16ad4fb 100644 --- a/dist/index.cjs.map +++ b/dist/index.cjs.map @@ -1 +1 @@ -{"version":3,"file":"index.cjs","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/email-helper.ts","../src/heartbeat.ts","../src/reporter.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n this.client.interceptors.response.use(function (response) {\n return response;\n }, function (error) {\n // log and rethrow\n const errText = \n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data !== undefined\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n `error-code [${error.response.status}] with error [${error.response.statusText}]`;\n console.error(`Auto-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map"],"names":["existsSync","readFileSync","queryString","TestResultStatus","simpleParser","writeFileSync","pathJoin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACGlC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AACxB,MAAC,WAAW,GAAG,4CAA4C;AACvE;AACO,SAAS,UAAU,CAAC,WAAW,EAAE;AACxC;AACA,IAAI,IAAI,MAAM,GAAG;AACjB,QAAQ,OAAO,EAAE,WAAW;AAC5B,KAAK,CAAC;AACN;AACA,IAAI,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,EAAE;AAC3E,QAAQ,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAC9G,KAAK;AACL,SAAS;AACT;AACA,QAAQ,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC9D,KAAK;AACL;AACA,IAAI,IAAI,WAAW,KAAK,SAAS,I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zD,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAClF,SAAS;AACT,aAAa,IAAI,KAAK,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAAE;AAC7D,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACjF,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,kBAAkB;AAC1B,QAAQ,kBAAkB;AAC1B,QAAQ,YAAY,EAAE,MAAM;AAC5B,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAChG,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,uBAAuB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,aAAa,IAAI,CAAC,GAAG,CAAC;AACtB,aAAa,IAAI,EAAE;AACnB,KAAK,CAAC;AACN;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.cjs","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/email-helper.ts","../src/heartbeat.ts","../src/reporter.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n this.client.interceptors.response.use(function (response) {\n return response;\n }, function (error) {\n // log and rethrow\n const errText = \n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data !== undefined\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n `error-code [${error.response.status}] with error [${error.response.statusText}]`;\n console.error(`Auto-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', {\n testRunId: testRunId,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map"],"names":["existsSync","readFileSync","TestResultStatus","simpleParser","writeFileSync","pathJoin"],"mappings":";;;;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACGlC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AACxB,MAAC,WAAW,GAAG,4CAA4C;AACvE;AACO,SAAS,UAAU,CAAC,WAAW,EAAE;AACxC;AACA,IAAI,IAAI,MAAM,GAAG;AACjB,QAAQ,OAAO,EAAE,WAAW;AAC5B,KAAK,CAAC;AACN;AACA,IAAI,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,EAAE;AAC3E,QAAQ,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAC9G,KAAK;AACL,SAAS;AACT;AACA,QAAQ,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC9D,KAAK;AACL;AACA,IAAI,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,EAAE;AAC3E,QAAQ,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;AAChE,KAAK;AACL,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;AAC7B,QAAQ,MAAM,IAAI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,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACjF,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,kBAAkB;AAC1B,QAAQ,kBAAkB;AAC1B,QAAQ,YAAY,EAAE,MAAM;AAC5B,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAChG,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,uBAAuB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,aAAa,IAAI,CAAC,GAAG,CAAC;AACtB,aAAa,IAAI,EAAE;AACnB,KAAK,CAAC;AACN;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/index.min.js b/dist/index.min.js index 7da138f..be516db 100644 --- a/dist/index.min.js +++ b/dist/index.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("fs"),require("path"),require("validator"),require("querystring"),require("mailparser")):"function"==typeof define&&define.amd?define(["exports","axios","fs","path","validator","querystring","mailparser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["applause-reporter-common"]={},t.axios,t.fs,t.path,t.Validator,t.queryString,t.mailparser)}(this,(function(t,e,s,i,a,r,n){"use strict";function o(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}})),e.default=t,Object.freeze(e)}var l=o(r);const u=a.default,d="https://prod-auto-api.cloud.applause.com/";function c(t,e){return Object.assign({},t,Object.fromEntries(Object.entries(e||{}).filter((([t,e])=>void 0!==e))))}function p(t){return void 0!==t.baseUrl&&void 0!==t.apiKey&&void 0!==t.productId}function h(t){const e=t||process.cwd()+"/applause.json";if(!s.existsSync(e))return{};const i=s.readFileSync(e,"utf8");return JSON.parse(i)}function f(t){if(!Number.isInteger(t.productId)||t.productId<=0)throw new Error(`productId must be a positive integer, was: '${t.productId}'`);if(!u.isURL(t.baseUrl,{protocols:["http","https"],require_tld:!1,allow_query_components:!1,disallow_auth:!0,allow_fragments:!1,allow_protocol_relative_urls:!1,allow_trailing_dot:!1,require_host:!0,require_protocol:!0}))throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${t.baseUrl}`);if(u.isEmpty(t.apiKey))throw new Error("apiKey is an empty string!")}class g{options;client;callsInFlight;get getCallsInFlight(){return this.callsInFlight}constructor(t){this.options=t,this.callsInFlight=0,f(t),this.client=e.create({baseURL:t.baseUrl,timeout:1e4,headers:{"X-Api-Key":t.apiKey,"Context-Type":"application/json"},responseType:"json"}),this.client.interceptors.response.use((function(t){return t}),(function(t){const e=void 0!==t.data?t.data:`error-code [${t.response.status}] with error [${t.response.statusText}]`;return console.error(`Auto-Api returned ${e}`),Promise.reject(t)}))}async startTestRun(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/test-run/create",{...t,sdkVersion:"js:1.0.0",productId:this.options.productId,testRailReportingEnabled:void 0!==this.options.testRailOptions,addAllTestsToPlan:this.options.testRailOptions?.addAllTestsToPlan,testRailProjectId:this.options.testRailOptions?.projectId,testRailSuiteId:this.options.testRailOptions?.suiteId,testRailPlanName:this.options.testRailOptions?.planName,testRailRunName:this.options.testRailOptions?.runName,overrideTestRailRunNameUniqueness:this.options.testRailOptions?.overrideTestRailRunUniqueness})}finally{this.callsInFlight-=1}}async endTestRun(t){this.callsInFlight+=1;try{return await this.client.delete(`/api/v1.0/test-run/${t}?endingStatus=COMPLETE`)}finally{this.callsInFlight-=1}}async startTestCase(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/test-result/create-result",t)}finally{this.callsInFlight-=1}}async submitTestCaseResult(t){this.callsInFlight+=1;try{await this.client.post("/api/v1.0/test-result",t)}finally{this.callsInFlight-=1}}async getProviderSessionLinks(t){this.callsInFlight+=1;try{const e=t.filter((t=>t));return await this.client.post("/api/v1.0/test-result/provider-info",e)}finally{this.callsInFlight-=1}}async sendSdkHeartbeat(t){this.callsInFlight+=1;try{return await this.client.post("/api/v2.0/sdk-heartbeat",l.stringify({testRunId:t}),{headers:{"Content-Type":"application/x-www-form-urlencoded"}})}finally{this.callsInFlight-=1}}async getEmailAddress(t){this.callsInFlight+=1;try{return await this.client.get(`/api/v1.0/email/get-address?prefix=${t}`)}finally{this.callsInFlight-=1}}async getEmailContent(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/email/download-email",t)}finally{this.callsInFlight-=1}}}var R;t.TestResultStatus=void 0,(R=t.TestResultStatus||(t.TestResultStatus={})).NOT_RUN="NOT_RUN",R.IN_PROGRESS="IN_PROGRESS",R.PASSED="PASSED",R.FAILED="FAILED",R.SKIPPED="SKIPPED",R.CANCELED="CANCELED",R.ERROR="ERROR";class b{emailAddress;autoApi;constructor(t,e){this.emailAddress=t,this.autoApi=e}async getEmail(){const t=await this.autoApi.getEmailContent({emailAddress:this.emailAddress});return await n.simpleParser(t.data)}}class I{testRunId;autoApi;enabled=!1;nextHeartbeat;constructor(t,e){this.testRunId=t,this.autoApi=e}async start(){await this.end(),this.enabled=!0,this.scheduleNextHeartbeat()}isEnabled(){return this.enabled}scheduleNextHeartbeat(){this.enabled&&(this.nextHeartbeat=new Promise((t=>setTimeout(t,5e3))).then((()=>this.sendHeartbeat())))}async sendHeartbeat(){console.log("Sending heartbeat"),await this.autoApi.sendSdkHeartbeat(this.testRunId),console.log("Heartbeat sent"),this.scheduleNextHeartbeat()}async end(){void 0!==this.nextHeartbeat&&(this.enabled=!1,console.debug("Ending Applause SDK Heartbeat"),await this.nextHeartbeat,console.debug("Applause SDK Heartbeat Ended Successfully")),this.nextHeartbeat=void 0}}class w{autoApi;constructor(t){this.autoApi=t}async initializeRun(t){const e=t?.map(A).map((t=>t.testCaseName.trim())),s=await this.autoApi.startTestRun({tests:e||[]});if(s.status<200||s.status>300)throw new Error("Unable to create test run");const i=s.data.runId;console.log("Test Run %d initialized",i);const a=new I(i,this.autoApi);return await a.start(),new m(this.autoApi,i,a)}}class m{autoApi;testRunId;heartbeatService;uidToResultIdMap={};resultSubmissionMap={};constructor(t,e,s){this.autoApi=t,this.testRunId=e,this.heartbeatService=s}startTestCase(t,e,s){const i=A(e);this.uidToResultIdMap[t]=this.autoApi.startTestCase({testCaseName:i.testCaseName,testCaseId:i.testRailTestCaseId,itwTestCaseId:i.applauseTestCaseId,testRunId:this.testRunId,...Object.fromEntries(Object.entries(s||{}).filter((([t,e])=>void 0!==e)))}).then((t=>t.data.testResultId))}submitTestCaseResult(t,e,s){this.resultSubmissionMap[t]=this.uidToResultIdMap[t]?.then((t=>this.autoApi.submitTestCaseResult({status:e,testResultId:t,...s})))}async runnerEnd(){const t=await Promise.all(Object.values(this.uidToResultIdMap))||[];await Promise.all(Object.values(this.resultSubmissionMap)),await this.heartbeatService.end(),await this.autoApi.endTestRun(this.testRunId);const e=(await this.autoApi.getProviderSessionLinks(t)).data||[];if(e.length>0){console.info(JSON.stringify(e));const t=".";s.writeFileSync(i.join(t,"providerUrls.txt"),JSON.stringify(e,null,1))}}}const y="TestRail-",v="Applause-";function A(t){const e=t.split(" ");let s,i;return e.forEach((t=>{t?.startsWith(y)?(void 0!==s&&console.warn("Multiple TestRail case ids detected in testCase name"),s=t.substring(y.length)):t?.startsWith(v)&&(void 0!==i&&console.warn("Multiple Applause case ids detected in testCase name"),i=t.substring(v.length))})),{applauseTestCaseId:i,testRailTestCaseId:s,testCaseName:e.filter((t=>t!==`${y}${s||""}`)).filter((t=>t!==`${v}${i||""}`)).join(" ").trim()}}t.ApplauseReporter=class{autoApi;initializer;reporter;runStarted=!1;runFinished=!1;constructor(t){this.autoApi=new g(t),this.initializer=new w(this.autoApi)}runnerStart(t){this.reporter=this.initializer.initializeRun(t),this.reporter.then((()=>{this.runStarted=!0}))}startTestCase(t,e,s){if(void 0===this.reporter)throw new Error("Cannot start a test case for a run that was never initialized");this.reporter.then((i=>i.startTestCase(t,e,s)))}submitTestCaseResult(t,e,s){if(void 0===this.reporter)throw new Error("Cannot submit test case result for a run that was never initialized");this.reporter.then((i=>i.submitTestCaseResult(t,e,s)))}async runnerEnd(){if(void 0===this.reporter)throw new Error("Cannot end a run that was never initialized");await this.reporter.then((t=>t.runnerEnd())).then((()=>this.runFinished=!0))}isSynchronized(){return(!this.runStarted||this.runStarted&&this.runFinished)&&0==this.autoApi.getCallsInFlight}},t.AutoApi=g,t.DEFAULT_URL=d,t.EmailHelper=class{autoApi;constructor(t){this.autoApi=t}async getInbox(t){const e=(await this.autoApi.getEmailAddress(t)).data.emailAddress;return new b(e,this.autoApi)}},t.Inbox=b,t.RunInitializer=w,t.RunReporter=m,t.TestRunHeartbeatService=I,t.isComplete=p,t.loadConfig=function(t){let e={baseUrl:d};if(e=void 0!==t&&void 0!==t.configFile?c(e,h(i.join(process.cwd(),t.configFile))):c(e,h()),void 0!==t&&void 0!==t.properties&&(e=c(e,t.properties)),!p(e))throw new Error("Config is not complete");const s=e;return f(s),s},t.loadConfigFromFile=h,t.overrideConfig=c,t.validateConfig=f,t.validatePartialConfig=function(t){if(void 0!==t.productId&&(!Number.isInteger(t.productId)||t.productId<=0))throw new Error(`productId must be a positive integer, was: '${t.productId}'`)}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("fs"),require("path"),require("validator"),require("mailparser")):"function"==typeof define&&define.amd?define(["exports","axios","fs","path","validator","mailparser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["applause-reporter-common"]={},t.axios,t.fs,t.path,t.Validator,t.mailparser)}(this,(function(t,e,s,i,a,r){"use strict";const n=a.default,o="https://prod-auto-api.cloud.applause.com/";function l(t,e){return Object.assign({},t,Object.fromEntries(Object.entries(e||{}).filter((([t,e])=>void 0!==e))))}function u(t){return void 0!==t.baseUrl&&void 0!==t.apiKey&&void 0!==t.productId}function d(t){const e=t||process.cwd()+"/applause.json";if(!s.existsSync(e))return{};const i=s.readFileSync(e,"utf8");return JSON.parse(i)}function p(t){if(!Number.isInteger(t.productId)||t.productId<=0)throw new Error(`productId must be a positive integer, was: '${t.productId}'`);if(!n.isURL(t.baseUrl,{protocols:["http","https"],require_tld:!1,allow_query_components:!1,disallow_auth:!0,allow_fragments:!1,allow_protocol_relative_urls:!1,allow_trailing_dot:!1,require_host:!0,require_protocol:!0}))throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${t.baseUrl}`);if(n.isEmpty(t.apiKey))throw new Error("apiKey is an empty string!")}class c{options;client;callsInFlight;get getCallsInFlight(){return this.callsInFlight}constructor(t){this.options=t,this.callsInFlight=0,p(t),this.client=e.create({baseURL:t.baseUrl,timeout:1e4,headers:{"X-Api-Key":t.apiKey,"Context-Type":"application/json"},responseType:"json"}),this.client.interceptors.response.use((function(t){return t}),(function(t){const e=void 0!==t.data?t.data:`error-code [${t.response.status}] with error [${t.response.statusText}]`;return console.error(`Auto-Api returned ${e}`),Promise.reject(t)}))}async startTestRun(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/test-run/create",{...t,sdkVersion:"js:1.0.0",productId:this.options.productId,testRailReportingEnabled:void 0!==this.options.testRailOptions,addAllTestsToPlan:this.options.testRailOptions?.addAllTestsToPlan,testRailProjectId:this.options.testRailOptions?.projectId,testRailSuiteId:this.options.testRailOptions?.suiteId,testRailPlanName:this.options.testRailOptions?.planName,testRailRunName:this.options.testRailOptions?.runName,overrideTestRailRunNameUniqueness:this.options.testRailOptions?.overrideTestRailRunUniqueness})}finally{this.callsInFlight-=1}}async endTestRun(t){this.callsInFlight+=1;try{return await this.client.delete(`/api/v1.0/test-run/${t}?endingStatus=COMPLETE`)}finally{this.callsInFlight-=1}}async startTestCase(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/test-result/create-result",t)}finally{this.callsInFlight-=1}}async submitTestCaseResult(t){this.callsInFlight+=1;try{await this.client.post("/api/v1.0/test-result",t)}finally{this.callsInFlight-=1}}async getProviderSessionLinks(t){this.callsInFlight+=1;try{const e=t.filter((t=>t));return await this.client.post("/api/v1.0/test-result/provider-info",e)}finally{this.callsInFlight-=1}}async sendSdkHeartbeat(t){this.callsInFlight+=1;try{return await this.client.post("/api/v2.0/sdk-heartbeat",{testRunId:t})}finally{this.callsInFlight-=1}}async getEmailAddress(t){this.callsInFlight+=1;try{return await this.client.get(`/api/v1.0/email/get-address?prefix=${t}`)}finally{this.callsInFlight-=1}}async getEmailContent(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/email/download-email",t)}finally{this.callsInFlight-=1}}}var h;t.TestResultStatus=void 0,(h=t.TestResultStatus||(t.TestResultStatus={})).NOT_RUN="NOT_RUN",h.IN_PROGRESS="IN_PROGRESS",h.PASSED="PASSED",h.FAILED="FAILED",h.SKIPPED="SKIPPED",h.CANCELED="CANCELED",h.ERROR="ERROR";class R{emailAddress;autoApi;constructor(t,e){this.emailAddress=t,this.autoApi=e}async getEmail(){const t=await this.autoApi.getEmailContent({emailAddress:this.emailAddress});return await r.simpleParser(t.data)}}class f{testRunId;autoApi;enabled=!1;nextHeartbeat;constructor(t,e){this.testRunId=t,this.autoApi=e}async start(){await this.end(),this.enabled=!0,this.scheduleNextHeartbeat()}isEnabled(){return this.enabled}scheduleNextHeartbeat(){this.enabled&&(this.nextHeartbeat=new Promise((t=>setTimeout(t,5e3))).then((()=>this.sendHeartbeat())))}async sendHeartbeat(){console.log("Sending heartbeat"),await this.autoApi.sendSdkHeartbeat(this.testRunId),console.log("Heartbeat sent"),this.scheduleNextHeartbeat()}async end(){void 0!==this.nextHeartbeat&&(this.enabled=!1,console.debug("Ending Applause SDK Heartbeat"),await this.nextHeartbeat,console.debug("Applause SDK Heartbeat Ended Successfully")),this.nextHeartbeat=void 0}}class I{autoApi;constructor(t){this.autoApi=t}async initializeRun(t){const e=t?.map(w).map((t=>t.testCaseName.trim())),s=await this.autoApi.startTestRun({tests:e||[]});if(s.status<200||s.status>300)throw new Error("Unable to create test run");const i=s.data.runId;console.log("Test Run %d initialized",i);const a=new f(i,this.autoApi);return await a.start(),new g(this.autoApi,i,a)}}class g{autoApi;testRunId;heartbeatService;uidToResultIdMap={};resultSubmissionMap={};constructor(t,e,s){this.autoApi=t,this.testRunId=e,this.heartbeatService=s}startTestCase(t,e,s){const i=w(e);this.uidToResultIdMap[t]=this.autoApi.startTestCase({testCaseName:i.testCaseName,testCaseId:i.testRailTestCaseId,itwTestCaseId:i.applauseTestCaseId,testRunId:this.testRunId,...Object.fromEntries(Object.entries(s||{}).filter((([t,e])=>void 0!==e)))}).then((t=>t.data.testResultId))}submitTestCaseResult(t,e,s){this.resultSubmissionMap[t]=this.uidToResultIdMap[t]?.then((t=>this.autoApi.submitTestCaseResult({status:e,testResultId:t,...s})))}async runnerEnd(){const t=await Promise.all(Object.values(this.uidToResultIdMap))||[];await Promise.all(Object.values(this.resultSubmissionMap)),await this.heartbeatService.end(),await this.autoApi.endTestRun(this.testRunId);const e=(await this.autoApi.getProviderSessionLinks(t)).data||[];if(e.length>0){console.info(JSON.stringify(e));const t=".";s.writeFileSync(i.join(t,"providerUrls.txt"),JSON.stringify(e,null,1))}}}const m="TestRail-",b="Applause-";function w(t){const e=t.split(" ");let s,i;return e.forEach((t=>{t?.startsWith(m)?(void 0!==s&&console.warn("Multiple TestRail case ids detected in testCase name"),s=t.substring(m.length)):t?.startsWith(b)&&(void 0!==i&&console.warn("Multiple Applause case ids detected in testCase name"),i=t.substring(b.length))})),{applauseTestCaseId:i,testRailTestCaseId:s,testCaseName:e.filter((t=>t!==`${m}${s||""}`)).filter((t=>t!==`${b}${i||""}`)).join(" ").trim()}}t.ApplauseReporter=class{autoApi;initializer;reporter;runStarted=!1;runFinished=!1;constructor(t){this.autoApi=new c(t),this.initializer=new I(this.autoApi)}runnerStart(t){this.reporter=this.initializer.initializeRun(t),this.reporter.then((()=>{this.runStarted=!0}))}startTestCase(t,e,s){if(void 0===this.reporter)throw new Error("Cannot start a test case for a run that was never initialized");this.reporter.then((i=>i.startTestCase(t,e,s)))}submitTestCaseResult(t,e,s){if(void 0===this.reporter)throw new Error("Cannot submit test case result for a run that was never initialized");this.reporter.then((i=>i.submitTestCaseResult(t,e,s)))}async runnerEnd(){if(void 0===this.reporter)throw new Error("Cannot end a run that was never initialized");await this.reporter.then((t=>t.runnerEnd())).then((()=>this.runFinished=!0))}isSynchronized(){return(!this.runStarted||this.runStarted&&this.runFinished)&&0==this.autoApi.getCallsInFlight}},t.AutoApi=c,t.DEFAULT_URL=o,t.EmailHelper=class{autoApi;constructor(t){this.autoApi=t}async getInbox(t){const e=(await this.autoApi.getEmailAddress(t)).data.emailAddress;return new R(e,this.autoApi)}},t.Inbox=R,t.RunInitializer=I,t.RunReporter=g,t.TestRunHeartbeatService=f,t.isComplete=u,t.loadConfig=function(t){let e={baseUrl:o};if(e=void 0!==t&&void 0!==t.configFile?l(e,d(i.join(process.cwd(),t.configFile))):l(e,d()),void 0!==t&&void 0!==t.properties&&(e=l(e,t.properties)),!u(e))throw new Error("Config is not complete");const s=e;return p(s),s},t.loadConfigFromFile=d,t.overrideConfig=l,t.validateConfig=p,t.validatePartialConfig=function(t){if(void 0!==t.productId&&(!Number.isInteger(t.productId)||t.productId<=0))throw new Error(`productId must be a positive integer, was: '${t.productId}'`)}})); //# sourceMappingURL=index.min.js.map diff --git a/dist/index.min.js.map b/dist/index.min.js.map index b46bd45..c4b087b 100644 --- a/dist/index.min.js.map +++ b/dist/index.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.min.js","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/heartbeat.ts","../src/reporter.ts","../src/email-helper.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n this.client.interceptors.response.use(function (response) {\n return response;\n }, function (error) {\n // log and rethrow\n const errText = \n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data !== undefined\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n `error-code [${error.response.status}] with error [${error.response.statusText}]`;\n console.error(`Auto-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map"],"names":["validator","Validator","default","DEFAULT_URL","overrideConfig","config","overrides","Object","assign","fromEntries","entries","filter","_","v","undefined","isComplete","baseUrl","apiKey","productId","loadConfigFromFile","configFile","configFilePath","process","cwd","existsSync","fileCotents","readFileSync","JSON","parse","validateConfig","Number","isInteger","Error","isURL","protocols","require_tld","allow_query_components","disallow_auth","allow_fragments","allow_protocol_relative_urls","allow_trailing_dot","require_host","require_protocol","isEmpty","AutoApi","options","client","callsInFlight","getCallsInFlight","this","constructor","axios","create","baseURL","timeout","headers","responseType","interceptors","response","use","error","errText","data","status","statusText","console","Promise","reject","startTestRun","info","post","sdkVersion","testRailReportingEnabled","testRailOptions","addAllTestsToPlan","testRailProjectId","projectId","testRailSuiteId","suiteId","testRailPlanName","planName","testRailRunName","runName","overrideTestRailRunNameUniqueness","overrideTestRailRunUniqueness","endTestRun","testRunId","delete","startTestCase","params","submitTestCaseResult","getProviderSessionLinks","resultIds","validIds","id","sendSdkHeartbeat","queryString","stringify","getEmailAddress","emailPrefix","get","getEmailContent","request","TestResultStatus","exports","Inbox","emailAddress","autoApi","getEmail","res","simpleParser","TestRunHeartbeatService","enabled","nextHeartbeat","start","end","scheduleNextHeartbeat","isEnabled","resolve","setTimeout","then","sendHeartbeat","log","debug","RunInitializer","initializeRun","tests","cleanedTests","map","parseTestCaseName","parsed","testCaseName","trim","testRunCreateResponse","runId","heartbeatService","RunReporter","uidToResultIdMap","resultSubmissionMap","parsedTestCase","testCaseId","testRailTestCaseId","itwTestCaseId","applauseTestCaseId","testResultId","resultId","runnerEnd","all","values","jsonArray","length","outputPath","writeFileSync","pathJoin","join","TEST_RAIL_CASE_ID_PREFIX","APPLAUSE_CASE_ID_PREFIX","tokens","split","forEach","token","startsWith","warn","substring","initializer","reporter","runStarted","runFinished","runnerStart","isSynchronized","getInbox","generatedAddress","loadOptions","path","properties","finalConfig"],"mappings":"owBAAO,MCGDA,EAAYC,EAAUC,QACfC,EAAc,4CA2BpB,SAASC,EAAeC,EAAQC,GACnC,OAAOC,OAAOC,OAAO,GAAIH,EAAQE,OAAOE,YAAYF,OAAOG,QAAQJ,GAAa,CAAA,GAAIK,QAAO,EAAEC,EAAGC,UAAaC,IAAND,KAC3G,CACO,SAASE,EAAWV,GACvB,YAA2BS,IAAnBT,EAAOW,cACOF,IAAlBT,EAAOY,aACcH,IAArBT,EAAOa,SACf,CACO,SAASC,EAAmBC,GAC/B,MAAMC,EAAiBD,GAAcE,QAAQC,MAAQ,iBACrD,IAAKC,EAAAA,WAAWH,GACZ,MAAO,GAEX,MAAMI,EAAcC,EAAAA,aAAaL,EAAgB,QACjD,OAAOM,KAAKC,MAAMH,EACtB,CACO,SAASI,EAAexB,GAC3B,IAAKyB,OAAOC,UAAU1B,EAAOa,YAAcb,EAAOa,WAAa,EAC3D,MAAM,IAAIc,MAAM,+CAA+C3B,EAAOa,cAE1E,IAAKlB,EAAUiC,MAAM5B,EAAOW,QAAS,CACjCkB,UAAW,CAAC,OAAQ,SACpBC,aAAa,EACbC,wBAAwB,EACxBC,eAAe,EACfC,iBAAiB,EACjBC,8BAA8B,EAC9BC,oBAAoB,EACpBC,cAAc,EACdC,kBAAkB,IAElB,MA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B3E,IAAlBmC,KAAKoH,SACL,MAAM,IAAIrI,MAAM,uEAEfiB,KAAKoH,SAAS7C,MAAK6C,GAAYA,EAAS3E,qBAAqBI,EAAI/B,EAAQ0B,IACjF,CACD,eAAMyD,GACF,QAAsBpI,IAAlBmC,KAAKoH,SACL,MAAM,IAAIrI,MAAM,qDAEdiB,KAAKoH,SACN7C,MAAK6C,GAAYA,EAASnB,cAC1B1B,MAAK,IAAOvE,KAAKsH,aAAc,GACvC,CACD,cAAAE,GAEI,QAAUxH,KAAKqH,YAAerH,KAAKqH,YAAcrH,KAAKsH,cACjB,GAAjCtH,KAAK0D,QAAQ3D,gBACpB,6CC3CE,MACH2D,QACA,WAAAzD,CAAYyD,GACR1D,KAAK0D,QAAUA,CAClB,CACD,cAAM+D,CAASvE,GACX,MAAMwE,SAA0B1H,KAAK0D,QAAQT,gBAAgBC,IAAcrC,KAAK4C,aAChF,OAAO,IAAID,EAAMkE,EAAkB1H,KAAK0D,QAC3C,wGNHE,SAAoBiE,GAEvB,IAAIvK,EAAS,CACTW,QAASb,GAcb,GAVIE,OADgBS,IAAhB8J,QAAwD9J,IAA3B8J,EAAYxJ,WAChChB,EAAeC,EAAQc,EAAmB0J,EAAKnB,KAAKpI,QAAQC,MAAOqJ,EAAYxJ,cAI/EhB,EAAeC,EAAQc,UAGhBL,IAAhB8J,QAAwD9J,IAA3B8J,EAAYE,aACzCzK,EAASD,EAAeC,EAAQuK,EAAYE,cAE3C/J,EAAWV,GACZ,MAAM,IAAI2B,MAAM,0BAGpB,MAAM+I,EAAc1K,EAEpB,OADAwB,EAAekJ,GACRA,CACX,uFAsCO,SAA+B1K,GAClC,QAAyBS,IAArBT,EAAOa,aACLY,OAAOC,UAAU1B,EAAOa,YAAcb,EAAOa,WAAa,GAC5D,MAAM,IAAIc,MAAM,+CAA+C3B,EAAOa,aAE9E"} \ No newline at end of file +{"version":3,"file":"index.min.js","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/heartbeat.ts","../src/reporter.ts","../src/email-helper.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n this.client.interceptors.response.use(function (response) {\n return response;\n }, function (error) {\n // log and rethrow\n const errText = \n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data !== undefined\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n `error-code [${error.response.status}] with error [${error.response.statusText}]`;\n console.error(`Auto-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', {\n testRunId: testRunId,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map"],"names":["validator","Validator","default","DEFAULT_URL","overrideConfig","config","overrides","Object","assign","fromEntries","entries","filter","_","v","undefined","isComplete","baseUrl","apiKey","productId","loadConfigFromFile","configFile","configFilePath","process","cwd","existsSync","fileCotents","readFileSync","JSON","parse","validateConfig","Number","isInteger","Error","isURL","protocols","require_tld","allow_query_components","disallow_auth","allow_fragments","allow_protocol_relative_urls","allow_trailing_dot","require_host","require_protocol","isEmpty","AutoApi","options","client","callsInFlight","getCallsInFlight","this","constructor","axios","create","baseURL","timeout","headers","responseType","interceptors","response","use","error","errText","data","status","statusText","console","Promise","reject","startTestRun","info","post","sdkVersion","testRailReportingEnabled","testRailOptions","addAllTestsToPlan","testRailProjectId","projectId","testRailSuiteId","suiteId","testRailPlanName","planName","testRailRunName","runName","overrideTestRailRunNameUniqueness","overrideTestRailRunUniqueness","endTestRun","testRunId","delete","startTestCase","params","submitTestCaseResult","getProviderSessionLinks","resultIds","validIds","id","sendSdkHeartbeat","getEmailAddress","emailPrefix","get","getEmailContent","request","TestResultStatus","exports","Inbox","emailAddress","autoApi","getEmail","res","simpleParser","TestRunHeartbeatService","enabled","nextHeartbeat","start","end","scheduleNextHeartbeat","isEnabled","resolve","setTimeout","then","sendHeartbeat","log","debug","RunInitializer","initializeRun","tests","cleanedTests","map","parseTestCaseName","parsed","testCaseName","trim","testRunCreateResponse","runId","heartbeatService","RunReporter","uidToResultIdMap","resultSubmissionMap","parsedTestCase","testCaseId","testRailTestCaseId","itwTestCaseId","applauseTestCaseId","testResultId","resultId","runnerEnd","all","values","jsonArray","length","stringify","outputPath","writeFileSync","pathJoin","join","TEST_RAIL_CASE_ID_PREFIX","APPLAUSE_CASE_ID_PREFIX","tokens","split","forEach","token","startsWith","warn","substring","initializer","reporter","runStarted","runFinished","runnerStart","isSynchronized","getInbox","generatedAddress","loadOptions","path","properties","finalConfig"],"mappings":"icAAO,MCGDA,EAAYC,EAAUC,QACfC,EAAc,4CA2BpB,SAASC,EAAeC,EAAQC,GACnC,OAAOC,OAAOC,OAAO,GAAIH,EAAQE,OAAOE,YAAYF,OAAOG,QAAQJ,GAAa,CAAA,GAAIK,QAAO,EAAEC,EAAGC,UAAaC,IAAND,KAC3G,CACO,SAASE,EAAWV,GACvB,YAA2BS,IAAnBT,EAAOW,cACOF,IAAlBT,EAAOY,aACcH,IAArBT,EAAOa,SACf,CACO,SAASC,EAAmBC,GAC/B,MAAMC,EAAiBD,GAAcE,QAAQC,MAAQ,iBACrD,IAAKC,EAAAA,WAAWH,GACZ,MAAO,GAEX,MAAMI,EAAcC,EAAAA,aAAaL,EAAgB,QACjD,OAAOM,KAAKC,MAAMH,EACtB,CACO,SAASI,EAAexB,GAC3B,IAAKyB,OAAOC,UAAU1B,EAAOa,YAAcb,EAAOa,WAAa,EAC3D,MAAM,IAAIc,MAAM,+CAA+C3B,EAAOa,cAE1E,IAAKlB,EAAUiC,MAAM5B,EAAOW,QAAS,CACjCkB,UAAW,CAAC,OAAQ,SACpBC,aAAa,EACbC,wBAAwB,EACxBC,eAAe,EACfC,iBAAiB,EACjBC,8BAA8B,EAC9BC,oBAAoB,EACpBC,cAAc,EACdC,kBAAkB,IAEl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iB,KAAKmH,SAAS9C,MAAK8C,GAAYA,EAAS1E,qBAAqBI,EAAI/B,EAAQ0B,IACjF,CACD,eAAMuD,GACF,QAAsBlI,IAAlBmC,KAAKmH,SACL,MAAM,IAAIpI,MAAM,qDAEdiB,KAAKmH,SACN9C,MAAK8C,GAAYA,EAASpB,cAC1B1B,MAAK,IAAOrE,KAAKqH,aAAc,GACvC,CACD,cAAAE,GAEI,QAAUvH,KAAKoH,YAAepH,KAAKoH,YAAcpH,KAAKqH,cACjB,GAAjCrH,KAAKwD,QAAQzD,gBACpB,6CC3CE,MACHyD,QACA,WAAAvD,CAAYuD,GACRxD,KAAKwD,QAAUA,CAClB,CACD,cAAMgE,CAASxE,GACX,MAAMyE,SAA0BzH,KAAKwD,QAAQT,gBAAgBC,IAAcnC,KAAK0C,aAChF,OAAO,IAAID,EAAMmE,EAAkBzH,KAAKwD,QAC3C,wGNHE,SAAoBkE,GAEvB,IAAItK,EAAS,CACTW,QAASb,GAcb,GAVIE,OADgBS,IAAhB6J,QAAwD7J,IAA3B6J,EAAYvJ,WAChChB,EAAeC,EAAQc,EAAmByJ,EAAKnB,KAAKnI,QAAQC,MAAOoJ,EAAYvJ,cAI/EhB,EAAeC,EAAQc,UAGhBL,IAAhB6J,QAAwD7J,IAA3B6J,EAAYE,aACzCxK,EAASD,EAAeC,EAAQsK,EAAYE,cAE3C9J,EAAWV,GACZ,MAAM,IAAI2B,MAAM,0BAGpB,MAAM8I,EAAczK,EAEpB,OADAwB,EAAeiJ,GACRA,CACX,uFAsCO,SAA+BzK,GAClC,QAAyBS,IAArBT,EAAOa,aACLY,OAAOC,UAAU1B,EAAOa,YAAcb,EAAOa,WAAa,GAC5D,MAAM,IAAIc,MAAM,+CAA+C3B,EAAOa,aAE9E"} \ No newline at end of file diff --git a/dist/index.mjs b/dist/index.mjs index 6b4c527..2149ac9 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -2,7 +2,6 @@ import axios from 'axios'; import { existsSync, readFileSync, writeFileSync } from 'fs'; import path, { join } from 'path'; import Validator from 'validator'; -import * as queryString from 'querystring'; import { simpleParser } from 'mailparser'; const API_VERSION = '1.0.0'; @@ -184,7 +183,9 @@ class AutoApi { this.callsInFlight += 1; try { // this filters out falsy values (null, undefined, 0) - return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }); + return await this.client.post('/api/v2.0/sdk-heartbeat', { + testRunId: testRunId, + }); } finally { this.callsInFlight -= 1; diff --git a/dist/index.mjs.map b/dist/index.mjs.map index 986804d..0dd5046 100644 --- a/dist/index.mjs.map +++ b/dist/index.mjs.map @@ -1 +1 @@ -{"version":3,"file":"index.mjs","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/email-helper.ts","../src/heartbeat.ts","../src/reporter.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n this.client.interceptors.response.use(function (response) {\n return response;\n }, function (error) {\n // log and rethrow\n const errText = \n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data !== undefined\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n `error-code [${error.response.status}] with error [${error.response.statusText}]`;\n console.error(`Auto-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map"],"names":["pathJoin"],"mappings":";;;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACGlC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AACxB,MAAC,WAAW,GAAG,4CAA4C;A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C;AAChG,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,uBAAuB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,aAAa,IAAI,CAAC,GAAG,CAAC;AACtB,aAAa,IAAI,EAAE;AACnB,KAAK,CAAC;AACN;;;;"} \ No newline at end of file +{"version":3,"file":"index.mjs","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/email-helper.ts","../src/heartbeat.ts","../src/reporter.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n this.client.interceptors.response.use(function (response) {\n return response;\n }, function (error) {\n // log and rethrow\n const errText = \n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data !== undefined\n ? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n error.data\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n `error-code [${error.response.status}] with error [${error.response.statusText}]`;\n console.error(`Auto-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', {\n testRunId: testRunId,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map"],"names":["pathJoin"],"mappings":";;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACGlC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AACxB,MAAC,WAAW,GAAG,4CAA4C;AACvE;AACO,SAAS,UAAU,CAAC,WAAW,EAAE;AACxC;AACA,IAAI,IAAI,MAAM,GAAG;AACjB,QAAQ,OAAO,EAAE,WAAW;AAC5B,KAAK,CAAC;AACN;AACA,IAAI,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,EAAE;AAC3E,QAAQ,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC,IA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kBAAkB,CAAC;AAC3B,IAAI,IAAI,kBAAkB,CAAC;AAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI;AAC5B,QAAQ,IAAI,KAAK,EAAE,UAAU,CAAC,wBAAwB,CAAC,EAAE;AACzD,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAClF,SAAS;AACT,aAAa,IAAI,KAAK,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAAE;AAC7D,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACjF,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,kBAAkB;AAC1B,QAAQ,kBAAkB;AAC1B,QAAQ,YAAY,EAAE,MAAM;AAC5B,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAChG,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,uBAAuB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,aAAa,IAAI,CAAC,GAAG,CAAC;AACtB,aAAa,IAAI,EAAE;AACnB,KAAK,CAAC;AACN;;;;"} \ No newline at end of file diff --git a/src/auto-api.ts b/src/auto-api.ts index 5e97494..7d182de 100644 --- a/src/auto-api.ts +++ b/src/auto-api.ts @@ -11,7 +11,6 @@ import { } from './dto.ts'; import { API_VERSION } from './version.ts'; import { ApplauseConfig, validateConfig } from './config.ts'; -import * as queryString from 'querystring'; export class AutoApi { private readonly client: AxiosInstance; @@ -143,11 +142,9 @@ export class AutoApi { this.callsInFlight += 1; try { // this filters out falsy values (null, undefined, 0) - return await this.client.post( - '/api/v2.0/sdk-heartbeat', - queryString.stringify({ testRunId: testRunId }), - { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } } - ); + return await this.client.post('/api/v2.0/sdk-heartbeat', { + testRunId: testRunId, + }); } finally { this.callsInFlight -= 1; }