'Types of property 'theme' are incompatible in cucumber-html-reporter
Hi I'm new to cucumber framework and I was trying to generate a html report using cucumber-html-reporter. But the 'theme'
property in options of cucumber-html-reporter is giving me an error telling that Type 'string' is not assignable to type '"bootstrap" | "hierarchy" | "foundation" | "simple"'.
But I have given 'theme'
as a string type because in the docs they have mentioned as string type. Can anyone please help me where I'm going wrong?
This is how my cucumber config.ts look like:
import { Config } from 'protractor';
import * as reporter from 'cucumber-html-reporter';
export let config: Config = {
directConnect: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
specs: ['../features/demo.feature'],
capabilities:
{
browserName: "chrome",
'goog:chromeOptions': {
w3c: false
},
},
cucumberOpts: {
tags: "@CalculatorTesting",
format: "json:./cucumberReport.json",
// html reporter
onComplete: () => {
let options = {
theme: "hierarchy",
jsonFile: './tmp/cucumber_report.json',
output: '../cucumber_report.html',
reportSuiteAsScenarios: true,
scenarioTimestamp: 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);
},
require: [
'./stepDefinitions/*.js'
]
}
};
Solution 1:[1]
From index.d.ts
of cucumber-html-reporter
as following, I think this syntax theme: 'bootstrap' | 'hierarchy' | 'foundation' | 'simple'
should be supported when Nodejs version high than specific one.
What's the nodejs version you used to run test?
interface Options {
theme: 'bootstrap' | 'hierarchy' | 'foundation' | 'simple',
jsonFile?: string,
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | yong |