New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E/launcher - Error: TypeError: Cannot read property 'children' of undefined , Causing Report to generate empty results! #518
Comments
Hey @mtahat and thanks for the detailed report! This looks like a synchronisation issue that typically happens if the cucumber step does not return the For example, the below sample would cause a synchronisation issue: Given(/some step/, () => {
// note no `return` statement:
actorInTheSpotlight().attemptsTo(/*... tasks ...*/);
}); While both the below samples would work correctly: Given(/some step/, () => {
// explicit `return` statement
return actorInTheSpotlight().attemptsTo(/*... tasks ...*/);
}); // `return` is implied with one-liner fat arrow functions with no curly brackets
Given(/some step/, () => actorInTheSpotlight().attemptsTo(
/*... tasks ...*/
)); Could you please have a look at your cucumber steps implementation and check if they are synchronised with Serenity/JS actor flow (the Best, |
@jan-molak Thank you for your suggestion. Step file:
Tasks in UseTopNav
|
Could you please add a StreamReporter to your // protractor.conf.js
const { StreamReporter } = require('@serenity-js/core');
const fs = require('fs');
module.exports = {
crew: [
new StreamReporter(fs.createWriteStream('./events.ndjson'))
// other crew members
],
// other config
}; Also, I noticed that the timeouts for your waits are really long - 15 and 5 seconds, which might be reasonable if the system under test is this slow. However, if that's the case then it's possible that your cucumber step times out before your Serenity/JS tasks. Check out my post on StackOverflow. If you want to adjust your cucumber step timeout, try the following: When(/(?:he|she|user) hovers over (.*) and clicks (.*)/, { timeout: 30 * 1000 }, (arg1: string, arg2: string) =>
actorInTheSpotlight().attemptsTo(
UseTopNav.with(arg1, arg2),
)); |
@jan-molak Yes, our website is so slow! some of the wait statements goes up to 1 minute! I will also add the Stream reporter to my config file and run again. |
@jan-molak I tried to increase the cucumber timeout as suggested, I added Protractor.config
timeout.ts
Here is the output of my StreamReporter-- FYI: the tests fails when I run: npm test ( around 25 tests will run) and the report will show empty results as above.. |
Thanks, @mtahat, based on the events log, it definitely looks like a synchronisation problem. If you analyse the event log you'll see:
So this corresponds to this sequence of tasks:
But then I see an end of the following task, instead of the end of the wait interaction I'd expect:
So it feels like whatever wraps the wait of 15 seconds does not have a sufficient timeout. I'd suggest:
It's difficult for me to suggest more without seeing your actual code base and the system itself. |
Yup I agree..it is indeed sync issue! I pumped up the cucumber time out and it seemed to be more stable. I am considering integrating a service virtualization tool (hoverfly) to eliminate some of the flakiness in the backend. I will add an actor who can send API calls and see how stable the service even before running the test.. Again, Thank you so much for your quick responses! I am closing this issue since it is not related to serenity js. |
…rter In cases where Cucumber interrupts execution of an already started Serenity/JS activity (i.e. when a Cucumber step times out before actor finishes what they're doing), some internal domain events could arrive during the subsequnt scenario, confusing SerenityBDDReporter and making it throw a bit of a cryptic error along the lines of "Cannot read property 'children' of undefined". This new implementation of the reporter resolves this issue by aggregating scenario-specific events before they're analysed, making sure they're ordered correctly, and generating the report only when all the events are available. Closes #518
Hello @jan-molak I am using Serenity-js with Cucumber, protractor & typescript ( see dependencies below) , I also have a hook.js that cleans the locale storage session after each feature/scenario. (see below).
I start getting Empty Reports after failed runs, I noticed this issue happen when the test timeout durning the execution ( for example the task code has wait.upto(Durations.seconds(60), " See task below")
FYI: I used the template cucumber/serenity template that you have here to build my project. see dependencies below, I am also using Mac book, VS Code IDE.
Exception 1: TypeError Cannot read property
Exception 2: TypeError: Cannot read property 'screenshots' of undefined
Task Used to Hover over top menu bar then click on sub-menu
Hooks.ts
Dependencies
Protractor.config
Empty Report after test is done
The text was updated successfully, but these errors were encountered: