1

I downloaded testcafe-reporter-html-testrail and using this in my testcafe project. If I am giving a custom name to the report then it's failing to save properly, i.e report is not complete, its almost blank with few lines...However, if I am NOT giving the custom name then the report is saving in the format Report_TIMESTAMP.html (e.g.: Report_16_5_2018_14_46_46.html) What am I doing wrong here?

const createTestCafe = require('testcafe');
let testcafe = null;

createTestCafe()
.then(tc => {
    testcafe     = tc;
    const runner = testcafe.createRunner();

    let id;
    const deadlinePromise = new Promise((resolve,reject) => {
        id=setTimeout(() => {
       clearTimeout(id);
       reject('testcase couldnt meet the actual preferred time');
        },215000)
     });

const runPromise=runner
    .src(test1.ts)  
    .browsers('chrome:headless')
     // what am I doing wrong in the below step? the report is not saving properly
    .reporter('html-testrail', 'Reports/report1.html')        
    .run({skipJsErrors:true})             


race =Promise.race([runPromise,deadlinePromise])
race.then((res) => console.log(res))      

})

       .catch(failedCount => {
           console.log('Tests1 failed: ' + failedCount);
            testcafe.close();
        })
Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
TS0306
  • 177
  • 12

2 Answers2

3

The html-testrail reporter ignores the output option and uses HTML_REPORT_PATH and HTML_REPORT_NAME environment variables instead. You can use process.env to modify environment variables and save your report in the desired location:

process.env.HTML_REPORT_PATH = path.resolve('Reports');
process.env.HTML_REPORT_NAME = 'report1.html';
Andrey Belym
  • 2,893
  • 8
  • 19
1

To specify a custom output file for 'testcafe-reporter-html-testrail' reporter, you need to specify corresponding environment variables as it described in documentation.

mlosev
  • 5,130
  • 1
  • 19
  • 31
  • the environment variables are automatically created in index.js, what I need to know is if I have to change anything in index.js so that my report comes properly when giving a custom name? I was under the impression .reporter('html-testrail', 'Reports/report1.html') overrides the default settings in index.js in testcafe and creates a report with report name report1.html, but that's not happening. – TS0306 Oct 15 '19 at 15:11