Blog

Streamlining telematics software testing with Playwright

As a software developer, you understand the importance of creating a high-quality application to meet customer demands and stay competitive in the market. However, ensuring quality can be a difficult task, particularly in terms of quality assurance. Without a reliable automation framework and swift test execution times, your time to market can be delayed, leading to customer dissatisfaction. In this blog post, we'll discuss how Navixy has improved our quality assurance process by using Playwright, a powerful test automation framework from Microsoft, and how you can benefit from our experience.

Playwright for testing automation

At Navixy, we have a long history of using Selenium to automate our web interfaces. However, as we’ve learned from experience, Selenium struggles to handle modern interfaces, behaves unreliably, requires numerous workarounds including waits for each action, and is slow to boot.

Fortunately, progress has not stood still, and in recent years, powerful frameworks like Playwright have emerged and continue to develop. A Microsoft framework, Playwright has quickly gained popularity among testing communities thanks to its full-fledged versions for Java and Python, in addition to being a node.js library. With all of this in mind, we decided to launch a new automation project.

Benefits of Playwright

So, what are the benefits of Playwright? First, its cross-browser capability allows tests to run on all modern browser engines, including in headless mode, meaning tests can run without the browser interface. Additionally, this functionality allows all supported browser engines to be launched from Windows, Linux, or macOS.

Playwright is incredibly stable, with built-in automatic waiting for element states. If necessary, various network and response waiting states can be used, all of which are easily customizable. Playwright also excels at working with HTTP requests. Tests can easily intercept any HTTP request and replace its response. For example, the OBD2 & CAN widget can only be covered by tests with mock data, as there is nowhere to obtain real data from different sensors for automated testing.

Furthermore, Playwright provides tools for working with APIs. End-to-end tests cannot do without creating some preconditions. For instance, a delete geofence test must first check if there is a geofence that can be deleted, and if not, create one before the test. Directly using the API to accomplish this is much faster than repeatedly launching the browser and performing the task via the UI. In other cases, external libraries would need to be used to interact with our API and write an implementation from scratch, but Playwright comes with everything already built-in. In fact, it’s not only an auxiliary for working with APIs during testing, but also a fully-fledged tool specifically designed for API testing. For example, it can easily replace the REST Assured library, which was created for the same purpose.

Delete geofence test – a neat and clean structure
Delete geofence test – a neat and clean structure

Every test is run in an isolated context, with the browser being reused, increasing speed and stability. Contexts do not intersect with each other within the same browser, and each context has its own cookies, local storage, etc.

Finally, Playwright is incredibly fast. Compared to Selenium, the difference in speed is astounding. Comparative tests can be found online, demonstrating how Playwright can fill out a form with a hundred fields much faster than Selenium.

Rapid testing in Navixy with Playwright

At the moment, we have a decent pool of e2e autotests for monitoring and navigating the application, with a convenient and easily maintainable architecture based on the Page Object pattern. We have added a bit of syntactic sugar in the form of Kotlin DSL for the cleanliness and beauty of the tests, implemented easy-to-use mock functionality, and are continuing to work on covering other sections. All existing tests are already run in nightly builds on Gitlab CI.

Playwright test results
Playwright test results

Our future plans include expanding our tests and coverage, linking the frontend build with the autotest build in TeamCity, parallelizing the execution of independent test suites, and adding beautiful reports (e.g., with Allure).

In conclusion, with Playwright, we have found a reliable and powerful tool for automating our web interfaces. Its cross-browser and cross-platform functionality, exceptional stability, HTTP request handling, API tools, isolation, and speed make it an excellent choice for any automation project.

You can experience Navixy for yourself by today.

← Previous articleNext article →
Ready for the most innovative GPS tracking software?
SIGN UP
Recent posts