cucumber-js
cucumber-js copied to clipboard
HTML formatter with external attachments does not show plain text when opened from local filesystem
👓 What did you see?
I have the following step that attaches plain text:
Given('some step', async function () {
this.attach('some text');
});
I run Cucumber with HTML formatter and external attachments enabled:
format: [
['html', 'cucumber-reports/report.html'],
],
formatOptions: {
html: {
externalAttachments: true
}
}
When I open report.html from the local filesystem, I see the following error:
✅ What did you expect to see?
I expect that some text would be displayed in the report.
📦 Which tool/library version are you using?
$ npx cucumber-js -v
11.0.1
🔬 How could we reproduce it?
No response
📚 Any additional context?
No response
Sorry for the late reply @vitalets, this is unfortunate with the content being fetch'd and thus subject to CORS policy.
I'm thinking we could offer a bit more granularity for the externalAttachments option, something like:
NONE- nothing externalisedBINARY- images, videos and other binary files are externalised (since these don't run into CORS issues), but nothing elseALL- everything externalised except logs
And have true become an alias for BINARY as good default for users who want to save file size.
What do you think?
(We could also give some advice in the docs that if you have externalised text attachments you could run a local web server to view the report, which would work fine.)
Another option is to filter attachments by content-type. E.g.
formatOptions: {
html: {
externalAttachments: ['video/*', 'image/*']
}
}
Even more granular control, but more setup. Anyway, internally we need to map BINARY to some set of content-types.