Pages UI Tests Made Easy
Article Summary
Skyscanner's engineering team open-sourced their solution to one of UI testing's biggest pain points: brittle, hard-to-maintain test suites that break with every page change.
The Skyscanner Hotels team built 'pages', a Python library that implements the Page Object Model pattern with two powerful features: component-based architecture and smart asynchronous loading. It's designed to work with Selenium WebDriver but the principles apply to mobile native apps too.
Key Takeaways
- Components are lazily evaluated, preventing StaleElementReferenceException errors automatically
- Nested components enable reusable UI elements like search panels across multiple pages
- Traits system replaces boilerplate WebDriverWait code with declarative loading conditions
- Relative XPath locators keep component tests isolated and maintainable
- Built-in Table component handles common list/grid patterns with minimal code
Critical Insight
The library reduces UI test maintenance burden by treating page elements as composable, self-validating components rather than brittle element locators.