Goodbye 2022, Welcome 2023
With only a few days left in 2022, it looks like this fading year was not too bad for me. I was able to travel again and visit places I have missed and others I have wanted to see for a long time.
With only a few days left in 2022, it looks like this fading year was not too bad for me. I was able to travel again and visit places I have missed and others I have wanted to see for a long time.
At work we use Selenium and BrowserStack for end-to-end tests in C#. How much work is it to connect Playwright to BrowserStack?
When you work with Playwright, there are a few small things that you want to change. Often there is a flag for codegen or a settings value that will do the trick. I collected the customisations for the parts I find most useful. Feel free to add a comment for other tricks you think I should know about.
The customisations go in 3 basic places: The command line for changes to codegen, the BrowserTypeLaunchOptions() when we launch the browser or the context that we get from the newly created browser. If you get stuck, you best use the codegen option and then look at the generated code to copy that into your application. That works across languages and frameworks.
If you need to find out what went wrong during an end-to-end test, a recorded video of the browser with all its interactions can be a time saver. What is true for Selenium Grid is also a good idea for Playwright. Let's look at how we can create these videos with in NUnit and a library project.
Playwright has a great trace viewer that allows us to see exactly what is happening in our tests. This is especially helpful when something goes wrong. Let's take a look at how we activate tracing and access the information it collects.
Test recording has a bad reputation: The generated code is brittle, ugly and contains so many details that developers do not bother to understand it – instead, they start over from scratch. Microsoft did its part in creating that bad reputation. But Microsoft learned its lessons and did a big step forward with Codegen, the test recorder for Playwright.
After we got Playwright up and running in the last post, we can now take a closer look on how we can automate a web browser with Playwright.
After last week's turbulences, many people on Twitter talk about moving to Mastodon. For me the biggest challenge to create an account on Mastodon was to find an instance. Unlike Twitter, Mastodon offers many places where you can create an account, or you can host your own server.
Playwright is a reliable end-to-end testing framework for web applications. It is open-source and available for C#, Java, JavaScript, and Python. While it is similar to Selenium and Cypress, Playwright has its own twist on testing and offers a nice set of tools to make writing tests less tedious. Since Microsoft is putting a lot of resources into Playwright, I expect it to be around for the long haul.
I had an annoying experience at the NDC workshop: when I tried to load the solution for the workshop, my Visual Studio immediately froze. It took me a few rounds to try to start Visual Studio without any code. But even then, Visual Studio was still unresponsive.