diff --git a/dist/index.cjs b/dist/index.cjs index eea377a..423ba28 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -488,7 +488,12 @@ class PublicApi { async submitResult(testCaseId, info) { this.callsInFlight += 1; try { - return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, info); + return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, { + ...info, + // override the sessionDetailsJson property with the + // stringified version that the server expects + sessionDetailsJson: JSON.stringify(info.sessionDetailsJson), + }); } finally { this.callsInFlight -= 1; diff --git a/dist/index.cjs.map b/dist/index.cjs.map index c71101e..4803546 100644 --- a/dist/index.cjs.map +++ b/dist/index.cjs.map @@ -1 +1 @@ -{"version":3,"file":"index.cjs","sources":["../src/auto-api/version.ts","../src/auto-api/auto-api-config.ts","../src/auto-api/auto-api.ts","../src/auto-api/dto.ts","../src/auto-api/email/inbox.ts","../src/auto-api/email-helper.ts","../src/auto-api/heartbeat.ts","../src/auto-api/reporter.ts","../src/public-api/dto.ts","../src/public-api/public-api-config.ts","../src/public-api/public-api.ts","../src/config/config.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\nexport const DEFAULT_AUTO_API_PROPERTIES = {\n autoApiBaseUrl: DEFAULT_URL,\n};\nexport function isAutoApiConfigComplete(config) {\n return (config.autoApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialAutoApiConfig(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}\nexport function validateAutoApiConfig(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.autoApiBaseUrl, {\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(`autoApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.autoApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=auto-api-config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateAutoApiConfig } from './auto-api-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 validateAutoApiConfig(options);\n this.client = axios.create({\n baseURL: options.autoApiBaseUrl,\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}\nexport const TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nexport const APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nexport function 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","export var TestRunAutoResultStatus;\n(function (TestRunAutoResultStatus) {\n TestRunAutoResultStatus[\"PASSED\"] = \"PASSED\";\n TestRunAutoResultStatus[\"FAILED\"] = \"FAILED\";\n TestRunAutoResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestRunAutoResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestRunAutoResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestRunAutoResultStatus || (TestRunAutoResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://api.applause.com/';\nexport const DEFAULT_PUBLIC_API_PROPERTIES = {\n publicApiBaseUrl: DEFAULT_URL,\n};\nexport function isPublicApiConfigComplete(config) {\n return (config.publicApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialPublicApiConfig(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}\nexport function validatePublicApiConfig(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.publicApiBaseUrl, {\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(`publicApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.publicApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=public-api-config.js.map","import axios from 'axios';\nimport { validatePublicApiConfig, } from './public-api-config.ts';\nexport class PublicApi {\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 validatePublicApiConfig(options);\n this.client = axios.create({\n baseURL: options.publicApiBaseUrl,\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(`Public-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async submitResult(testCaseId, info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, info);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=public-api.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport { DEFAULT_AUTO_API_PROPERTIES, isAutoApiConfigComplete, validateAutoApiConfig, } from '../auto-api/auto-api-config.ts';\nimport { DEFAULT_PUBLIC_API_PROPERTIES, isPublicApiConfigComplete, validatePublicApiConfig, } from '../public-api/public-api-config.ts';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n ...DEFAULT_PUBLIC_API_PROPERTIES,\n ...DEFAULT_AUTO_API_PROPERTIES,\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 isAutoApiConfigComplete(config) && isPublicApiConfigComplete(config);\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 validateAutoApiConfig(config);\n validatePublicApiConfig(config);\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"],"names":["validator","DEFAULT_URL","TestResultStatus","simpleParser","writeFileSync","pathJoin","TestRunAutoResultStatus","existsSync","readFileSync"],"mappings":";;;;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;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,KAAK,SAAS;AACtC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE;AACxE,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,4CAA4C,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,KAAK;AACL;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.cjs","sources":["../src/auto-api/version.ts","../src/auto-api/auto-api-config.ts","../src/auto-api/auto-api.ts","../src/auto-api/dto.ts","../src/auto-api/email/inbox.ts","../src/auto-api/email-helper.ts","../src/auto-api/heartbeat.ts","../src/auto-api/reporter.ts","../src/public-api/dto.ts","../src/public-api/public-api-config.ts","../src/public-api/public-api.ts","../src/config/config.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\nexport const DEFAULT_AUTO_API_PROPERTIES = {\n autoApiBaseUrl: DEFAULT_URL,\n};\nexport function isAutoApiConfigComplete(config) {\n return (config.autoApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialAutoApiConfig(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}\nexport function validateAutoApiConfig(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.autoApiBaseUrl, {\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(`autoApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.autoApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=auto-api-config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateAutoApiConfig } from './auto-api-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 validateAutoApiConfig(options);\n this.client = axios.create({\n baseURL: options.autoApiBaseUrl,\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}\nexport const TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nexport const APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nexport function 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","export var TestRunAutoResultStatus;\n(function (TestRunAutoResultStatus) {\n TestRunAutoResultStatus[\"PASSED\"] = \"PASSED\";\n TestRunAutoResultStatus[\"FAILED\"] = \"FAILED\";\n TestRunAutoResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestRunAutoResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestRunAutoResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestRunAutoResultStatus || (TestRunAutoResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://api.applause.com/';\nexport const DEFAULT_PUBLIC_API_PROPERTIES = {\n publicApiBaseUrl: DEFAULT_URL,\n};\nexport function isPublicApiConfigComplete(config) {\n return (config.publicApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialPublicApiConfig(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}\nexport function validatePublicApiConfig(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.publicApiBaseUrl, {\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(`publicApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.publicApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=public-api-config.js.map","import axios from 'axios';\nimport { validatePublicApiConfig, } from './public-api-config.ts';\nexport class PublicApi {\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 validatePublicApiConfig(options);\n this.client = axios.create({\n baseURL: options.publicApiBaseUrl,\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(`Public-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async submitResult(testCaseId, info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, {\n ...info,\n // override the sessionDetailsJson property with the\n // stringified version that the server expects\n sessionDetailsJson: JSON.stringify(info.sessionDetailsJson),\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=public-api.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport { DEFAULT_AUTO_API_PROPERTIES, isAutoApiConfigComplete, validateAutoApiConfig, } from '../auto-api/auto-api-config.ts';\nimport { DEFAULT_PUBLIC_API_PROPERTIES, isPublicApiConfigComplete, validatePublicApiConfig, } from '../public-api/public-api-config.ts';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n ...DEFAULT_PUBLIC_API_PROPERTIES,\n ...DEFAULT_AUTO_API_PROPERTIES,\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 isAutoApiConfigComplete(config) && isPublicApiConfigComplete(config);\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 validateAutoApiConfig(config);\n validatePublicApiConfig(config);\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"],"names":["validator","DEFAULT_URL","TestResultStatus","simpleParser","writeFileSync","pathJoin","TestRunAutoResultStatus","existsSync","readFileSync"],"mappings":";;;;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACClC,MAAMA,WAAS,GAAG,SAAS,CAAC,OAAO,C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;AACM,SAAS,qBAAqB,CAAC,MAAM,EAAE;AAC9C,IAAI,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS;AACtC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE;AACxE,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,4CAA4C,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,KAAK;AACL;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts index 7b3a652..5808e86 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -196,7 +196,7 @@ interface TestRunAutoResultDto { testCycleId: number; status: TestRunAutoResultStatus; failureReason?: string; - sessionDetailsJson?: object; + sessionDetailsJson?: SessionDetails; startTime?: Date; endTime?: Date; } @@ -207,6 +207,16 @@ declare enum TestRunAutoResultStatus { CANCELED = "CANCELED", ERROR = "ERROR" } +interface SessionDetails { + value: { + deviceName: string; + orientation: string; + platformName: string; + platformVersion: string; + browserName: string; + browserVersion: string; + }; +} interface PublicApiConfig { readonly publicApiBaseUrl: string; @@ -239,4 +249,4 @@ declare function loadConfigFromFile(configFile?: string): Partial): void; -export { APPLAUSE_CASE_ID_PREFIX, type AdditionalTestCaseParams, type AdditionalTestCaseResultParams, type ApplauseConfig, ApplauseReporter, type Attachment, AutoApi, type ClientConfig, type ConfigLoadProperties, type CreateTestCaseResultDto, type CreateTestCaseResultResponseDto, type EmailAddressResponse, type EmailFetchRequest, EmailHelper, Inbox, PublicApi, RunInitializer, RunReporter, type SubmitTestCaseResultDto, TEST_RAIL_CASE_ID_PREFIX, type TestRailOptions, type TestResultProviderInfo, TestResultStatus, type TestRunAutoResultDto, TestRunAutoResultStatus, type TestRunCreateDto, type TestRunCreateResponseDto, TestRunHeartbeatService, isComplete, loadConfig, loadConfigFromFile, overrideConfig, parseTestCaseName, validateConfig, validatePartialConfig }; +export { APPLAUSE_CASE_ID_PREFIX, type AdditionalTestCaseParams, type AdditionalTestCaseResultParams, type ApplauseConfig, ApplauseReporter, type Attachment, AutoApi, type ClientConfig, type ConfigLoadProperties, type CreateTestCaseResultDto, type CreateTestCaseResultResponseDto, type EmailAddressResponse, type EmailFetchRequest, EmailHelper, Inbox, PublicApi, RunInitializer, RunReporter, type SessionDetails, type SubmitTestCaseResultDto, TEST_RAIL_CASE_ID_PREFIX, type TestRailOptions, type TestResultProviderInfo, TestResultStatus, type TestRunAutoResultDto, TestRunAutoResultStatus, type TestRunCreateDto, type TestRunCreateResponseDto, TestRunHeartbeatService, isComplete, loadConfig, loadConfigFromFile, overrideConfig, parseTestCaseName, validateConfig, validatePartialConfig }; diff --git a/dist/index.min.js b/dist/index.min.js index eaeff67..8a3d45f 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("validator"),require("mailparser"),require("fs"),require("path")):"function"==typeof define&&define.amd?define(["exports","axios","validator","mailparser","fs","path"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["applause-reporter-common"]={},t.axios,t.Validator,t.mailparser,t.fs,t.path)}(this,(function(t,e,s,i,a,r){"use strict";const n=s.default,o={autoApiBaseUrl:"https://prod-auto-api.cloud.applause.com/"};function l(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.autoApiBaseUrl,{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(`autoApiBaseUrl is not valid HTTP/HTTPS URL, was: ${t.autoApiBaseUrl}`);if(n.isEmpty(t.apiKey))throw new Error("apiKey is an empty string!")}class u{options;client;callsInFlight;get getCallsInFlight(){return this.callsInFlight}constructor(t){this.options=t,this.callsInFlight=0,l(t),this.client=e.create({baseURL:t.autoApiBaseUrl,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 p;t.TestResultStatus=void 0,(p=t.TestResultStatus||(t.TestResultStatus={})).NOT_RUN="NOT_RUN",p.IN_PROGRESS="IN_PROGRESS",p.PASSED="PASSED",p.FAILED="FAILED",p.SKIPPED="SKIPPED",p.CANCELED="CANCELED",p.ERROR="ERROR";class d{emailAddress;autoApi;constructor(t,e){this.emailAddress=t,this.autoApi=e}async getEmail(){const t=await this.autoApi.getEmailContent({emailAddress:this.emailAddress});return await i.simpleParser(t.data)}}class c{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 h{autoApi;constructor(t){this.autoApi=t}async initializeRun(t){const e=t?.map(g).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 c(i,this.autoApi);return await a.start(),new I(this.autoApi,i,a)}}class I{autoApi;testRunId;heartbeatService;uidToResultIdMap={};resultSubmissionMap={};constructor(t,e,s){this.autoApi=t,this.testRunId=e,this.heartbeatService=s}startTestCase(t,e,s){const i=g(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=".";a.writeFileSync(r.join(t,"providerUrls.txt"),JSON.stringify(e,null,1))}}}const R="TestRail-",f="Applause-";function g(t){const e=t.split(" ");let s,i;return e.forEach((t=>{t?.startsWith(R)?(void 0!==s&&console.warn("Multiple TestRail case ids detected in testCase name"),s=t.substring(R.length)):t?.startsWith(f)&&(void 0!==i&&console.warn("Multiple Applause case ids detected in testCase name"),i=t.substring(f.length))})),{applauseTestCaseId:i,testRailTestCaseId:s,testCaseName:e.filter((t=>t!==`${R}${s||""}`)).filter((t=>t!==`${f}${i||""}`)).join(" ").trim()}}var w;t.TestRunAutoResultStatus=void 0,(w=t.TestRunAutoResultStatus||(t.TestRunAutoResultStatus={})).PASSED="PASSED",w.FAILED="FAILED",w.SKIPPED="SKIPPED",w.CANCELED="CANCELED",w.ERROR="ERROR";const A=s.default,m={publicApiBaseUrl:"https://api.applause.com/"};function b(t){if(!Number.isInteger(t.productId)||t.productId<=0)throw new Error(`productId must be a positive integer, was: '${t.productId}'`);if(!A.isURL(t.publicApiBaseUrl,{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(`publicApiBaseUrl is not valid HTTP/HTTPS URL, was: ${t.publicApiBaseUrl}`);if(A.isEmpty(t.apiKey))throw new Error("apiKey is an empty string!")}function y(t,e){return Object.assign({},t,Object.fromEntries(Object.entries(e||{}).filter((([t,e])=>void 0!==e))))}function E(t){return function(t){return void 0!==t.autoApiBaseUrl&&void 0!==t.apiKey&&void 0!==t.productId}(t)&&function(t){return void 0!==t.publicApiBaseUrl&&void 0!==t.apiKey&&void 0!==t.productId}(t)}function v(t){const e=t||process.cwd()+"/applause.json";if(!a.existsSync(e))return{};const s=a.readFileSync(e,"utf8");return JSON.parse(s)}function T(t){l(t),b(t)}t.APPLAUSE_CASE_ID_PREFIX=f,t.ApplauseReporter=class{autoApi;initializer;reporter;runStarted=!1;runFinished=!1;constructor(t){this.autoApi=new u(t),this.initializer=new h(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=u,t.EmailHelper=class{autoApi;constructor(t){this.autoApi=t}async getInbox(t){const e=(await this.autoApi.getEmailAddress(t)).data.emailAddress;return new d(e,this.autoApi)}},t.Inbox=d,t.PublicApi=class{options;client;callsInFlight;get getCallsInFlight(){return this.callsInFlight}constructor(t){this.options=t,this.callsInFlight=0,b(t),this.client=e.create({baseURL:t.publicApiBaseUrl,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(`Public-Api returned ${e}`),Promise.reject(t)}))}async submitResult(t,e){this.callsInFlight+=1;try{return await this.client.post(`v2/test-case-results/${t}/submit`,e)}finally{this.callsInFlight-=1}}},t.RunInitializer=h,t.RunReporter=I,t.TEST_RAIL_CASE_ID_PREFIX=R,t.TestRunHeartbeatService=c,t.isComplete=E,t.loadConfig=function(t){let e={...m,...o};if(e=void 0!==t&&void 0!==t.configFile?y(e,v(r.join(process.cwd(),t.configFile))):y(e,v()),void 0!==t&&void 0!==t.properties&&(e=y(e,t.properties)),!E(e))throw new Error("Config is not complete");const s=e;return T(s),s},t.loadConfigFromFile=v,t.overrideConfig=y,t.parseTestCaseName=g,t.validateConfig=T,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("validator"),require("mailparser"),require("fs"),require("path")):"function"==typeof define&&define.amd?define(["exports","axios","validator","mailparser","fs","path"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["applause-reporter-common"]={},t.axios,t.Validator,t.mailparser,t.fs,t.path)}(this,(function(t,e,s,i,a,r){"use strict";const n=s.default,o={autoApiBaseUrl:"https://prod-auto-api.cloud.applause.com/"};function l(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.autoApiBaseUrl,{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(`autoApiBaseUrl is not valid HTTP/HTTPS URL, was: ${t.autoApiBaseUrl}`);if(n.isEmpty(t.apiKey))throw new Error("apiKey is an empty string!")}class u{options;client;callsInFlight;get getCallsInFlight(){return this.callsInFlight}constructor(t){this.options=t,this.callsInFlight=0,l(t),this.client=e.create({baseURL:t.autoApiBaseUrl,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 p;t.TestResultStatus=void 0,(p=t.TestResultStatus||(t.TestResultStatus={})).NOT_RUN="NOT_RUN",p.IN_PROGRESS="IN_PROGRESS",p.PASSED="PASSED",p.FAILED="FAILED",p.SKIPPED="SKIPPED",p.CANCELED="CANCELED",p.ERROR="ERROR";class d{emailAddress;autoApi;constructor(t,e){this.emailAddress=t,this.autoApi=e}async getEmail(){const t=await this.autoApi.getEmailContent({emailAddress:this.emailAddress});return await i.simpleParser(t.data)}}class c{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 h{autoApi;constructor(t){this.autoApi=t}async initializeRun(t){const e=t?.map(g).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 c(i,this.autoApi);return await a.start(),new I(this.autoApi,i,a)}}class I{autoApi;testRunId;heartbeatService;uidToResultIdMap={};resultSubmissionMap={};constructor(t,e,s){this.autoApi=t,this.testRunId=e,this.heartbeatService=s}startTestCase(t,e,s){const i=g(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=".";a.writeFileSync(r.join(t,"providerUrls.txt"),JSON.stringify(e,null,1))}}}const R="TestRail-",f="Applause-";function g(t){const e=t.split(" ");let s,i;return e.forEach((t=>{t?.startsWith(R)?(void 0!==s&&console.warn("Multiple TestRail case ids detected in testCase name"),s=t.substring(R.length)):t?.startsWith(f)&&(void 0!==i&&console.warn("Multiple Applause case ids detected in testCase name"),i=t.substring(f.length))})),{applauseTestCaseId:i,testRailTestCaseId:s,testCaseName:e.filter((t=>t!==`${R}${s||""}`)).filter((t=>t!==`${f}${i||""}`)).join(" ").trim()}}var w;t.TestRunAutoResultStatus=void 0,(w=t.TestRunAutoResultStatus||(t.TestRunAutoResultStatus={})).PASSED="PASSED",w.FAILED="FAILED",w.SKIPPED="SKIPPED",w.CANCELED="CANCELED",w.ERROR="ERROR";const A=s.default,m={publicApiBaseUrl:"https://api.applause.com/"};function b(t){if(!Number.isInteger(t.productId)||t.productId<=0)throw new Error(`productId must be a positive integer, was: '${t.productId}'`);if(!A.isURL(t.publicApiBaseUrl,{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(`publicApiBaseUrl is not valid HTTP/HTTPS URL, was: ${t.publicApiBaseUrl}`);if(A.isEmpty(t.apiKey))throw new Error("apiKey is an empty string!")}function y(t,e){return Object.assign({},t,Object.fromEntries(Object.entries(e||{}).filter((([t,e])=>void 0!==e))))}function E(t){return function(t){return void 0!==t.autoApiBaseUrl&&void 0!==t.apiKey&&void 0!==t.productId}(t)&&function(t){return void 0!==t.publicApiBaseUrl&&void 0!==t.apiKey&&void 0!==t.productId}(t)}function v(t){const e=t||process.cwd()+"/applause.json";if(!a.existsSync(e))return{};const s=a.readFileSync(e,"utf8");return JSON.parse(s)}function T(t){l(t),b(t)}t.APPLAUSE_CASE_ID_PREFIX=f,t.ApplauseReporter=class{autoApi;initializer;reporter;runStarted=!1;runFinished=!1;constructor(t){this.autoApi=new u(t),this.initializer=new h(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=u,t.EmailHelper=class{autoApi;constructor(t){this.autoApi=t}async getInbox(t){const e=(await this.autoApi.getEmailAddress(t)).data.emailAddress;return new d(e,this.autoApi)}},t.Inbox=d,t.PublicApi=class{options;client;callsInFlight;get getCallsInFlight(){return this.callsInFlight}constructor(t){this.options=t,this.callsInFlight=0,b(t),this.client=e.create({baseURL:t.publicApiBaseUrl,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(`Public-Api returned ${e}`),Promise.reject(t)}))}async submitResult(t,e){this.callsInFlight+=1;try{return await this.client.post(`v2/test-case-results/${t}/submit`,{...e,sessionDetailsJson:JSON.stringify(e.sessionDetailsJson)})}finally{this.callsInFlight-=1}}},t.RunInitializer=h,t.RunReporter=I,t.TEST_RAIL_CASE_ID_PREFIX=R,t.TestRunHeartbeatService=c,t.isComplete=E,t.loadConfig=function(t){let e={...m,...o};if(e=void 0!==t&&void 0!==t.configFile?y(e,v(r.join(process.cwd(),t.configFile))):y(e,v()),void 0!==t&&void 0!==t.properties&&(e=y(e,t.properties)),!E(e))throw new Error("Config is not complete");const s=e;return T(s),s},t.loadConfigFromFile=v,t.overrideConfig=y,t.parseTestCaseName=g,t.validateConfig=T,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 5bd3daa..98d49ce 100644 --- a/dist/index.min.js.map +++ b/dist/index.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.min.js","sources":["../src/auto-api/version.ts","../src/auto-api/auto-api-config.ts","../src/auto-api/auto-api.ts","../src/auto-api/dto.ts","../src/auto-api/email/inbox.ts","../src/auto-api/heartbeat.ts","../src/auto-api/reporter.ts","../src/public-api/dto.ts","../src/public-api/public-api-config.ts","../src/config/config.ts","../src/auto-api/email-helper.ts","../src/public-api/public-api.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\nexport const DEFAULT_AUTO_API_PROPERTIES = {\n autoApiBaseUrl: DEFAULT_URL,\n};\nexport function isAutoApiConfigComplete(config) {\n return (config.autoApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialAutoApiConfig(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}\nexport function validateAutoApiConfig(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.autoApiBaseUrl, {\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(`autoApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.autoApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=auto-api-config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateAutoApiConfig } from './auto-api-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 validateAutoApiConfig(options);\n this.client = axios.create({\n baseURL: options.autoApiBaseUrl,\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}\nexport const TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nexport const APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nexport function 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","export var TestRunAutoResultStatus;\n(function (TestRunAutoResultStatus) {\n TestRunAutoResultStatus[\"PASSED\"] = \"PASSED\";\n TestRunAutoResultStatus[\"FAILED\"] = \"FAILED\";\n TestRunAutoResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestRunAutoResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestRunAutoResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestRunAutoResultStatus || (TestRunAutoResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://api.applause.com/';\nexport const DEFAULT_PUBLIC_API_PROPERTIES = {\n publicApiBaseUrl: DEFAULT_URL,\n};\nexport function isPublicApiConfigComplete(config) {\n return (config.publicApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialPublicApiConfig(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}\nexport function validatePublicApiConfig(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.publicApiBaseUrl, {\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(`publicApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.publicApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=public-api-config.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport { DEFAULT_AUTO_API_PROPERTIES, isAutoApiConfigComplete, validateAutoApiConfig, } from '../auto-api/auto-api-config.ts';\nimport { DEFAULT_PUBLIC_API_PROPERTIES, isPublicApiConfigComplete, validatePublicApiConfig, } from '../public-api/public-api-config.ts';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n ...DEFAULT_PUBLIC_API_PROPERTIES,\n ...DEFAULT_AUTO_API_PROPERTIES,\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 isAutoApiConfigComplete(config) && isPublicApiConfigComplete(config);\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 validateAutoApiConfig(config);\n validatePublicApiConfig(config);\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 { 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","import axios from 'axios';\nimport { validatePublicApiConfig, } from './public-api-config.ts';\nexport class PublicApi {\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 validatePublicApiConfig(options);\n this.client = axios.create({\n baseURL: options.publicApiBaseUrl,\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(`Public-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async submitResult(testCaseId, info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, info);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=public-api.js.map"],"names":["validator","Validator","default","DEFAULT_AUTO_API_PROPERTIES","autoApiBaseUrl","validateAutoApiConfig","config","Number","isInteger","productId","Error","isURL","protocols","require_tld","allow_query_components","disallow_auth","allow_fragments","allow_protocol_relative_urls","allow_trailing_dot","require_host","require_protocol","isEmpty","apiKey","AutoApi","options","client","callsInFlight","getCallsInFlight","this","constructor","axios","create","baseURL","timeout","headers","responseType","interceptors","response","use","error","errText","undefined","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","filter","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","Object","fromEntries","entries","_","v","testResultId","resultId","runnerEnd","all","values","jsonArray","length","JSON","stringify","outputPath","writeFileSync","pathJoin","join","TEST_RAIL_CASE_ID_PREFIX","APPLAUSE_CASE_ID_PREFIX","tokens","split","forEach","token","startsWith","warn","substring","TestRunAutoResultStatus","DEFAULT_PUBLIC_API_PROPERTIES","publicApiBaseUrl","validatePublicApiConfig","overrideConfig","overrides","assign","isComplete","isAutoApiConfigComplete","isPublicApiConfigComplete","loadConfigFromFile","configFile","configFilePath","process","cwd","existsSync","fileCotents","readFileSync","parse","validateConfig","initializer","reporter","runStarted","runFinished","runnerStart","isSynchronized","getInbox","generatedAddress","submitResult","loadOptions","path","properties","finalConfig"],"mappings":"icAAO,MCCDA,EAAYC,EAAUC,QAEfC,EAA8B,CACvCC,eAFuB,6CA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,YAAaV,EAAQF,OACrB,eAAgB,oBAEpBa,aAAc,SAElBP,KAAKH,OAAOW,aAAaC,SAASC,KAAI,SAAUD,GAC5C,OAAOA,CACV,IAAE,SAAUE,GAET,MAAMC,OAESC,IAAfF,EAAMG,KAEEH,EAAMG,KAEN,eAAeH,EAAMF,SAASM,uBAAuBJ,EAAMF,SAASO,cAE5E,OADAC,QAAQN,MAAM,uBAAuBC,KAC9BM,QAAQC,OAAOR,EAClC,GACK,CACD,kBAAM2I,CAAa3D,EAAYtE,GAC3BrB,KAAKF,eAAiB,EACtB,IACI,aAAaE,KAAKH,OAAOyB,KAAK,wBAAwBqE,WAAqBtE,EAC9E,CACO,QACJrB,KAAKF,eAAiB,CACzB,CACJ,2HF3CE,SAAoByJ,GAEvB,IAAI7K,EAAS,IACNiJ,KACApJ,GAcP,GAVIG,OADgBmC,IAAhB0I,QAAwD1I,IAA3B0I,EAAYlB,WAChCP,EAAepJ,EAAQ0J,EAAmBoB,EAAKxC,KAAKuB,QAAQC,MAAOe,EAAYlB,cAI/EP,EAAepJ,EAAQ0J,UAGhBvH,IAAhB0I,QAAwD1I,IAA3B0I,EAAYE,aACzC/K,EAASoJ,EAAepJ,EAAQ6K,EAAYE,cAE3CxB,EAAWvJ,GACZ,MAAM,IAAII,MAAM,0BAGpB,MAAM4K,EAAchL,EAEpB,OADAmK,EAAea,GACRA,CACX,6GAmBO,SAA+BhL,GAClC,QAAyBmC,IAArBnC,EAAOG,aACLF,OAAOC,UAAUF,EAAOG,YAAcH,EAAOG,WAAa,GAC5D,MAAM,IAAIC,MAAM,+CAA+CJ,EAAOG,aAE9E"} \ No newline at end of file +{"version":3,"file":"index.min.js","sources":["../src/auto-api/version.ts","../src/auto-api/auto-api-config.ts","../src/auto-api/auto-api.ts","../src/auto-api/dto.ts","../src/auto-api/email/inbox.ts","../src/auto-api/heartbeat.ts","../src/auto-api/reporter.ts","../src/public-api/dto.ts","../src/public-api/public-api-config.ts","../src/config/config.ts","../src/auto-api/email-helper.ts","../src/public-api/public-api.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\nexport const DEFAULT_AUTO_API_PROPERTIES = {\n autoApiBaseUrl: DEFAULT_URL,\n};\nexport function isAutoApiConfigComplete(config) {\n return (config.autoApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialAutoApiConfig(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}\nexport function validateAutoApiConfig(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.autoApiBaseUrl, {\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(`autoApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.autoApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=auto-api-config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateAutoApiConfig } from './auto-api-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 validateAutoApiConfig(options);\n this.client = axios.create({\n baseURL: options.autoApiBaseUrl,\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}\nexport const TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nexport const APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nexport function 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","export var TestRunAutoResultStatus;\n(function (TestRunAutoResultStatus) {\n TestRunAutoResultStatus[\"PASSED\"] = \"PASSED\";\n TestRunAutoResultStatus[\"FAILED\"] = \"FAILED\";\n TestRunAutoResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestRunAutoResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestRunAutoResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestRunAutoResultStatus || (TestRunAutoResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://api.applause.com/';\nexport const DEFAULT_PUBLIC_API_PROPERTIES = {\n publicApiBaseUrl: DEFAULT_URL,\n};\nexport function isPublicApiConfigComplete(config) {\n return (config.publicApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialPublicApiConfig(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}\nexport function validatePublicApiConfig(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.publicApiBaseUrl, {\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(`publicApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.publicApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=public-api-config.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport { DEFAULT_AUTO_API_PROPERTIES, isAutoApiConfigComplete, validateAutoApiConfig, } from '../auto-api/auto-api-config.ts';\nimport { DEFAULT_PUBLIC_API_PROPERTIES, isPublicApiConfigComplete, validatePublicApiConfig, } from '../public-api/public-api-config.ts';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n ...DEFAULT_PUBLIC_API_PROPERTIES,\n ...DEFAULT_AUTO_API_PROPERTIES,\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 isAutoApiConfigComplete(config) && isPublicApiConfigComplete(config);\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 validateAutoApiConfig(config);\n validatePublicApiConfig(config);\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 { 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","import axios from 'axios';\nimport { validatePublicApiConfig, } from './public-api-config.ts';\nexport class PublicApi {\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 validatePublicApiConfig(options);\n this.client = axios.create({\n baseURL: options.publicApiBaseUrl,\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(`Public-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async submitResult(testCaseId, info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, {\n ...info,\n // override the sessionDetailsJson property with the\n // stringified version that the server expects\n sessionDetailsJson: JSON.stringify(info.sessionDetailsJson),\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=public-api.js.map"],"names":["validator","Validator","default","DEFAULT_AUTO_API_PROPERTIES","autoApiBaseUrl","validateAutoApiConfig","config","Number","isInteger","productId","Error","isURL","protocols","require_tld","allow_query_components","disallow_auth","allow_fragments","allow_protocol_relative_urls","allow_trailing_dot","require_host","require_protocol","isEmpty","apiKey","AutoApi","options","client","callsInFlight","getCallsInFlight","this","constructor","axios","create","baseURL","timeout","headers","responseType","interceptors","response","use","error","errText","undefined","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","filter","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","Object","fromEntries","entries","_","v","testResultId","resultId","runnerEnd","all","values","jsonArray","length","JSON","stringify","outputPath","writeFileSync","pathJoin","join","TEST_RAIL_CASE_ID_PREFIX","APPLAUSE_CASE_ID_PREFIX","tokens","split","forEach","token","startsWith","warn","substring","TestRunAutoResultStatus","DEFAULT_PUBLIC_API_PROPERTIES","publicApiBaseUrl","validatePublicApiConfig","overrideConfig","overrides","assign","isComplete","isAutoApiConfigComplete","isPublicApiConfigComplete","loadConfigFromFile","configFile","configFilePath","process","cwd","existsSync","fileCotents","readFileSync","parse","validateConfig","initializer","reporter","runStarted","runFinished","runnerStart","isSynchronized","getInbox","generatedAddress","submitResult","sessionDetailsJson","loadOptions","path","properties","finalConfig"],"mappings":"icAAO,MCCDA,EAAYC,EAAUC,QAEfC,EAA8B,CACvCC,eAFuB,6CAepB,SAASC,EAAsBC,GAClC,IAAKC,OAAOC,UAAUF,EAAOG,YAAcH,EAAOG,WAAa,EAC3D,MAAM,IAAIC,MAAM,+CAA+CJ,EAAOG,cAE1E,IAAKT,EAAUW,MAAML,EAAOF,eAAgB,CACxCQ,UAAW,CAAC,OAAQ,SACpBC,aAAa,EACbC,wBAAwB,EACxBC,eAAe,EACfC,iBAAiB,EACjBC,8BAA8B,EAC9BC,oBAAoB,EACpBC,cAAc,EACdC,kBAAkB,IAElB,MAAM,IAAIV,MAAM,oDAAoDJ,EAAOF,kBAE/E,GAAIJ,EAAUqB,QAAQf,EAAOgB,QACzB,MAAM,IAAIZ,MAAM,6BAExB,CClCO,MAAMa,EACTC,QACAC,OACAC,cAIA,oBAAIC,GACA,OAAOC,KAAKF,aACf,CACD,WAAAG,CAAYL,GACRI,KAAKJ,QAAUA,EACfI,KAAKF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,IACNiJ,KACApJ,GAcP,GAVIG,OADgBmC,IAAhB2I,QAAwD3I,IAA3B2I,EAAYnB,WAChCP,EAAepJ,EAAQ0J,EAAmBqB,EAAKzC,KAAKuB,QAAQC,MAAOgB,EAAYnB,cAI/EP,EAAepJ,EAAQ0J,UAGhBvH,IAAhB2I,QAAwD3I,IAA3B2I,EAAYE,aACzChL,EAASoJ,EAAepJ,EAAQ8K,EAAYE,cAE3CzB,EAAWvJ,GACZ,MAAM,IAAII,MAAM,0BAGpB,MAAM6K,EAAcjL,EAEpB,OADAmK,EAAec,GACRA,CACX,6GAmBO,SAA+BjL,GAClC,QAAyBmC,IAArBnC,EAAOG,aACLF,OAAOC,UAAUF,EAAOG,YAAcH,EAAOG,WAAa,GAC5D,MAAM,IAAIC,MAAM,+CAA+CJ,EAAOG,aAE9E"} \ No newline at end of file diff --git a/dist/index.mjs b/dist/index.mjs index 38da9b9..11d2903 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -486,7 +486,12 @@ class PublicApi { async submitResult(testCaseId, info) { this.callsInFlight += 1; try { - return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, info); + return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, { + ...info, + // override the sessionDetailsJson property with the + // stringified version that the server expects + sessionDetailsJson: JSON.stringify(info.sessionDetailsJson), + }); } finally { this.callsInFlight -= 1; diff --git a/dist/index.mjs.map b/dist/index.mjs.map index 2c0f91d..08125d2 100644 --- a/dist/index.mjs.map +++ b/dist/index.mjs.map @@ -1 +1 @@ -{"version":3,"file":"index.mjs","sources":["../src/auto-api/version.ts","../src/auto-api/auto-api-config.ts","../src/auto-api/auto-api.ts","../src/auto-api/dto.ts","../src/auto-api/email/inbox.ts","../src/auto-api/email-helper.ts","../src/auto-api/heartbeat.ts","../src/auto-api/reporter.ts","../src/public-api/dto.ts","../src/public-api/public-api-config.ts","../src/public-api/public-api.ts","../src/config/config.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\nexport const DEFAULT_AUTO_API_PROPERTIES = {\n autoApiBaseUrl: DEFAULT_URL,\n};\nexport function isAutoApiConfigComplete(config) {\n return (config.autoApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialAutoApiConfig(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}\nexport function validateAutoApiConfig(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.autoApiBaseUrl, {\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(`autoApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.autoApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=auto-api-config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateAutoApiConfig } from './auto-api-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 validateAutoApiConfig(options);\n this.client = axios.create({\n baseURL: options.autoApiBaseUrl,\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}\nexport const TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nexport const APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nexport function 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","export var TestRunAutoResultStatus;\n(function (TestRunAutoResultStatus) {\n TestRunAutoResultStatus[\"PASSED\"] = \"PASSED\";\n TestRunAutoResultStatus[\"FAILED\"] = \"FAILED\";\n TestRunAutoResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestRunAutoResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestRunAutoResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestRunAutoResultStatus || (TestRunAutoResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://api.applause.com/';\nexport const DEFAULT_PUBLIC_API_PROPERTIES = {\n publicApiBaseUrl: DEFAULT_URL,\n};\nexport function isPublicApiConfigComplete(config) {\n return (config.publicApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialPublicApiConfig(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}\nexport function validatePublicApiConfig(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.publicApiBaseUrl, {\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(`publicApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.publicApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=public-api-config.js.map","import axios from 'axios';\nimport { validatePublicApiConfig, } from './public-api-config.ts';\nexport class PublicApi {\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 validatePublicApiConfig(options);\n this.client = axios.create({\n baseURL: options.publicApiBaseUrl,\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(`Public-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async submitResult(testCaseId, info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, info);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=public-api.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport { DEFAULT_AUTO_API_PROPERTIES, isAutoApiConfigComplete, validateAutoApiConfig, } from '../auto-api/auto-api-config.ts';\nimport { DEFAULT_PUBLIC_API_PROPERTIES, isPublicApiConfigComplete, validatePublicApiConfig, } from '../public-api/public-api-config.ts';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n ...DEFAULT_PUBLIC_API_PROPERTIES,\n ...DEFAULT_AUTO_API_PROPERTIES,\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 isAutoApiConfigComplete(config) && isPublicApiConfigComplete(config);\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 validateAutoApiConfig(config);\n validatePublicApiConfig(config);\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"],"names":["validator","DEFAULT_URL","pathJoin"],"mappings":";;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACClC,MAAMA,WAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AAC7B,MAAMC,aAAW,GAAG,2CAA2C,CAAC;AAChE,MAAM,2BAA2B,GAAG;AAC3C,IAAI,cAAc,EAAEA,aAAW;AAC/B,CAAC,CAAC;AACK,SAAS,uBAAuB,CAAC,MAAM,EAAE;AAChD,IAAI,QAAQ,MAAM,CAAC,cAAc,KAAK,SAAS;AAC/C,QAAQ,MAAM,CAAC,MAAM,KAAK,SAAS;AACnC,QAAQ,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE;AACxC,CAAC;AAOM,SAAS,qBAAqB,CAAC,MAAM,EAAE;AAC9C,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,EAAE;AACtE,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,4CAA4C,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,KAAK;AACL,IAAI,IAAI,CAACD,WAAS,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE;AAChD,QAAQ,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,C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E,GAAG,gBAAgB,CAAC;AAC1E,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;AACrC,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,WAAW,GAAG,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC7D,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AACM,SAAS,cAAc,CAAC,MAAM,EAAE;AACvC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAClC,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AACM,SAAS,qBAAqB,CAAC,MAAM,EAAE;AAC9C,IAAI,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS;AACtC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE;AACxE,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,4CAA4C,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,KAAK;AACL;;;;"} \ No newline at end of file +{"version":3,"file":"index.mjs","sources":["../src/auto-api/version.ts","../src/auto-api/auto-api-config.ts","../src/auto-api/auto-api.ts","../src/auto-api/dto.ts","../src/auto-api/email/inbox.ts","../src/auto-api/email-helper.ts","../src/auto-api/heartbeat.ts","../src/auto-api/reporter.ts","../src/public-api/dto.ts","../src/public-api/public-api-config.ts","../src/public-api/public-api.ts","../src/config/config.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\nexport const DEFAULT_AUTO_API_PROPERTIES = {\n autoApiBaseUrl: DEFAULT_URL,\n};\nexport function isAutoApiConfigComplete(config) {\n return (config.autoApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialAutoApiConfig(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}\nexport function validateAutoApiConfig(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.autoApiBaseUrl, {\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(`autoApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.autoApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=auto-api-config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateAutoApiConfig } from './auto-api-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 validateAutoApiConfig(options);\n this.client = axios.create({\n baseURL: options.autoApiBaseUrl,\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}\nexport const TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nexport const APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nexport function 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","export var TestRunAutoResultStatus;\n(function (TestRunAutoResultStatus) {\n TestRunAutoResultStatus[\"PASSED\"] = \"PASSED\";\n TestRunAutoResultStatus[\"FAILED\"] = \"FAILED\";\n TestRunAutoResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestRunAutoResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestRunAutoResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestRunAutoResultStatus || (TestRunAutoResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://api.applause.com/';\nexport const DEFAULT_PUBLIC_API_PROPERTIES = {\n publicApiBaseUrl: DEFAULT_URL,\n};\nexport function isPublicApiConfigComplete(config) {\n return (config.publicApiBaseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function validatePartialPublicApiConfig(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}\nexport function validatePublicApiConfig(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.publicApiBaseUrl, {\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(`publicApiBaseUrl is not valid HTTP/HTTPS URL, was: ${config.publicApiBaseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\n//# sourceMappingURL=public-api-config.js.map","import axios from 'axios';\nimport { validatePublicApiConfig, } from './public-api-config.ts';\nexport class PublicApi {\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 validatePublicApiConfig(options);\n this.client = axios.create({\n baseURL: options.publicApiBaseUrl,\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(`Public-Api returned ${errText}`);\n return Promise.reject(error);\n });\n }\n async submitResult(testCaseId, info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post(`v2/test-case-results/${testCaseId}/submit`, {\n ...info,\n // override the sessionDetailsJson property with the\n // stringified version that the server expects\n sessionDetailsJson: JSON.stringify(info.sessionDetailsJson),\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=public-api.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport { DEFAULT_AUTO_API_PROPERTIES, isAutoApiConfigComplete, validateAutoApiConfig, } from '../auto-api/auto-api-config.ts';\nimport { DEFAULT_PUBLIC_API_PROPERTIES, isPublicApiConfigComplete, validatePublicApiConfig, } from '../public-api/public-api-config.ts';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n ...DEFAULT_PUBLIC_API_PROPERTIES,\n ...DEFAULT_AUTO_API_PROPERTIES,\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 isAutoApiConfigComplete(config) && isPublicApiConfigComplete(config);\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 validateAutoApiConfig(config);\n validatePublicApiConfig(config);\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"],"names":["validator","DEFAULT_URL","pathJoin"],"mappings":";;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACClC,MAAMA,WAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AAC7B,MAAMC,aAAW,GAAG,2CAA2C,CAAC;AAChE,MAAM,2BAA2B,GAAG;AAC3C,IAAI,cAAc,EAAEA,aAAW;AAC/B,CAAC,CAAC;AACK,SAAS,uBAAuB,CAAC,MAAM,EAAE;AAChD,IAAI,QAAQ,MAAM,CAAC,cAAc,KAAK,SAAS;AAC/C,QAAQ,MAAM,CAAC,MAAM,KAAK,SAAS;AACnC,QAAQ,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE;AACxC,CAAC;AAOM,SAAS,qBAAqB,CAAC,MAAM,EAAE;AAC9C,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,EAAE;AACtE,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,4CAA4C,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,KAAK;AACL,IAAI,IAAI,CAACD,WAAS,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE;AAChD,QAAQ,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,WAAW,EAAE,KAAK;AAC1B,QAAQ,sBAAsB,EAAE,KAAK;AACrC,QAAQ,aAAa,EAAE,IAAI;AAC3B,QAAQ,eAAe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GAAG,gBAAgB,CAAC;AAC1E,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;AACrC,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,WAAW,GAAG,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC7D,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AACM,SAAS,cAAc,CAAC,MAAM,EAAE;AACvC,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAClC,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AACM,SAAS,qBAAqB,CAAC,MAAM,EAAE;AAC9C,IAAI,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS;AACtC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE;AACxE,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,4CAA4C,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5F,KAAK;AACL;;;;"} \ No newline at end of file diff --git a/src/public-api/dto.ts b/src/public-api/dto.ts index 4fc0b37..a422c0d 100644 --- a/src/public-api/dto.ts +++ b/src/public-api/dto.ts @@ -2,7 +2,7 @@ export interface TestRunAutoResultDto { testCycleId: number; status: TestRunAutoResultStatus; failureReason?: string; - sessionDetailsJson?: object; + sessionDetailsJson?: SessionDetails; startTime?: Date; endTime?: Date; } @@ -14,3 +14,14 @@ export enum TestRunAutoResultStatus { CANCELED = 'CANCELED', ERROR = 'ERROR', } + +export interface SessionDetails { + value: { + deviceName?: string; + orientation?: string; + platformName?: string; + platformVersion?: string; + browserName?: string; + browserVersion?: string; + }; +} diff --git a/src/public-api/public-api.ts b/src/public-api/public-api.ts index b7637d7..3343422 100644 --- a/src/public-api/public-api.ts +++ b/src/public-api/public-api.ts @@ -55,7 +55,12 @@ export class PublicApi { try { return await this.client.post( `v2/test-case-results/${testCaseId}/submit`, - info + { + ...info, + // override the sessionDetailsJson property with the + // stringified version that the server expects + sessionDetailsJson: JSON.stringify(info.sessionDetailsJson), + } ); } finally { this.callsInFlight -= 1;