Closed KSinichkina closed 5 years ago
Thanks for the info. Can you show me how your test is defined? Make sure you are not using an arrow function as the test callback. See the note about adding context.
@adamgruber so my code in a test is s sample from the link you shared: ` const addContext = require('mochawesome/addContext'); describe('test suite', function () { it('should add context', function () { // context can be a simple string addContext(this, 'simple string');
// context can be a url and the report will create a link
addContext(this, 'http://www.url.com/pathname');
// context can be an image url and the report will show it inline
addContext(this, 'http://www.url.com/screenshot-maybe.jpg');
// context can be an object with title and value properties
addContext(this, {
title: 'expected output',
value: {
a: 1,
b: '2',
c: 'd'
}
});
})
}); `
From what I can tell, the addContext
function is working but there's something with Cypress that is modifying the test object so the context
property is not there. You might want to open an issue with Cypress.
thank you @adamgruber think need to talk to cypress guys))
Hi there,
I am adding addContext in my testfile but getting following error:
Could not find a declaration file for module 'mochawesome/addContext'. 'd:/Cypress/CypressProject/node_modules/mochawesome/addContext.js' implicitly has an 'any' type.
Try npm install @types/mochawesome
if it exists or add a new declaration (.d.ts) file containing `declare module 'mochawesome/addContext';
I wrote this line of code where I am getting above error const addContext = require('mochawesome/addContext')
Somebody can help please?
Hi there,
I am adding addContext in my testfile but getting following error:
Could not find a declaration file for module 'mochawesome/addContext'. 'd:/Cypress/CypressProject/node_modules/mochawesome/addContext.js' implicitly has an 'any' type. Try
npm install @types/mochawesome
if it exists or add a new declaration (.d.ts) file containing `declare module 'mochawesome/addContext';I wrote this line of code where I am getting above error const addContext = require('mochawesome/addContext')
Somebody can help please?
If you are writing typescript you can make noImplicitAny: false
in your tsconfig.json file or you can create a declaration file (make sure to include this in your tsconfig file)
// src/@types/mochawesome.d.ts
declare module 'mochawesome/addContext';
Hi guys. I have no possibility to add some context through parallel mode. So, i have the function like:
_`afterEach: async function() { if (this.currentTest.state === "failed") { FAILED_TESTS[this.currentTest.file] = true;
const title = new Buffer.from(this.currentTest.title).toString("base64");
try {
await makeScreenshot(title);
} catch (e) {
console.error(e);
}
addContext(this, `./${title}.png`);
}
}`_
It works in single mode, but in parallel - no. Report generates without any context. Maybe someone knows any solution?
Describe the bug So in any way I'm using addContext there is no any result
Screenshots
Environment (please complete the following information):
Additional context Running cypress run:
cypress.json