microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.3k stars 3.62k forks source link

[Feature] It should give assertion failed message when test get failed. #23235

Closed Palash9088 closed 1 year ago

Palash9088 commented 1 year ago

Let us know what functionality you'd like to see in Playwright and what your use case is. When we use any assertion in playwright so the message we give should come up when the test case get failed like it happen in testng but playwright thinks that it is name of the assertion & it shows that as well in the report doesn't matter it gets passed or failed. Do you think others might benefit from this as well? yes, people are moving from selenium playwright so it should be similar to the things they are using so people will feel more confident to use playwright.

Screenshot 2023-05-23 175549

dgozman commented 1 year ago

@Palash9088 I did not understand the issue. Could you please be more specific? Provide steps that you do, what you expect and what happens instead. From what I see, your provided a custom expect message and it was shown in the report, which looks good to me.

Palash9088 commented 1 year ago

I mean to say that in testng when we use assertion -> Assert.assertEquals("playwright", "playwright", "Title not matched"); Assert.Method( actual, expected, String) so in the string we give some text & it comes when that particular assertion get failed. In playwright the assertion string text becomes the test title even if it get passed or failed it shows the same message

image image image

by the above image I think you would understand & message should be displayed when that particular expect get failed it should not become the title of the expect

Palash9088 commented 1 year ago

@dgozman It get closed mistakenly.

dgozman commented 1 year ago

@Palash9088 Thank you for the clarification. What would you like to see in the report when assertion has passed, instead of the custom message?

Palash9088 commented 1 year ago

simply what assertion we have used should be displayed in that image like in the above image, & when it get failed then the custom message should be appear. Screenshot 2023-05-23 175549 like in this image, that custom message should visible when test get failed, in image it is passed but expected outcome should be "custom message should visible when test get failed".

kasperkow commented 1 year ago

I think it works correctly. You expect that "vwo keyboard isn't visible" and it's true so you see a tick. It's logic. When you are looking at the report, it's easier to verify business logic. In the first example, it's just changed to "The count is greater than zero"

Palash9088 commented 1 year ago

@kasperkow thankyou for clarification.

I have raised one bug kindly look into this as well https://github.com/microsoft/playwright/issues/23282

Closing this one.