jasmine-atm-reporter
Version:
npm module for jest-puppeteer to upload result in atm
32 lines (29 loc) • 1.2 kB
JavaScript
var fs = require('fs');
let req = require('request');
var atm = require('./src/resultUpload');
var url = process.env.BASE_URL;
user = process.env.USERNAME;
password = process.env.PASSWORD;
class JestReporter {
constructor(globalConfig, options) {
this._globalConfig = globalConfig;
this._options = options;
}
onTestStart(test) {
const setupPath = require.resolve('./src/setup');
const setupTestFrameworkScriptFile = test.context.config.setupTestFrameworkScriptFile;
if (!setupTestFrameworkScriptFile) {
test.context.config = Object.assign({}, test.context.config, { setupTestFrameworkScriptFile: setupPath });
}
}
onRunComplete(test, results) {
require('dotenv').config({path: '.test-env'});
var cycleID = process.env.TEST_CYCLE_ID,
testCaseID = process.env.TEST_CASE_ID,
testResult = process.env.TEST_CASE_STATUS,
testEnv = process.env.TEST_CASE_ENVIRONMENT,
stepResults = process.env.TEST_STEP_RESULT
atm.testResultUpload(cycleID, testCaseID, testResult, testEnv, stepResults);
}
}
module.exports = JestReporter;