question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hey, I am migrating tests from Cypress to Playwright and we had a couple of tests that were testing some elements on the SSR. Is it possible to achieve an equivalent behavior to the Cypress one from this article?

With Cypress, we were able to use selectors on the $html from the response, I’m not sure if that’s doable with Playwright. I tried both:

  • const response = await page.goto() / const response = await request.get()

Then to apply the response.text() I can see the server-side HTML as a string but I cannot use any selectors on it. I would appreciate any advice on how to test SSR HTML, thank you.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ambiguous48commented, Nov 24, 2022

I guess that would depend what you are testing for. If your aim is to test the user experience on different browsers/devices/screen sizes/etc, then you’re better off using the various web api’s exposed by playwright.

Based on the simple example you’ve given, if you change the html tag from nav to header (or div to span, etc) for whatever reason, your test will fail even though nothing would change from the end user’s perspective. If you use playwright’s locators however, your tests will continue to pass regardless of the implementation details.

1reaction
dgozmancommented, Nov 24, 2022

Closing as per above. Thanks @ambiguous48 for the great explanation!

Read more comments on GitHub >

github_iconTop Results From Across the Web

System Of A Down - Question! (Official HD Video) - YouTube
Official HD music video for ” Question !" by System of a DownListen to System of a Down: https://SystemOfADown.lnk.to/listenYDSubscribe to the ...
Read more >
Question Definition & Meaning - Merriam-Webster
noun ; b · a subject or aspect in dispute or open for discussion : issue ; d · the specific point at...
Read more >
Question Definition & Meaning | Dictionary.com
a problem for discussion or under discussion; a matter for investigation. a matter of some uncertainty or difficulty; problem (usually followed by of):...
Read more >
Meaning of question in English - Cambridge Dictionary
a sentence or phrase used to find out information: The police asked me questions all day. Why won't you answer my question?
Read more >
question - Wiktionary
NounEdit · A sentence, phrase or word which asks for information, reply or response; an interrogative. · A subject or topic for consideration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found