Currently when an action fails the entire UI hierarchy of the current app page is printed by EarlGrey. Would like to be able to utilize the EarlGrey Error API to customize error output so test results are more readable to less technical team members and aren't filled with information that is unnecessary. General improvement of error printing and ability to customize error output in general would be very useful, as currently I don't see a way of doing so other than outputting to a text file and parsing it at the end.
Any specific ideas? What do you count as necessary and what not?
The biggest issue on our end is the printing of the entire page's UI hierarchy on failed actions. Being we use react-devtools for viewing the hierarchy when writing and debugging tests, printing out the whole hierarchy in the test result output is just somewhat excessive and makes the results of the tests quite cumbersome to navigate.
Also the stack trace of failed actions is somewhat unhelpful as it doesn't seem to reference a specific line of a test, it merely points to the line where the test is declared. This makes the stack trace itself somewhat pointless as it's printing out everything except where the failure is actually occurring.
Just the ability to include/omit specific types of errors or omit certain types of error logging in general may be useful. I know there is some functionality regarding this, but just being able to customize test output a bit more would be very useful.
+1. A flag to indicate whether or not to print the UI hierarchy on failure would suffice.
Any word on when/if some basic functionality relating to this will be able to be implemented?
You can just use a custom reporter for this. I wrote one that just strips out the UI Hierarchy, but it can be modified easily to strip everything besides test result. It is for Mocha but I am sure any test runner will have similar capabilities.
https://gist.github.com/cucumbur/e2fc35792c1677b97f23d35205b98550
Also, jest has the --noStackTrace option which may help.
For Cucumber, I just added a small addition to the step_result_helpers.js file to strip out the UI Hierarchy.
function getFailedStepResultMessage(_ref2) {
var colorFns = _ref2.colorFns,
testStep = _ref2.testStep;
var index = testStep.result.exception.message.message.indexOf('Hierarchy:');
testStep.result.exception = testStep.result.exception.message.message.substring(0, index != -1 ? index : exception.length);
return (0, _error_helpers.formatError)(testStep.result.exception, colorFns);
}
@cucumbur I'm unable to get --noStackTrace to suppress anything. Is anyone else able to use this successfully?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions.
The issue has been closed for inactivity.
@LeoNatan, is it okay if we reopen it, or you have other suggestions? I just don't know what to do in regards to this issue. :(
No. As I said in the other issue, I spoke with Rotem and we decided the current policy stands.
Most helpful comment
The biggest issue on our end is the printing of the entire page's UI hierarchy on failed actions. Being we use react-devtools for viewing the hierarchy when writing and debugging tests, printing out the whole hierarchy in the test result output is just somewhat excessive and makes the results of the tests quite cumbersome to navigate.
Also the stack trace of failed actions is somewhat unhelpful as it doesn't seem to reference a specific line of a test, it merely points to the line where the test is declared. This makes the stack trace itself somewhat pointless as it's printing out everything except where the failure is actually occurring.
Just the ability to include/omit specific types of errors or omit certain types of error logging in general may be useful. I know there is some functionality regarding this, but just being able to customize test output a bit more would be very useful.