In automatic tests, it is often difficult to work with pages that differ depending on the screen size, type of user, localization, or other conditions. And when you work with such pages - a strong desire arises - “the page is almost the same, i just need one additional click for mobile version ...”, and often “if / else” becomes the solution. In this talk, I want to show the approach that I use in the current project, which allows me to support and develop tests for 12 versions of the same web application. I called this Versioned Page Objects. It allows to reuse common logic between different versions of page through inheritance, and also override or remove some logic where necessary, without any if / else blocks across the code. TypeScript code examples
Versioned Page Objects: How to handle 12 versions of web application
1. Versioned Page Objects:
How to handle 12 versions of
web application
Oleksandr Khotemskyi, 2020
xotabu4.github.io
2. Oleksandr Khotemskyi
• Software Development Engineer in Test
• Independent Contractor
• 8+ years of experience in test automation and QA
• Primary stack - JavaScript/TypeScript (NodeJS)
xotabu4.github.io
4. Business versions
• Different variants of same application
• Not a separate apps - lot of logic is reused
• It is needed for better targeting to specific clients/markets
• Can be temporary - special Christmas versions, some
cooperation with other brands…
9. Device/screen type
• Mostly known type of versions
• Mobile, Desktop, Tablet versions of same app
• Also sometimes special versions for TV and consoles
should be included
10.
11.
12.
13.
14.
15.
16. Localization
• Special version for country/language
• Usually needed to better adapt to some local markets
• Similar with business versions, but mostly related to some
country specific things
• Hardest parts here: translations and legal requirements
17.
18.
19. A/B tests
• Special experiments to prove/disprove some hypothesis
about user behaviors in application
• It is done by splitting traffic to 2 or more variants (versions),
and tracking metrics that should be affected
• Used to optimize user experience, increase important
metrics (time spend on website, conversion rate, etc…)
• For test automation this means our UI/logic will be changed
even more often
36. Abstract Home
Page
Mobile Home Page Desktop Home Page
Shared logic here
Shared locators here
Desktop specific logic here
Desktop locators here
Can override base methods/properties
4 business versions - each has some specific features
7 locales (one version with only one locale)
3 screen sizes
Most of the locators (~80%) are the same
Main application flow is the same
Total 66 possible combinations