How to combine Playwright locators to test non-deterministic application flows
AI Summary
This video demonstrates how to test non-deterministic application flows using Playwright for end-to-end testing or synthetic monitoring with Checkly. It uses a demo application with a login flow that sometimes shows a “You are in” message and sometimes asks to “Try again.” The video explains how to leverage Playwright’s
locator.or
method to create a combined locator that waits for multiple possible elements to appear. It shows practical steps to implement and verify this in Playwright UI mode, enabling tests to handle different outcomes in the same flow. The approach provides maximum flexibility to test scenarios where different results may occur, and the video also references handling asynchronous elements like cookie banners with try/catch. The content is aimed at developers needing solutions for testing non-deterministic UI behaviors effectively with Playwright.