Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xml report not generated for failing testcase on compilation error #192

Open
laflaneuse opened this issue Aug 16, 2018 · 1 comment
Open

Comments

@laflaneuse
Copy link

Issue description
We are using Protractor 5.2.0 with jasmine 3.1.0 and jasmine-reporters 2.2.1 .
At the moment, when a testcase fails with a compilation error, no report will be generated for this testcase and our CI build cannot identify that a testcase is failing (we have false positives)

Configuration
protractor.conf.js

const HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
const { SpecReporter } = require('jasmine-spec-reporter');
const reporters = require('jasmine-reporters');
const failFast = require('protractor-fail-fast');
const retry = require('protractor-retry').retry;
const yargs = require('yargs');
const fs = require('fs');
const mkdirp = require('mkdirp');
const { join } = require('path');
const NUMBER_OF_RETRIES = 3;
const RETRY_NUMBER = process.argv.indexOf('--retry') > -1 ? process.argv[process.argv.indexOf('--retry') + 1] : 0;
const RETRY_SUITE = process.argv.indexOf('--suite') > -1 ? process.argv[process.argv.indexOf('--suite') + 1] : 'retry';
const REPORT_ROOT_PATH='out/test/frontend/e2e/';

// Run this with "--no-webdriver-update", the driver comes from the grid and is not necessary locally

const screenshotReporter = new HtmlScreenshotReporter({
dest: out/test/reports/e2e/${RETRY_NUMBER},
captureOnlyFailedSpecs: true,
ignoreSkippedSpecs: true,
showQuickLinks: true
});

function finalizeReports() {
let finalDir = join(REPORT_ROOT_PATH, 'final');
if (!fs.existsSync(finalDir)){
mkdirp.sync(finalDir);
}

fs.readdirSync(REPORT_ROOT_PATH + RETRY_NUMBER).forEach(file => {
if (file.indexOf('.xml') >= 0) {
let name = 'final_' + file;
let oldPath = join(REPORT_ROOT_PATH, RETRY_NUMBER.toString(), file);
let newPath = join(finalDir, name);
fs.copyFileSync(oldPath, newPath);
}
})
}

exports.config = {
allScriptsTimeout: 15000,
suites: {
e2m: './src/test/ui-tests/e2m//*.e2m-spec.ts',
e2e: './src/test/ui-tests/e2e/
/*.e2e-spec.ts'
},
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [
'--headless',
'--disable-gpu',
'--window-size=1200x800'
]
},
shardTestFiles: true,
maxInstances: 8
},
baseUrl: 'https://mySystem/',
seleniumAddress: 'http://server.port/wd/hub',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 60000,
print: function() {}
},
plugins: [
failFast.init({abortAllShards: false})
],
beforeLaunch: function() {
return new Promise(function(resolve){
screenshotReporter.beforeLaunch(resolve);
});
},
onPrepare() {
retry.onPrepare();
return browser.getProcessedConfig().then(function(config) {

  require('ts-node').register({
    project: 'src/main/angular/tsconfig.e2e.json'
  });

  jasmine.getEnv().addReporter(
    new SpecReporter({ spec: { displayStacktrace: true } })
  );

  jasmine.getEnv().addReporter(screenshotReporter);

  let junitReporter = new reporters.JUnitXmlReporter({
    consolidate: false,
    savePath: join(REPORT_ROOT_PATH, RETRY_NUMBER.toString())
  });

  jasmine.getEnv().addReporter(junitReporter);

});

},
onCleanUp(results) {
retry.onCleanUp(results);
},
afterLaunch: (code) => new Promise((resolve) => {
finalizeReports();
screenshotReporter.afterLaunch(() => resolve(code));
}).then(() => retry.afterLaunch(NUMBER_OF_RETRIES))
};

Logs
build 14-Aug-2018 09:39:51 [chrome #1-13] Specs: somefile.ts
build 14-Aug-2018 09:39:51 [chrome #1-13]
build 14-Aug-2018 09:39:51 [chrome #1-13] (node:165) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
build 14-Aug-2018 09:39:51 [chrome #1-13] [07:39:41] I/hosted - Using the selenium server at http://server:port/wd/hub
build 14-Aug-2018 09:39:51 [chrome #1-13] [07:39:51] I/runnerCli - ⨯ Unable to compile TypeScript:
build 14-Aug-2018 09:39:51 [chrome #1-13] somefile.ts(121,69): error TS2339: Property 'property' does not exist on type 'typeHelper'.
...

Many thanks in advance!

@jkieley
Copy link

jkieley commented Sep 3, 2018

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants