Should we add performance.mark() and performance.measure() functions to measure an action's performance?
Filip Hric posted an article about doing this with Cypress: https://filiphric.com/testing-frontend-performance-with-cypress
This is different than our WebPerformance metrics or the Chrome DevTools Protocol performance metrics since this is based on an action and the user has the ability to set it.
This is similar to the stopwatch decorator we have (I want to change this decorator too though...), but would be based on the browser's perception instead of the current thread running the test. Is this a good idea? Would this be useful?
Filip's example would look something like this:
def add_to_cart(name: str, quantity: int)
py.get(f"#{name}").click()
py.get("#qty").type(quantity)
py.get("#add-to-cart-btn").click()
def test_action_duration(py: Pylenium):
py.visit("https://some-ecommerce-website.com")
py.performance.mark("custom name")
py.add_to_cart("ball", 2)
time = py.performance.measure("custom name")
assert time < 5, "Took longer than 5 seconds to add item to cart"
Or we could use a decorator approach as well
@performance.mark("custom name")
def add_to_cart(name: str, quantity: int):
...
Should we add
performance.mark()andperformance.measure()functions to measure an action's performance?Filip Hric posted an article about doing this with Cypress: https://filiphric.com/testing-frontend-performance-with-cypress
This is different than our WebPerformance metrics or the Chrome DevTools Protocol performance metrics since this is based on an action and the user has the ability to set it.
This is similar to the
stopwatchdecorator we have (I want to change this decorator too though...), but would be based on the browser's perception instead of the current thread running the test. Is this a good idea? Would this be useful?Filip's example would look something like this:
Or we could use a decorator approach as well