Forum Discussion
aslakhellesoy
Alumni
4 years agoThanks for sharing your code.
Your code doesn't seem to use Cucumber, so I'm a bit puzzled you're asking in this forum. We only offer support for Cucumber, not other testing tools.
mortelee
4 years agoOccasional Contributor
Hi
Just stumbled on this thread. I had the same problem
See code below.
When I use the Then function without settting a timeout, the test stops with a message that timeout of 5000ms has been reached. If I add the timeout {timeout: 60000} then it works.
Looks like adding the screenshots with world.attach takes too long (taking the screenshot is instantly)??
I'm using Cucumber v7.0.0
'''
Then('patient info shows patient name {string}', async function (this: CustomWorld, name: string😞 Promise<void> {
const actualPatientName = await getPatientName();
expect(actualPatientName).to.be.equal(name);
await ActualResultWithScreenshot(`Patient info shows patient name "${actualPatientName}"`, this);
});
'''
'''
export async function ActualResultWithScreenshot(
message: string | null | undefined,
world: CustomWorld
😞 Promise<void> {
if (message) {
ActualResult(message, world);
}
const screenshot = await world.cath.page?.screenshot(); // Take screenshot from playwright page
if (screenshot) {
world.attach(screenshot, 'image/png');
}
}
'''
- aurelien-reeves4 years ago
Staff
Would you have the possibility to add some benchmarks to measure how longs take world.attach, but also other methods in your tests?