diff --git a/dist/index.cjs b/dist/index.cjs index 5ba85e8..f41bf88 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -127,6 +127,7 @@ class AutoApi { async startTestRun(info) { this.callsInFlight += 1; try { + console.error('THIS IS MF ERROR'); return await this.client.post('/api/v1.0/test-run/create', { // Provided params ...info, diff --git a/dist/index.cjs.map b/dist/index.cjs.map index 48178ed..78f99d6 100644 --- a/dist/index.cjs.map +++ b/dist/index.cjs.map @@ -1 +1 @@ -{"version":3,"file":"index.cjs","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/email-helper.ts","../src/heartbeat.ts","../src/reporter.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map"],"names":["existsSync","readFileSync","queryString","TestResultStatus","simpleParser","writeFileSync","pathJoin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACGlC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AACxB,MAAC,WAAW,GAAG,4CAA4C;AACvE;AACO,SAAS,UAAU,CAAC,WAAW,EAAE;AACxC;AACA,IAAI,IAAI,MAAM,GAAG;AACjB,QAAQ,OAAO,EAAE,WAAW;AAC5B,KAAK,CAAC;AACN;AACA,IAAI,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,CAAC,UAAU,KAAK,SAAS,EAAE;AAC3E,QAAQ,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,UAAU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G,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACjF,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,kBAAkB;AAC1B,QAAQ,kBAAkB;AAC1B,QAAQ,YAAY,EAAE,MAAM;AAC5B,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAChG,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,uBAAuB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,aAAa,IAAI,CAAC,GAAG,CAAC;AACtB,aAAa,IAAI,EAAE;AACnB,KAAK,CAAC;AACN;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.cjs","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/email-helper.ts","../src/heartbeat.ts","../src/reporter.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n console.error('THIS IS MF ERROR');\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map"],"names":["existsSync","readFileSync","queryString","TestResultStatus","simpleParser","writeFileSync","pathJoin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACGlC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AACxB,MAAC,WAAW,GAAG,4CAA4C;AACvE;AACO,SAAS,UAAU,CAAC,WAAW,EAAE;AACxC;AACA,IAAI,IAAI,MAAM,GAAG;AACj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sD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAClF,SAAS;AACT,aAAa,IAAI,KAAK,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAAE;AAC7D,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACjF,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,kBAAkB;AAC1B,QAAQ,kBAAkB;AAC1B,QAAQ,YAAY,EAAE,MAAM;AAC5B,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAChG,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,uBAAuB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,aAAa,IAAI,CAAC,GAAG,CAAC;AACtB,aAAa,IAAI,EAAE;AACnB,KAAK,CAAC;AACN;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/index.min.js b/dist/index.min.js index 6c3f645..bfa1525 100644 --- a/dist/index.min.js +++ b/dist/index.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("fs"),require("path"),require("validator"),require("querystring"),require("mailparser")):"function"==typeof define&&define.amd?define(["exports","axios","fs","path","validator","querystring","mailparser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["applause-reporter-common"]={},t.axios,t.fs,t.path,t.Validator,t.queryString,t.mailparser)}(this,(function(t,e,s,i,a,r,n){"use strict";function o(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}})),e.default=t,Object.freeze(e)}var l=o(r);const u=a.default,d="https://prod-auto-api.cloud.applause.com/";function c(t,e){return Object.assign({},t,Object.fromEntries(Object.entries(e||{}).filter((([t,e])=>void 0!==e))))}function p(t){return void 0!==t.baseUrl&&void 0!==t.apiKey&&void 0!==t.productId}function h(t){const e=t||process.cwd()+"/applause.json";if(!s.existsSync(e))return{};const i=s.readFileSync(e,"utf8");return JSON.parse(i)}function f(t){if(!Number.isInteger(t.productId)||t.productId<=0)throw new Error(`productId must be a positive integer, was: '${t.productId}'`);if(!u.isURL(t.baseUrl,{protocols:["http","https"],require_tld:!1,allow_query_components:!1,disallow_auth:!0,allow_fragments:!1,allow_protocol_relative_urls:!1,allow_trailing_dot:!1,require_host:!0,require_protocol:!0}))throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${t.baseUrl}`);if(u.isEmpty(t.apiKey))throw new Error("apiKey is an empty string!")}class g{options;client;callsInFlight;get getCallsInFlight(){return this.callsInFlight}constructor(t){this.options=t,this.callsInFlight=0,f(t),this.client=e.create({baseURL:t.baseUrl,timeout:1e4,headers:{"X-Api-Key":t.apiKey,"Context-Type":"application/json"},responseType:"json"})}async startTestRun(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/test-run/create",{...t,sdkVersion:"js:1.0.0",productId:this.options.productId,testRailReportingEnabled:void 0!==this.options.testRailOptions,addAllTestsToPlan:this.options.testRailOptions?.addAllTestsToPlan,testRailProjectId:this.options.testRailOptions?.projectId,testRailSuiteId:this.options.testRailOptions?.suiteId,testRailPlanName:this.options.testRailOptions?.planName,testRailRunName:this.options.testRailOptions?.runName,overrideTestRailRunNameUniqueness:this.options.testRailOptions?.overrideTestRailRunUniqueness})}finally{this.callsInFlight-=1}}async endTestRun(t){this.callsInFlight+=1;try{return await this.client.delete(`/api/v1.0/test-run/${t}?endingStatus=COMPLETE`)}finally{this.callsInFlight-=1}}async startTestCase(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/test-result/create-result",t)}finally{this.callsInFlight-=1}}async submitTestCaseResult(t){this.callsInFlight+=1;try{await this.client.post("/api/v1.0/test-result",t)}finally{this.callsInFlight-=1}}async getProviderSessionLinks(t){this.callsInFlight+=1;try{const e=t.filter((t=>t));return await this.client.post("/api/v1.0/test-result/provider-info",e)}finally{this.callsInFlight-=1}}async sendSdkHeartbeat(t){this.callsInFlight+=1;try{return await this.client.post("/api/v2.0/sdk-heartbeat",l.stringify({testRunId:t}),{headers:{"Content-Type":"application/x-www-form-urlencoded"}})}finally{this.callsInFlight-=1}}async getEmailAddress(t){this.callsInFlight+=1;try{return await this.client.get(`/api/v1.0/email/get-address?prefix=${t}`)}finally{this.callsInFlight-=1}}async getEmailContent(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/email/download-email",t)}finally{this.callsInFlight-=1}}}var R;t.TestResultStatus=void 0,(R=t.TestResultStatus||(t.TestResultStatus={})).NOT_RUN="NOT_RUN",R.IN_PROGRESS="IN_PROGRESS",R.PASSED="PASSED",R.FAILED="FAILED",R.SKIPPED="SKIPPED",R.CANCELED="CANCELED",R.ERROR="ERROR";class b{emailAddress;autoApi;constructor(t,e){this.emailAddress=t,this.autoApi=e}async getEmail(){const t=await this.autoApi.getEmailContent({emailAddress:this.emailAddress});return await n.simpleParser(t.data)}}class I{testRunId;autoApi;enabled=!1;nextHeartbeat;constructor(t,e){this.testRunId=t,this.autoApi=e}async start(){await this.end(),this.enabled=!0,this.scheduleNextHeartbeat()}isEnabled(){return this.enabled}scheduleNextHeartbeat(){this.enabled&&(this.nextHeartbeat=new Promise((t=>setTimeout(t,5e3))).then((()=>this.sendHeartbeat())))}async sendHeartbeat(){console.log("Sending heartbeat"),await this.autoApi.sendSdkHeartbeat(this.testRunId),console.log("Heartbeat sent"),this.scheduleNextHeartbeat()}async end(){void 0!==this.nextHeartbeat&&(this.enabled=!1,console.debug("Ending Applause SDK Heartbeat"),await this.nextHeartbeat,console.debug("Applause SDK Heartbeat Ended Successfully")),this.nextHeartbeat=void 0}}class w{autoApi;constructor(t){this.autoApi=t}async initializeRun(t){const e=t?.map(T).map((t=>t.testCaseName.trim())),s=await this.autoApi.startTestRun({tests:e||[]});if(s.status<200||s.status>300)throw new Error("Unable to create test run");const i=s.data.runId;console.log("Test Run %d initialized",i);const a=new I(i,this.autoApi);return await a.start(),new m(this.autoApi,i,a)}}class m{autoApi;testRunId;heartbeatService;uidToResultIdMap={};resultSubmissionMap={};constructor(t,e,s){this.autoApi=t,this.testRunId=e,this.heartbeatService=s}startTestCase(t,e,s){const i=T(e);this.uidToResultIdMap[t]=this.autoApi.startTestCase({testCaseName:i.testCaseName,testCaseId:i.testRailTestCaseId,itwTestCaseId:i.applauseTestCaseId,testRunId:this.testRunId,...Object.fromEntries(Object.entries(s||{}).filter((([t,e])=>void 0!==e)))}).then((t=>t.data.testResultId))}submitTestCaseResult(t,e,s){this.resultSubmissionMap[t]=this.uidToResultIdMap[t]?.then((t=>this.autoApi.submitTestCaseResult({status:e,testResultId:t,...s})))}async runnerEnd(){const t=await Promise.all(Object.values(this.uidToResultIdMap))||[];await Promise.all(Object.values(this.resultSubmissionMap)),await this.heartbeatService.end(),await this.autoApi.endTestRun(this.testRunId);const e=(await this.autoApi.getProviderSessionLinks(t)).data||[];if(e.length>0){console.info(JSON.stringify(e));const t=".";s.writeFileSync(i.join(t,"providerUrls.txt"),JSON.stringify(e,null,1))}}}const y="TestRail-",v="Applause-";function T(t){const e=t.split(" ");let s,i;return e.forEach((t=>{t?.startsWith(y)?(void 0!==s&&console.warn("Multiple TestRail case ids detected in testCase name"),s=t.substring(y.length)):t?.startsWith(v)&&(void 0!==i&&console.warn("Multiple Applause case ids detected in testCase name"),i=t.substring(v.length))})),{applauseTestCaseId:i,testRailTestCaseId:s,testCaseName:e.filter((t=>t!==`${y}${s||""}`)).filter((t=>t!==`${v}${i||""}`)).join(" ").trim()}}t.ApplauseReporter=class{autoApi;initializer;reporter;runStarted=!1;runFinished=!1;constructor(t){this.autoApi=new g(t),this.initializer=new w(this.autoApi)}runnerStart(t){this.reporter=this.initializer.initializeRun(t),this.reporter.then((()=>{this.runStarted=!0}))}startTestCase(t,e,s){if(void 0===this.reporter)throw new Error("Cannot start a test case for a run that was never initialized");this.reporter.then((i=>i.startTestCase(t,e,s)))}submitTestCaseResult(t,e,s){if(void 0===this.reporter)throw new Error("Cannot submit test case result for a run that was never initialized");this.reporter.then((i=>i.submitTestCaseResult(t,e,s)))}async runnerEnd(){if(void 0===this.reporter)throw new Error("Cannot end a run that was never initialized");await this.reporter.then((t=>t.runnerEnd())).then((()=>this.runFinished=!0))}isSynchronized(){return(!this.runStarted||this.runStarted&&this.runFinished)&&0==this.autoApi.getCallsInFlight}},t.AutoApi=g,t.DEFAULT_URL=d,t.EmailHelper=class{autoApi;constructor(t){this.autoApi=t}async getInbox(t){const e=(await this.autoApi.getEmailAddress(t)).data.emailAddress;return new b(e,this.autoApi)}},t.Inbox=b,t.RunInitializer=w,t.RunReporter=m,t.TestRunHeartbeatService=I,t.isComplete=p,t.loadConfig=function(t){let e={baseUrl:d};if(e=void 0!==t&&void 0!==t.configFile?c(e,h(i.join(process.cwd(),t.configFile))):c(e,h()),void 0!==t&&void 0!==t.properties&&(e=c(e,t.properties)),!p(e))throw new Error("Config is not complete");const s=e;return f(s),s},t.loadConfigFromFile=h,t.overrideConfig=c,t.validateConfig=f,t.validatePartialConfig=function(t){if(void 0!==t.productId&&(!Number.isInteger(t.productId)||t.productId<=0))throw new Error(`productId must be a positive integer, was: '${t.productId}'`)}})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("fs"),require("path"),require("validator"),require("querystring"),require("mailparser")):"function"==typeof define&&define.amd?define(["exports","axios","fs","path","validator","querystring","mailparser"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["applause-reporter-common"]={},t.axios,t.fs,t.path,t.Validator,t.queryString,t.mailparser)}(this,(function(t,e,s,i,a,r,n){"use strict";function o(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}})),e.default=t,Object.freeze(e)}var l=o(r);const u=a.default,d="https://prod-auto-api.cloud.applause.com/";function c(t,e){return Object.assign({},t,Object.fromEntries(Object.entries(e||{}).filter((([t,e])=>void 0!==e))))}function p(t){return void 0!==t.baseUrl&&void 0!==t.apiKey&&void 0!==t.productId}function h(t){const e=t||process.cwd()+"/applause.json";if(!s.existsSync(e))return{};const i=s.readFileSync(e,"utf8");return JSON.parse(i)}function f(t){if(!Number.isInteger(t.productId)||t.productId<=0)throw new Error(`productId must be a positive integer, was: '${t.productId}'`);if(!u.isURL(t.baseUrl,{protocols:["http","https"],require_tld:!1,allow_query_components:!1,disallow_auth:!0,allow_fragments:!1,allow_protocol_relative_urls:!1,allow_trailing_dot:!1,require_host:!0,require_protocol:!0}))throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${t.baseUrl}`);if(u.isEmpty(t.apiKey))throw new Error("apiKey is an empty string!")}class R{options;client;callsInFlight;get getCallsInFlight(){return this.callsInFlight}constructor(t){this.options=t,this.callsInFlight=0,f(t),this.client=e.create({baseURL:t.baseUrl,timeout:1e4,headers:{"X-Api-Key":t.apiKey,"Context-Type":"application/json"},responseType:"json"})}async startTestRun(t){this.callsInFlight+=1;try{return console.error("THIS IS MF ERROR"),await this.client.post("/api/v1.0/test-run/create",{...t,sdkVersion:"js:1.0.0",productId:this.options.productId,testRailReportingEnabled:void 0!==this.options.testRailOptions,addAllTestsToPlan:this.options.testRailOptions?.addAllTestsToPlan,testRailProjectId:this.options.testRailOptions?.projectId,testRailSuiteId:this.options.testRailOptions?.suiteId,testRailPlanName:this.options.testRailOptions?.planName,testRailRunName:this.options.testRailOptions?.runName,overrideTestRailRunNameUniqueness:this.options.testRailOptions?.overrideTestRailRunUniqueness})}finally{this.callsInFlight-=1}}async endTestRun(t){this.callsInFlight+=1;try{return await this.client.delete(`/api/v1.0/test-run/${t}?endingStatus=COMPLETE`)}finally{this.callsInFlight-=1}}async startTestCase(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/test-result/create-result",t)}finally{this.callsInFlight-=1}}async submitTestCaseResult(t){this.callsInFlight+=1;try{await this.client.post("/api/v1.0/test-result",t)}finally{this.callsInFlight-=1}}async getProviderSessionLinks(t){this.callsInFlight+=1;try{const e=t.filter((t=>t));return await this.client.post("/api/v1.0/test-result/provider-info",e)}finally{this.callsInFlight-=1}}async sendSdkHeartbeat(t){this.callsInFlight+=1;try{return await this.client.post("/api/v2.0/sdk-heartbeat",l.stringify({testRunId:t}),{headers:{"Content-Type":"application/x-www-form-urlencoded"}})}finally{this.callsInFlight-=1}}async getEmailAddress(t){this.callsInFlight+=1;try{return await this.client.get(`/api/v1.0/email/get-address?prefix=${t}`)}finally{this.callsInFlight-=1}}async getEmailContent(t){this.callsInFlight+=1;try{return await this.client.post("/api/v1.0/email/download-email",t)}finally{this.callsInFlight-=1}}}var g;t.TestResultStatus=void 0,(g=t.TestResultStatus||(t.TestResultStatus={})).NOT_RUN="NOT_RUN",g.IN_PROGRESS="IN_PROGRESS",g.PASSED="PASSED",g.FAILED="FAILED",g.SKIPPED="SKIPPED",g.CANCELED="CANCELED",g.ERROR="ERROR";class I{emailAddress;autoApi;constructor(t,e){this.emailAddress=t,this.autoApi=e}async getEmail(){const t=await this.autoApi.getEmailContent({emailAddress:this.emailAddress});return await n.simpleParser(t.data)}}class b{testRunId;autoApi;enabled=!1;nextHeartbeat;constructor(t,e){this.testRunId=t,this.autoApi=e}async start(){await this.end(),this.enabled=!0,this.scheduleNextHeartbeat()}isEnabled(){return this.enabled}scheduleNextHeartbeat(){this.enabled&&(this.nextHeartbeat=new Promise((t=>setTimeout(t,5e3))).then((()=>this.sendHeartbeat())))}async sendHeartbeat(){console.log("Sending heartbeat"),await this.autoApi.sendSdkHeartbeat(this.testRunId),console.log("Heartbeat sent"),this.scheduleNextHeartbeat()}async end(){void 0!==this.nextHeartbeat&&(this.enabled=!1,console.debug("Ending Applause SDK Heartbeat"),await this.nextHeartbeat,console.debug("Applause SDK Heartbeat Ended Successfully")),this.nextHeartbeat=void 0}}class w{autoApi;constructor(t){this.autoApi=t}async initializeRun(t){const e=t?.map(T).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 b(i,this.autoApi);return await a.start(),new m(this.autoApi,i,a)}}class m{autoApi;testRunId;heartbeatService;uidToResultIdMap={};resultSubmissionMap={};constructor(t,e,s){this.autoApi=t,this.testRunId=e,this.heartbeatService=s}startTestCase(t,e,s){const i=T(e);this.uidToResultIdMap[t]=this.autoApi.startTestCase({testCaseName:i.testCaseName,testCaseId:i.testRailTestCaseId,itwTestCaseId:i.applauseTestCaseId,testRunId:this.testRunId,...Object.fromEntries(Object.entries(s||{}).filter((([t,e])=>void 0!==e)))}).then((t=>t.data.testResultId))}submitTestCaseResult(t,e,s){this.resultSubmissionMap[t]=this.uidToResultIdMap[t]?.then((t=>this.autoApi.submitTestCaseResult({status:e,testResultId:t,...s})))}async runnerEnd(){const t=await Promise.all(Object.values(this.uidToResultIdMap))||[];await Promise.all(Object.values(this.resultSubmissionMap)),await this.heartbeatService.end(),await this.autoApi.endTestRun(this.testRunId);const e=(await this.autoApi.getProviderSessionLinks(t)).data||[];if(e.length>0){console.info(JSON.stringify(e));const t=".";s.writeFileSync(i.join(t,"providerUrls.txt"),JSON.stringify(e,null,1))}}}const y="TestRail-",v="Applause-";function T(t){const e=t.split(" ");let s,i;return e.forEach((t=>{t?.startsWith(y)?(void 0!==s&&console.warn("Multiple TestRail case ids detected in testCase name"),s=t.substring(y.length)):t?.startsWith(v)&&(void 0!==i&&console.warn("Multiple Applause case ids detected in testCase name"),i=t.substring(v.length))})),{applauseTestCaseId:i,testRailTestCaseId:s,testCaseName:e.filter((t=>t!==`${y}${s||""}`)).filter((t=>t!==`${v}${i||""}`)).join(" ").trim()}}t.ApplauseReporter=class{autoApi;initializer;reporter;runStarted=!1;runFinished=!1;constructor(t){this.autoApi=new R(t),this.initializer=new w(this.autoApi)}runnerStart(t){this.reporter=this.initializer.initializeRun(t),this.reporter.then((()=>{this.runStarted=!0}))}startTestCase(t,e,s){if(void 0===this.reporter)throw new Error("Cannot start a test case for a run that was never initialized");this.reporter.then((i=>i.startTestCase(t,e,s)))}submitTestCaseResult(t,e,s){if(void 0===this.reporter)throw new Error("Cannot submit test case result for a run that was never initialized");this.reporter.then((i=>i.submitTestCaseResult(t,e,s)))}async runnerEnd(){if(void 0===this.reporter)throw new Error("Cannot end a run that was never initialized");await this.reporter.then((t=>t.runnerEnd())).then((()=>this.runFinished=!0))}isSynchronized(){return(!this.runStarted||this.runStarted&&this.runFinished)&&0==this.autoApi.getCallsInFlight}},t.AutoApi=R,t.DEFAULT_URL=d,t.EmailHelper=class{autoApi;constructor(t){this.autoApi=t}async getInbox(t){const e=(await this.autoApi.getEmailAddress(t)).data.emailAddress;return new I(e,this.autoApi)}},t.Inbox=I,t.RunInitializer=w,t.RunReporter=m,t.TestRunHeartbeatService=b,t.isComplete=p,t.loadConfig=function(t){let e={baseUrl:d};if(e=void 0!==t&&void 0!==t.configFile?c(e,h(i.join(process.cwd(),t.configFile))):c(e,h()),void 0!==t&&void 0!==t.properties&&(e=c(e,t.properties)),!p(e))throw new Error("Config is not complete");const s=e;return f(s),s},t.loadConfigFromFile=h,t.overrideConfig=c,t.validateConfig=f,t.validatePartialConfig=function(t){if(void 0!==t.productId&&(!Number.isInteger(t.productId)||t.productId<=0))throw new Error(`productId must be a positive integer, was: '${t.productId}'`)}})); //# sourceMappingURL=index.min.js.map diff --git a/dist/index.min.js.map b/dist/index.min.js.map index 8a587c8..7d57650 100644 --- a/dist/index.min.js.map +++ b/dist/index.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.min.js","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/heartbeat.ts","../src/reporter.ts","../src/email-helper.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map"],"names":["validator","Validator","default","DEFAULT_URL","overrideConfig","config","overrides","Object","assign","fromEntries","entries","filter","_","v","undefined","isComplete","baseUrl","apiKey","productId","loadConfigFromFile","configFile","configFilePath","process","cwd","existsSync","fileCotents","readFileSync","JSON","parse","validateConfig","Number","isInteger","Error","isURL","protocols","require_tld","allow_query_components","disallow_auth","allow_fragments","allow_protocol_relative_urls","allow_trailing_dot","require_host","require_protocol","isEmpty","AutoApi","options","client","callsInFlight","getCallsInFlight","this","constructor","axios","create","baseURL","timeout","headers","responseType","startTestRun","info","post","sdkVersion","testRailReportingEnabled","testRailOptions","addAllTestsToPlan","testRailProjectId","projectId","testRailSuiteId","suiteId","testRailPlanName","planName","testRailRunName","runName","overrideTestRailRunNameUniqueness","overrideTestRailRunUniqueness","endTestRun","testRunId","delete","startTestCase","params","submitTestCaseResult","getProviderSessionLinks","resultIds","validIds","id","sendSdkHeartbeat","queryString","stringify","getEmailAddress","emailPrefix","get","getEmailContent","request","TestResultStatus","exports","Inbox","emailAddress","autoApi","getEmail","res","simpleParser","data","TestRunHeartbeatService","enabled","nextHeartbeat","start","end","scheduleNextHeartbeat","isEnabled","Promise","resolve","setTimeout","then","sendHeartbeat","console","log","debug","RunInitializer","initializeRun","tests","cleanedTests","map","parseTestCaseName","parsed","testCaseName","trim","testRunCreateResponse","status","runId","heartbeatService","RunReporter","uidToResultIdMap","resultSubmissionMap","parsedTestCase","testCaseId","testRailTestCaseId","itwTestCaseId","applauseTestCaseId","testResultId","resultId","runnerEnd","all","values","jsonArray","length","outputPath","writeFileSync","pathJoin","join","TEST_RAIL_CASE_ID_PREFIX","APPLAUSE_CASE_ID_PREFIX","tokens","split","forEach","token","startsWith","warn","substring","initializer","reporter","runStarted","runFinished","runnerStart","isSynchronized","getInbox","generatedAddress","loadOptions","path","properties","finalConfig"],"mappings":"owBAAO,MCGDA,EAAYC,EAAUC,QACfC,EAAc,4CA2BpB,SAASC,EAAeC,EAAQC,GACnC,OAAOC,OAAOC,OAAO,GAAIH,EAAQE,OAAOE,YAAYF,OAAOG,QAAQJ,GAAa,CAAA,GAAIK,QAAO,EAAEC,EAAGC,UAAaC,IAAND,KAC3G,CACO,SAASE,EAAWV,GACvB,YAA2BS,IAAnBT,EAAOW,cACOF,IAAlBT,EAAOY,aACcH,IAArBT,EAAOa,SACf,CACO,SAASC,EAAmBC,GAC/B,MAAMC,EAAiBD,GAAcE,QAAQC,MAAQ,iBACrD,IAAKC,EAAAA,WAAWH,GACZ,MAAO,GAEX,MAAMI,EAAcC,EAAAA,aAAaL,EAAgB,QACjD,OAAOM,KAAKC,MAAMH,EACtB,CACO,SAASI,EAAexB,GAC3B,IAAKyB,OAAOC,UAAU1B,EAAOa,YAAcb,EAAOa,WAAa,EAC3D,MAAM,IAAIc,MAAM,+CAA+C3B,EAAOa,cAE1E,IAAKlB,EAAUiC,MAAM5B,EAAOW,QAAS,CACjCkB,UAAW,CAAC,OAAQ,SACpBC,aAAa,EACbC,wBAAwB,EACxBC,eAAe,EACfC,iBAAiB,EACjBC,8BAA8B,EAC9BC,oBAAoB,EACpBC,cAAc,EACdC,kBAAkB,IAElB,MAAM,IAAIV,MAAM,6CAA6C3B,EAAOW,WAExE,GAAIhB,EAAU2C,QAAQtC,EAAOY,QACzB,MAAM,IAA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AjC/G,KAAK+C,QAAQhD,gBACpB,6CC3CE,MACHgD,QACA,WAAA9C,CAAY8C,GACR/C,KAAK+C,QAAUA,CAClB,CACD,cAAMmE,CAAS3E,GACX,MAAM4E,SAA0BnH,KAAK+C,QAAQT,gBAAgBC,IAAcY,KAAKL,aAChF,OAAO,IAAID,EAAMsE,EAAkBnH,KAAK+C,QAC3C,wGNHE,SAAoBqE,GAEvB,IAAIhK,EAAS,CACTW,QAASb,GAcb,GAVIE,OADgBS,IAAhBuJ,QAAwDvJ,IAA3BuJ,EAAYjJ,WAChChB,EAAeC,EAAQc,EAAmBmJ,EAAKnB,KAAK7H,QAAQC,MAAO8I,EAAYjJ,cAI/EhB,EAAeC,EAAQc,UAGhBL,IAAhBuJ,QAAwDvJ,IAA3BuJ,EAAYE,aACzClK,EAASD,EAAeC,EAAQgK,EAAYE,cAE3CxJ,EAAWV,GACZ,MAAM,IAAI2B,MAAM,0BAGpB,MAAMwI,EAAcnK,EAEpB,OADAwB,EAAe2I,GACRA,CACX,uFAsCO,SAA+BnK,GAClC,QAAyBS,IAArBT,EAAOa,aACLY,OAAOC,UAAU1B,EAAOa,YAAcb,EAAOa,WAAa,GAC5D,MAAM,IAAIc,MAAM,+CAA+C3B,EAAOa,aAE9E"} \ No newline at end of file +{"version":3,"file":"index.min.js","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/heartbeat.ts","../src/reporter.ts","../src/email-helper.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n console.error('THIS IS MF ERROR');\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map"],"names":["validator","Validator","default","DEFAULT_URL","overrideConfig","config","overrides","Object","assign","fromEntries","entries","filter","_","v","undefined","isComplete","baseUrl","apiKey","productId","loadConfigFromFile","configFile","configFilePath","process","cwd","existsSync","fileCotents","readFileSync","JSON","parse","validateConfig","Number","isInteger","Error","isURL","protocols","require_tld","allow_query_components","disallow_auth","allow_fragments","allow_protocol_relative_urls","allow_trailing_dot","require_host","require_protocol","isEmpty","AutoApi","options","client","callsInFlight","getCallsInFlight","this","constructor","axios","create","baseURL","timeout","headers","responseType","startTestRun","info","console","error","post","sdkVersion","testRailReportingEnabled","testRailOptions","addAllTestsToPlan","testRailProjectId","projectId","testRailSuiteId","suiteId","testRailPlanName","planName","testRailRunName","runName","overrideTestRailRunNameUniqueness","overrideTestRailRunUniqueness","endTestRun","testRunId","delete","startTestCase","params","submitTestCaseResult","getProviderSessionLinks","resultIds","validIds","id","sendSdkHeartbeat","queryString","stringify","getEmailAddress","emailPrefix","get","getEmailContent","request","TestResultStatus","exports","Inbox","emailAddress","autoApi","getEmail","res","simpleParser","data","TestRunHeartbeatService","enabled","nextHeartbeat","start","end","scheduleNextHeartbeat","isEnabled","Promise","resolve","setTimeout","then","sendHeartbeat","log","debug","RunInitializer","initializeRun","tests","cleanedTests","map","parseTestCaseName","parsed","testCaseName","trim","testRunCreateResponse","status","runId","heartbeatService","RunReporter","uidToResultIdMap","resultSubmissionMap","parsedTestCase","testCaseId","testRailTestCaseId","itwTestCaseId","applauseTestCaseId","testResultId","resultId","runnerEnd","all","values","jsonArray","length","outputPath","writeFileSync","pathJoin","join","TEST_RAIL_CASE_ID_PREFIX","APPLAUSE_CASE_ID_PREFIX","tokens","split","forEach","token","startsWith","warn","substring","initializer","reporter","runStarted","runFinished","runnerStart","isSynchronized","getInbox","generatedAddress","loadOptions","path","properties","finalConfig"],"mappings":"owBAAO,MCGDA,EAAYC,EAAUC,QACfC,EAAc,4CA2BpB,SAASC,EAAeC,EAAQC,GACnC,OAAOC,OAAOC,OAAO,GAAIH,EAAQE,OAAOE,YAAYF,OAAOG,QAA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AhBwJ,QAAwDxJ,IAA3BwJ,EAAYE,aACzCnK,EAASD,EAAeC,EAAQiK,EAAYE,cAE3CzJ,EAAWV,GACZ,MAAM,IAAI2B,MAAM,0BAGpB,MAAMyI,EAAcpK,EAEpB,OADAwB,EAAe4I,GACRA,CACX,uFAsCO,SAA+BpK,GAClC,QAAyBS,IAArBT,EAAOa,aACLY,OAAOC,UAAU1B,EAAOa,YAAcb,EAAOa,WAAa,GAC5D,MAAM,IAAIc,MAAM,+CAA+C3B,EAAOa,aAE9E"} \ No newline at end of file diff --git a/dist/index.mjs b/dist/index.mjs index 9d205ba..a5ad327 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -106,6 +106,7 @@ class AutoApi { async startTestRun(info) { this.callsInFlight += 1; try { + console.error('THIS IS MF ERROR'); return await this.client.post('/api/v1.0/test-run/create', { // Provided params ...info, diff --git a/dist/index.mjs.map b/dist/index.mjs.map index a53073b..7499ed9 100644 --- a/dist/index.mjs.map +++ b/dist/index.mjs.map @@ -1 +1 @@ -{"version":3,"file":"index.mjs","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/email-helper.ts","../src/heartbeat.ts","../src/reporter.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map"],"names":["pathJoin"],"mappings":";;;;;;;AAAO,MAAM,WAAW,GAAG,OAAO;;ACGlC,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AACxB,MAAC,WAAW,GAAG,4CAA4C;AACvE;AACO,SAAS,UAAU,CAAC,WAAW,EAAE;AACxC;AACA,IAAI,IAAI,MAAM,GAAG;A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AC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAClF,SAAS;AACT,aAAa,IAAI,KAAK,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAAE;AAC7D,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACjF,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,kBAAkB;AAC1B,QAAQ,kBAAkB;AAC1B,QAAQ,YAAY,EAAE,MAAM;AAC5B,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAChG,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,uBAAuB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,aAAa,IAAI,CAAC,GAAG,CAAC;AACtB,aAAa,IAAI,EAAE;AACnB,KAAK,CAAC;AACN;;;;"} \ No newline at end of file +{"version":3,"file":"index.mjs","sources":["../src/version.ts","../src/config.ts","../src/auto-api.ts","../src/dto.ts","../src/email/inbox.ts","../src/email-helper.ts","../src/heartbeat.ts","../src/reporter.ts"],"sourcesContent":["export const API_VERSION = '1.0.0';\n//# sourceMappingURL=version.js.map","import { existsSync, readFileSync } from 'fs';\nimport path from 'path';\nimport Validator from 'validator';\nconst validator = Validator.default;\nexport const DEFAULT_URL = 'https://prod-auto-api.cloud.applause.com/';\n// Loads the configuration\nexport function loadConfig(loadOptions) {\n // Setup the initial config with any default properties\n let config = {\n baseUrl: DEFAULT_URL,\n };\n // Load properties from the provided config file\n if (loadOptions !== undefined && loadOptions.configFile !== undefined) {\n config = overrideConfig(config, loadConfigFromFile(path.join(process.cwd(), loadOptions.configFile)));\n }\n else {\n // Override from the default config file\n config = overrideConfig(config, loadConfigFromFile());\n }\n // Then load in the file override properties\n if (loadOptions !== undefined && loadOptions.properties !== undefined) {\n config = overrideConfig(config, loadOptions.properties);\n }\n if (!isComplete(config)) {\n throw new Error('Config is not complete');\n }\n // We know that the config is complete, so we can cast\n const finalConfig = config;\n validateConfig(finalConfig);\n return finalConfig;\n}\nexport function overrideConfig(config, overrides) {\n return Object.assign({}, config, Object.fromEntries(Object.entries(overrides || {}).filter(([_, v]) => v !== undefined)));\n}\nexport function isComplete(config) {\n return (config.baseUrl !== undefined &&\n config.apiKey !== undefined &&\n config.productId !== undefined);\n}\nexport function loadConfigFromFile(configFile) {\n const configFilePath = configFile || process.cwd() + '/applause.json';\n if (!existsSync(configFilePath)) {\n return {};\n }\n const fileCotents = readFileSync(configFilePath, 'utf8');\n return JSON.parse(fileCotents);\n}\nexport function validateConfig(config) {\n if (!Number.isInteger(config.productId) || config.productId <= 0) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n if (!validator.isURL(config.baseUrl, {\n protocols: ['http', 'https'],\n require_tld: false,\n allow_query_components: false,\n disallow_auth: true,\n allow_fragments: false,\n allow_protocol_relative_urls: false,\n allow_trailing_dot: false,\n require_host: true,\n require_protocol: true,\n })) {\n throw new Error(`baseUrl is not valid HTTP/HTTPS URL, was: ${config.baseUrl}`);\n }\n if (validator.isEmpty(config.apiKey)) {\n throw new Error('apiKey is an empty string!');\n }\n}\nexport function validatePartialConfig(config) {\n if (config.productId !== undefined &&\n (!Number.isInteger(config.productId) || config.productId <= 0)) {\n throw new Error(`productId must be a positive integer, was: '${config.productId}'`);\n }\n}\n//# sourceMappingURL=config.js.map","import axios from 'axios';\nimport { API_VERSION } from './version.ts';\nimport { validateConfig } from './config.ts';\nimport * as queryString from 'querystring';\nexport class AutoApi {\n options;\n client;\n callsInFlight;\n /**\n * tracks number of HTTP calls in progress, used by reporters that want to know when our async work is finished\n */\n get getCallsInFlight() {\n return this.callsInFlight;\n }\n constructor(options) {\n this.options = options;\n this.callsInFlight = 0;\n validateConfig(options);\n this.client = axios.create({\n baseURL: options.baseUrl,\n timeout: 10000,\n headers: {\n 'X-Api-Key': options.apiKey,\n 'Context-Type': 'application/json',\n },\n responseType: 'json',\n });\n }\n async startTestRun(info) {\n this.callsInFlight += 1;\n try {\n console.error('THIS IS MF ERROR');\n return await this.client.post('/api/v1.0/test-run/create', {\n // Provided params\n ...info,\n // API Version\n sdkVersion: `js:${API_VERSION}`,\n // Copy over the product id\n productId: this.options.productId,\n // Copy over test rail parameters\n testRailReportingEnabled: this.options.testRailOptions !== undefined,\n addAllTestsToPlan: this.options.testRailOptions?.addAllTestsToPlan,\n testRailProjectId: this.options.testRailOptions?.projectId,\n testRailSuiteId: this.options.testRailOptions?.suiteId,\n testRailPlanName: this.options.testRailOptions?.planName,\n testRailRunName: this.options.testRailOptions?.runName,\n overrideTestRailRunNameUniqueness: this.options.testRailOptions?.overrideTestRailRunUniqueness,\n });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async endTestRun(testRunId) {\n this.callsInFlight += 1;\n try {\n return await this.client.delete(`/api/v1.0/test-run/${testRunId}?endingStatus=COMPLETE`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async startTestCase(params) {\n this.callsInFlight += 1;\n try {\n const res = await this.client.post('/api/v1.0/test-result/create-result', params);\n return res;\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async submitTestCaseResult(params) {\n this.callsInFlight += 1;\n try {\n await this.client.post('/api/v1.0/test-result', params);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getProviderSessionLinks(resultIds) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n const validIds = resultIds.filter(id => id);\n return await this.client.post('/api/v1.0/test-result/provider-info', validIds);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async sendSdkHeartbeat(testRunId) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v2.0/sdk-heartbeat', queryString.stringify({ testRunId: testRunId }), { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailAddress(emailPrefix) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.get(`/api/v1.0/email/get-address?prefix=${emailPrefix}`);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n async getEmailContent(request) {\n this.callsInFlight += 1;\n try {\n // this filters out falsy values (null, undefined, 0)\n return await this.client.post('/api/v1.0/email/download-email', request);\n }\n finally {\n this.callsInFlight -= 1;\n }\n }\n}\n//# sourceMappingURL=auto-api.js.map","/**\n * Enum representing a test result's status\n */\nexport var TestResultStatus;\n(function (TestResultStatus) {\n TestResultStatus[\"NOT_RUN\"] = \"NOT_RUN\";\n TestResultStatus[\"IN_PROGRESS\"] = \"IN_PROGRESS\";\n TestResultStatus[\"PASSED\"] = \"PASSED\";\n TestResultStatus[\"FAILED\"] = \"FAILED\";\n TestResultStatus[\"SKIPPED\"] = \"SKIPPED\";\n TestResultStatus[\"CANCELED\"] = \"CANCELED\";\n TestResultStatus[\"ERROR\"] = \"ERROR\";\n})(TestResultStatus || (TestResultStatus = {}));\n//# sourceMappingURL=dto.js.map","import { simpleParser } from 'mailparser';\nexport class Inbox {\n emailAddress;\n autoApi;\n constructor(emailAddress, autoApi) {\n this.emailAddress = emailAddress;\n this.autoApi = autoApi;\n }\n async getEmail() {\n const res = await this.autoApi.getEmailContent({\n emailAddress: this.emailAddress,\n });\n return await simpleParser(res.data);\n }\n}\n//# sourceMappingURL=inbox.js.map","import { Inbox } from './email/inbox.ts';\nexport class EmailHelper {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async getInbox(emailPrefix) {\n const generatedAddress = (await this.autoApi.getEmailAddress(emailPrefix)).data.emailAddress;\n return new Inbox(generatedAddress, this.autoApi);\n }\n}\nexport * from './email/attachment.ts';\nexport * from './email/inbox.ts';\n//# sourceMappingURL=email-helper.js.map","export class TestRunHeartbeatService {\n testRunId;\n autoApi;\n enabled = false;\n nextHeartbeat;\n constructor(testRunId, autoApi) {\n this.testRunId = testRunId;\n this.autoApi = autoApi;\n }\n async start() {\n // End the current heartbeat if it has started\n await this.end();\n // Set up va new interval\n this.enabled = true;\n this.scheduleNextHeartbeat();\n }\n isEnabled() {\n return this.enabled;\n }\n scheduleNextHeartbeat() {\n if (!this.enabled) {\n return;\n }\n this.nextHeartbeat = new Promise(resolve => setTimeout(resolve, 5000)).then(() => this.sendHeartbeat());\n }\n async sendHeartbeat() {\n console.log('Sending heartbeat');\n await this.autoApi.sendSdkHeartbeat(this.testRunId);\n console.log('Heartbeat sent');\n this.scheduleNextHeartbeat();\n }\n async end() {\n if (this.nextHeartbeat !== undefined) {\n this.enabled = false;\n console.debug('Ending Applause SDK Heartbeat');\n await this.nextHeartbeat;\n console.debug('Applause SDK Heartbeat Ended Successfully');\n }\n this.nextHeartbeat = undefined;\n }\n}\n//# sourceMappingURL=heartbeat.js.map","import { writeFileSync } from 'fs';\nimport { AutoApi } from './auto-api.ts';\nimport { TestRunHeartbeatService } from './heartbeat.ts';\nimport { join as pathJoin } from 'path';\nexport class ApplauseReporter {\n autoApi;\n initializer;\n reporter;\n runStarted = false;\n runFinished = false;\n constructor(config) {\n this.autoApi = new AutoApi(config);\n this.initializer = new RunInitializer(this.autoApi);\n }\n runnerStart(tests) {\n this.reporter = this.initializer.initializeRun(tests);\n void this.reporter.then(() => {\n this.runStarted = true;\n });\n }\n startTestCase(id, testCaseName, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot start a test case for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.startTestCase(id, testCaseName, params));\n }\n submitTestCaseResult(id, status, params) {\n if (this.reporter === undefined) {\n throw new Error('Cannot submit test case result for a run that was never initialized');\n }\n void this.reporter.then(reporter => reporter.submitTestCaseResult(id, status, params));\n }\n async runnerEnd() {\n if (this.reporter === undefined) {\n throw new Error('Cannot end a run that was never initialized');\n }\n await this.reporter\n .then(reporter => reporter.runnerEnd())\n .then(() => (this.runFinished = true));\n }\n isSynchronized() {\n // Verify the run is not yet started or it has ended, and all calls made to the applause api have finished\n return ((!this.runStarted || (this.runStarted && this.runFinished)) &&\n this.autoApi.getCallsInFlight == 0);\n }\n}\nexport class RunInitializer {\n autoApi;\n constructor(autoApi) {\n this.autoApi = autoApi;\n }\n async initializeRun(tests) {\n const cleanedTests = tests\n ?.map(parseTestCaseName)\n .map(parsed => parsed.testCaseName.trim());\n const testRunCreateResponse = await this.autoApi.startTestRun({\n tests: cleanedTests || [],\n });\n if (testRunCreateResponse.status < 200 ||\n testRunCreateResponse.status > 300) {\n throw new Error('Unable to create test run');\n }\n const runId = testRunCreateResponse.data.runId;\n console.log('Test Run %d initialized', runId);\n const heartbeatService = new TestRunHeartbeatService(runId, this.autoApi);\n await heartbeatService.start();\n return new RunReporter(this.autoApi, runId, heartbeatService);\n }\n}\nexport class RunReporter {\n autoApi;\n testRunId;\n heartbeatService;\n uidToResultIdMap = {};\n resultSubmissionMap = {};\n constructor(autoApi, testRunId, heartbeatService) {\n this.autoApi = autoApi;\n this.testRunId = testRunId;\n this.heartbeatService = heartbeatService;\n }\n startTestCase(id, testCaseName, params) {\n const parsedTestCase = parseTestCaseName(testCaseName);\n this.uidToResultIdMap[id] = this.autoApi\n .startTestCase({\n testCaseName: parsedTestCase.testCaseName,\n testCaseId: parsedTestCase.testRailTestCaseId,\n itwTestCaseId: parsedTestCase.applauseTestCaseId,\n testRunId: this.testRunId,\n // If the additional params provides either test case id, it will override the parsed value we set above\n ...Object.fromEntries(Object.entries(params || {}).filter(([_, v]) => v !== undefined)),\n })\n .then(res => {\n return res.data.testResultId;\n });\n }\n submitTestCaseResult(id, status, params) {\n this.resultSubmissionMap[id] = this.uidToResultIdMap[id]?.then(resultId => this.autoApi.submitTestCaseResult({\n status: status,\n testResultId: resultId,\n ...params,\n }));\n }\n async runnerEnd() {\n // Wait for all results to be created\n const resultIds = (await Promise.all(Object.values(this.uidToResultIdMap))) || [];\n // Wait for the results to be submitted\n void (await Promise.all(Object.values(this.resultSubmissionMap)));\n // Wait the heartbeat to be ended\n void (await this.heartbeatService.end());\n void (await this.autoApi.endTestRun(this.testRunId));\n // Fetch the provider session asset links and save them off to a file\n const resp = await this.autoApi.getProviderSessionLinks(resultIds);\n const jsonArray = resp.data || [];\n if (jsonArray.length > 0) {\n console.info(JSON.stringify(jsonArray));\n // this is the wdio.conf outputDir\n const outputPath = '.';\n writeFileSync(pathJoin(outputPath, 'providerUrls.txt'), JSON.stringify(jsonArray, null, 1));\n }\n }\n}\nconst TEST_RAIL_CASE_ID_PREFIX = 'TestRail-';\nconst APPLAUSE_CASE_ID_PREFIX = 'Applause-';\nfunction parseTestCaseName(testCaseName) {\n // Split the name on spaces. We will reassemble after parsing out the other ids\n const tokens = testCaseName.split(' ');\n let testRailTestCaseId;\n let applauseTestCaseId;\n tokens.forEach(token => {\n if (token?.startsWith(TEST_RAIL_CASE_ID_PREFIX)) {\n if (testRailTestCaseId !== undefined) {\n console.warn('Multiple TestRail case ids detected in testCase name');\n }\n testRailTestCaseId = token.substring(TEST_RAIL_CASE_ID_PREFIX.length);\n }\n else if (token?.startsWith(APPLAUSE_CASE_ID_PREFIX)) {\n if (applauseTestCaseId !== undefined) {\n console.warn('Multiple Applause case ids detected in testCase name');\n }\n applauseTestCaseId = token.substring(APPLAUSE_CASE_ID_PREFIX.length);\n }\n });\n return {\n applauseTestCaseId,\n testRailTestCaseId,\n testCaseName: tokens\n .filter(token => token !== `${TEST_RAIL_CASE_ID_PREFIX}${testRailTestCaseId || ''}`)\n .filter(token => token !== `${APPLAUSE_CASE_ID_PREFIX}${applauseTestCaseId || ''}`)\n .join(' ')\n .trim(),\n };\n}\n//# sourceMappingURL=reporter.js.map"],"names":["pathJoin"],"mappings":";;;;;;;AAAO,MAAM,WAA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CAAC,KAAK,IAAI;AAC5B,QAAQ,IAAI,KAAK,EAAE,UAAU,CAAC,wBAAwB,CAAC,EAAE;AACzD,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAClF,SAAS;AACT,aAAa,IAAI,KAAK,EAAE,UAAU,CAAC,uBAAuB,CAAC,EAAE;AAC7D,YAAY,IAAI,kBAAkB,KAAK,SAAS,EAAE;AAClD,gBAAgB,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;AACrF,aAAa;AACb,YAAY,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACjF,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,kBAAkB;AAC1B,QAAQ,kBAAkB;AAC1B,QAAQ,YAAY,EAAE,MAAM;AAC5B,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,wBAAwB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAChG,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,EAAE,uBAAuB,CAAC,EAAE,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,aAAa,IAAI,CAAC,GAAG,CAAC;AACtB,aAAa,IAAI,EAAE;AACnB,KAAK,CAAC;AACN;;;;"} \ No newline at end of file diff --git a/src/auto-api.ts b/src/auto-api.ts index c4e3e3d..972f474 100644 --- a/src/auto-api.ts +++ b/src/auto-api.ts @@ -43,6 +43,7 @@ export class AutoApi { ): Promise> { this.callsInFlight += 1; try { + console.error('THIS IS MF ERROR'); return await this.client.post( '/api/v1.0/test-run/create', {