Skip to content
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

Logger statements in the Reports #64

Closed
tajeshwarbhumra opened this issue Aug 4, 2020 · 5 comments
Closed

Logger statements in the Reports #64

tajeshwarbhumra opened this issue Aug 4, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@tajeshwarbhumra
Copy link

Is your feature request related to a problem? Please describe.
I have been using jest framework for integration testing and going to develop some 1000+ jest tests for the same. I am using jest-html-reporter for reporting. Is there anyway I can publish additional logging statements/test steps in the reports for both pass and fail test cases?

Describe the solution you'd like
I am requesting for some additional feature to print statements/steps in both passed and failed tests case, so that by looking report only one can able to analysis. Something like below :

test(Dummy Test, () => {
step("Step 1 : Connecting internet ")
step("Step 2 : Connecting to VM ")
step("Step 3 : Asserting connections details ")
expect(status).toEqual(200)
step("Test completed ")
});

Describe alternatives you've considered
If not the above solution, is there any way that I can print console.log in the report? I am using "includeConsoleLog : true" in jest.config.js and also "verbose=false" , but still I am not able to print console.log
Currently my jest.config.js looking like this :

"reporters": [
"default",
["jest-html-reporters", {
"publicPath": "./html-report",
"filename": "report.html",
"expand": true,
includeConsoleLog : true,
}]
],

Additional context
Add any other context or screenshots about the feature request here.

@tajeshwarbhumra tajeshwarbhumra added the enhancement New feature or request label Aug 4, 2020
@aruiz-caritsqa
Copy link
Contributor

Hey @tajeshwarbhumra,

You'll be able to achieve what you need with the addAttach() function, by doing the following:

await addAttach('', 'Your Text');

Its not pretty though. I added an addMsg() function in the @carits-qa/jest-html-reporters package and prettified the output a little bit as a temporary solution

Your request is marked as an enhancement so will hopefully be added soon (and I'll bin off my forked repo)

@Hazyzh
Copy link
Owner

Hazyzh commented Aug 9, 2020

Hi @tajeshwarbhumra ; we don't have the property includeConsoleLog in global config. so the setting includeConsoleLog : true is meaningless.

Jest framework does not include the console output info in the native output data. so we can not show it in the report.
as @aruiz-caritsqa said above, you can use addAttach to log text. This is a bit hack way. but anyway, it can work now and we can improve it once we can get console info from native output data.

And @aruiz-caritsqa, looking forward to you create a PR to add the addMsg function.

@tajeshwarbhumra
Copy link
Author

tajeshwarbhumra commented Aug 10, 2020

@Hazyzh @aruiz-caritsqa Thanks for the reply. I have tried addMsg() and addAttach() functions. Its shows the result as expected as i want its trimming down the end part of the text.
Screenshot 2020-08-10 at 2 39 45 PM

If you see above, value of bearer token is not getting displaying fully.

@aruiz-caritsqa
Copy link
Contributor

aruiz-caritsqa commented Aug 10, 2020

Hi @tajeshwarbhumra,

Just to clarify, the addMsg() function is or isn't displaying the result as expected?

The <pre> element uses overflow: 'auto' - so you'll be able to scroll right to view the remainder of the token.

@Hazyzh
Copy link
Owner

Hazyzh commented Aug 15, 2020

New version(2.0.3) which include the addMsg function has been released . Thanks for the contribution of @aruiz-caritsqa .

@Hazyzh Hazyzh closed this as completed Aug 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants