protractor-beautiful-reporter
protractor-beautiful-reporter copied to clipboard
Expand options for displaying logs
My tests typically have console.log statements that are relevant for the output, but don't make it into the output because it's only caring if the level is a warning or error. I'd love to be able to control the level of logging I include in the report
Along those same lines, things will get logged as part of a beforeAll in a describe, but those will never appear in the output. An example use-case for this is using a beforeAll to perform a search on a page. If there are no results from the search then we don't need to run the tests in the describe. As it stands, I have to have logic in each test to check whether the test should run and spit out the same message I already had in the describe.
Ultimately, it would be helpful to just get a dump of what's actually getting logged to the console (even as an xml or json file separately) that I could mess with, but everything out there tries to interpret the results and drops all the console logging. In a perfect world, those logs could be associated with the describes/tests in the json for this output.
I tried things to have logs other warning or error. It has to do something about the configuration of the webdriver: https://sites.google.com/a/chromium.org/chromedriver/capabilities I tried some things but it did not work. Our code does not filter the logs it is the webdriver or selenium.
All the raw data can be inspected in the file "combined.json" that is placed in the same folder as the index.html. In order to read it you have to unescape it with CircularJson.parse(). The is the property browserLogs which contains all the browserLogs that where captured.
That's the thing though - my Info log statements are in the combined.json file. They just won't appear in the rendered page because the ng-if logic in the Log column only checks the results for logWarning > 0 and logError > 0. When I filter for "With Log", the test I have below is returned, but there's no indicator that there are logs. If I go to Developer Tools I can see that there's data available, it's just not being exposed.
This is copied from combined.json
{
"description":"Test1",
"passed":true,
"pending":false,
"os":"Windows NT",
"sessionId":"a26ded1517be113f2e140605378251d8",
"instanceId":21316,
"browser":{
"name":"chrome",
"version":"71.0.3578.98"
},
"message":"Passed.",
"trace":"",
"browserLogs":[
{
"level":"INFO",
"message":"console-api 372:56 'value A: 1.2, value B: 1.2'",
"timestamp":1549562787067,
"type":""
}
],
"timestamp":1549562786920,
"duration":130
}