Open ravim20051 opened 6 years ago
Interesting, ok. Do you have a copy oft he JSON it rendered? If you could send that, I can try to run locally to.
Also, can you use a relative path to see if it works? Instead of:
G:/Protractor/ZPlatform_Script/protractor-reports/cucumber_report.json
Try:
./cucumber_report.json
I am also facing same issue.
const path = require('path'); const argv = require('yargs').argv; const Reporter = require('./e2e/support/reporter'); // const jsonReports = process.cwd() + '/reports/json'; const jsonReports = path.join(process.cwd(), "/reports/json");
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
specs: getFeatureFiles(),
cucumberOpts: {
compiler: ['ts:ts-node/register'],
require: ['./e2e/*/.e2e-spec.ts', './e2e/support/*.js'],
strict: true, //
// implicit and page load timeouts
browser.manage().timeouts().pageLoadTimeout(40000);
browser.manage().timeouts().implicitlyWait(5000);
Reporter.createDirectory(jsonReports);
}, onComplete: function () { Reporter.createHTMLReport(); }, getPageTimeout: 60000, allScriptsTimeout: 60000, disableChecks: true, useAllAngular2AppRoots: true };
const fs = require("fs"); const mkdirp = require("mkdirp"); const path = require("path"); const reporter = require("cucumber-html-reporter"); const report = require("cucumber-html-report"); // const htmlReports = process.cwd() + "/reports/html"; // const targetJson = process.cwd() + "/reports/json/cucumber_report.json"; const jsonReports = path.join(process.cwd(), "/reports/json"); const htmlReports = path.join(process.cwd(), "/reports/html"); const targetJson = path.join(jsonReports , "/cucumber_report.json");
const cucumberReportOptions = { source: targetJson, dest: htmlReports, name: "cucumber_report.html", title: "Cucumber Report" }; const cucumberReporteroptions = { theme: "bootstrap", jsonFile: targetJson, output: htmlReports + "/cucumber_reporter.html", reportSuiteAsScenarios: true };
class Reporter {
static createDirectory(dirName) { //Check if the directory exist if (!fs.existsSync(dirName)) { mkdirp.sync(dirName); } }
/**
}
module.exports = Reporter;
ERROR:
Unable to parse cucumberjs output into json: 'C:\rc\E2E.Tests\ng\reports\json\cucumber_report.json' SyntaxError: C:\rc\E2E.Tests\ng\reports\json\cucumber_report.json: Unexpected end of JSON input
at JSON.parse (
Just ignore me.. My json was empty.. should have checked that first :P
I am also getting the same issue:
Unable to parse cucumberjs output into json: 'reports/cucumber-report.json' SyntaxError: reports/cucumber-report.json: Unexpected end of JSON input.
Please help me to resolve this issue.
Any solution to this problem? I am using cucumber-html-reporter too and stuck with this issue " Unable to parse cucumberjs output into json: '\e2e\reports\json\cucumber_report.json' { Error: \e2e\reports\json\cucumber_report.json: ENOENT: no such file or directory, open '\e2e\reports\json\cucumber_report.json'
I am facing the same issue. The thing which I could figure out from this is. Till the time we are expecting the html-reporter to read the updated report.json file and generate an Html report out of it, the cucumber-js process has not finished writing the test report. And hence, it fails to parse the file.
In my case, I am calling the report generation utility in Afterall hook. And running the tests in parallel. However, when I run the test in a single thread. Then this works fine and generates the report at the end of the execution
I am facing the same issue. The thing which I could figure out from this is. Till the time we are expecting the html-reporter to read the updated report.json file and generate an Html report out of it, the cucumber-js process has not finished writing the test report. And hence, it fails to parse the file.
In my case, I am calling the report generation utility in Afterall hook. And running the tests in parallel. However, when I run the test in a single thread. Then this works fine and generates the report at the end of the execution
I am facing the same issue. Any solution to the problem?
i am facing same
⚠️ 😞 Unable to parse cucumberjs output into json: '%s' cucumber_report.json SyntaxError: cucumber_report.json: Unexpected end of JSON input
error message will display before execution
before cucumbe-html-report beofore json file has not updated of base of current execution
any update on this?
any update on this?
Update the options to use html format, it should work
let options = [ '--require-module ts-node/register', '--require ./steps/stepDef.steps.ts', '--format progress', '--format html:Reports/report.html', '--format json:Reports/report.json' ].join(' ');
I am trying to execute the test in Protractor and generate the results in JSON format and integrationg Cucumber-html-reporter to take this JSON as input and generate the HTML report with Bootstrap options. But Not sucessfull
Below is my config file:
var reporter = require('cucumber-html-reporter'); exports.config = { seleniumAddress: 'http://172.17.205.173:4444/wd/hub', seleniumSessionId: '1bcc031df0fa1a241b0fd06445af324d',
capabilities: { 'browserName': 'chrome' },
specs: ['Login_ZRPE.js'], resultJsonOutputFile:'G:/Protractor/ZPlatform_Script/protractor-reports/cucumber_report.json',
onComplete: function() { var options = { theme: 'bootstrap', jsonFile: 'G:/Protractor/ZPlatform_Script/protractor-reports/cucumber_report.json',
output: 'G:/Protractor/ZPlatform_Script/protractor-reports/cucumber_report.html', reportSuiteAsScenarios: true, launchReport: true, metadata: { "App Version":"0.3.2", "Test Environment": "STAGING", "Browser": "Chrome 54.0.2840.98", "Platform": "Windows 10", "Parallel": "Scenarios", "Executed": "Remote" } }; reporter.generate(options); } };
Execute the above config file, Test executed successfully but while report generation the below error is displays. I have tried various options which is available in various forum but the below is not resolved. Please let me know how to solve this issue
Error: 1 spec, 0 failures Finished in 11.412 seconds
Finished suite Unable to parse cucumberjs output into json: 'G:/Protractor/ZPlatform_Script/protractor-reports/cucumber_report.json' { Error: G:/Protractor/ZPlatform_Script/protractor-reports/cucumber_report.json: ENOENT: no such file or directory, open 'G:\Protractor\ZPlatform_Script\protractor-reports\cucumber_r eport.json' at Object.fs.openSync (fs.js:653:18) at Object.fs.readFileSync (fs.js:554:33) at Object.readFileSync (C:\Users\zafin\AppData\Roaming\npm\node_modules\cucumber-html-reporter\node_modules\jsonfile\index.js:67:22) at isValidJsonFile (C:\Users\zafin\AppData\Roaming\npm\node_modules\cucumber-html-reporter\lib\reporter.js:404:48) at Object.generate (C:\Users\zafin\AppData\Roaming\npm\node_modules\cucumber-html-reporter\lib\reporter.js:426:9) at Object.generateReport [as generate] (C:\Users\zafin\AppData\Roaming\npm\node_modules\cucumber-html-reporter\index.js:30:21) at onComplete (G:\Protractor\ZPlatform_Script\config.js:37:14) at C:\Users\zafin\AppData\Roaming\npm\node_modules\protractor\built\frameworks\jasmine.js:115:27 at module.exports.jasmineDone (C:\Users\zafin\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\lib\reporters\completion_reporter.js:15:5) at dispatch (C:\Users\zafin\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:4366:28) errno: -4058, code: 'ENOENT', syscall: 'open', path: 'G:\Protractor\ZPlatform_Script\protractor-reports\cucumber_report.json' } [16:26:04] I/launcher - 0 instance(s) of WebDriver still running [16:26:04] I/launcher - chrome #01 passed