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

[Feature]: Trace viewer log type actions #1565

Open
ochezeau opened this issue May 2, 2024 · 4 comments
Open

[Feature]: Trace viewer log type actions #1565

ochezeau opened this issue May 2, 2024 · 4 comments

Comments

@ochezeau
Copy link

ochezeau commented May 2, 2024

🚀 Feature Request

It can be great to have the possibility to add "log" action to the list of actions on the trace viewer to better following the tests execution and so easy readiness. It can also facilitate debugging.

Example

For example, if we are writing a Junit integration test like that.

myService.createOrder(new order)
myService.addOrderLine(myOrder, new line1)
myService.addOrderLine(myOrder,new line 2)

myApp.jmsPublishOrder(myOrder)

page.navigate(toPublishedOrder)
assertThat(page.locator(myOrderId).isVisible()

myApp.jmsValidateOrder(myOrder)

page.navigate(toValidatedOrder)
assertThat(page.locator(myOrderId).isVisible()

myApp.doSomeMoreTimeConsimingActions()

page.navigate(toOrderFinised())

===========>

It can be good to see:

Log Preparing new order 1
Log Send order
Page.navidate toPublishedOrder
Locator.expect myOrderId
Log Validate order 1
Page.navidate toValidatedOrder
Locator.expect myOrderId
Log do some more time consuming actions
page.navigate(toOrderFinised())

Motivation

We are using Playwright for simple gui tests and complexe automatique integration tests. Our complexe tests can have a lot of steps and are used on a system that interact with:

  • Real hardware's (robots, sensor etc...),
  • Physicals user actions
  • External systems that send actions to do to the system

The web application uses a lot of Server Sent Event that update the display of the GUI.
The Playwright Traces are saved as proof of tests execution success and so it can be wery useful to be able to better follow the test and to understand which external action influence the gui display and so the Playwright navigations, actions and checks we are doing.

Workaround

Currently we are doing as workaround Page.evaluate("console.log('my log')"). It allows to understand test execution but in the list of actions we have juste Page.evaluate. The detail of the log can be seen in the detail of the evaluate or in the console.
As we have a GUI snapshot for Page.evalute, this solution as also the disadvantage of increasing the size of the Trace zip

@dgozman dgozman transferred this issue from microsoft/playwright May 2, 2024
@yury-s
Copy link
Member

yury-s commented May 2, 2024

Related request in python microsoft/playwright-python#1949

@yury-s
Copy link
Member

yury-s commented May 2, 2024

Sounds like something similar to test.step from Node.js version should address the problem by naming related groups of actions.

@uchagani
Copy link
Contributor

uchagani commented May 3, 2024

idea: we could add a TestStep fixture that allows this?

public void fooTest(TestStep step, Page page) {
  step.describe("Prepare new order", () -> {
    // some playwright actions
  }
}

Although this won't solve any logging any non-playwright actions but I don't think playwright currently allows that anyways. There are other issues similar to this most recently microsoft/playwright#30610.

@ochezeau
Copy link
Author

ochezeau commented May 6, 2024

Step is a good idea to add more context. For my use case, as I'm doing complexe integration tests with multiple "actors", it is important to have the possibility to add "non playwrigth" actions. I'm doing external actions that sents update GUI using SSE.

For example, i can do :

  • check Motor power OFF on GUI
  • External action, power ON Motor => new SSE with power ON
  • check Motor power ON on GUI

if i don't have the information of the external action, it is difficult to understand why I'm doing a check on OFF and just after ON without any apparent change:

  • check Motor power OFF on GUI
  • check Motor power ON on GUI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants