test: Initial PR for integrating the Page Object Model (POM) into e2e test suite#25373
test: Initial PR for integrating the Page Object Model (POM) into e2e test suite#25373
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…mask-extension into chlod-pom-first-pr
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #25373 +/- ##
========================================
Coverage 69.69% 69.69%
========================================
Files 1350 1350
Lines 47865 47865
Branches 13199 13199
========================================
Hits 33355 33355
Misses 14510 14510 ☔ View full report in Codecov by Sentry. |
Builds ready [3cfbb54]
Page Load Metrics (55 ± 8 ms)
Bundle size diffs
|
Builds ready [4a0fb1d]
Page Load Metrics (51 ± 3 ms)
Bundle size diffs
|
|
🔥 |
Hi @hjetpoluru, thanks for your suggestion! I've reviewed the page organization for Mobile and agree that alignment is beneficial. I've now created a |
Builds ready [68289f5]
Page Load Metrics (44 ± 2 ms)
Bundle size diffs
|
|
@chloeYue, let me share a screenshot of another folder structure in the development code, which will help you understand the selectors I am mentioning, this is specifically the getters/setters. For easy maintenance we need to organize this folder structure, reduces the duplication of the selectors and readable. |
Thank you for your suggestion. I understand the structure you're proposing. At this current phase, I believe it's beneficial to define the selectors within the same file as the page functions.
|
Builds ready [7b605bd]
Page Load Metrics (48 ± 4 ms)
Bundle size diffs
|
|
Thanks @chloeYue for explaining. I agree to you this is also easy pattern to maintain as it available in the page and any flakiness would be resolved. |



Description
The Page Object Model (POM) is a design pattern that promotes code reusability and maintainability in e2e testing by encapsulating UI element selectors and interactions within page objects. This initial PR is the beginning of integrating POM into e2e test suite, aiming to enhance test code quality.
The entire implementation is done in TypeScript instead of JavaScript.
Key Considerations for Implementation:
Easy Adaptation: ensure that the structure is straightforward and intuitive, thereby accelerating the development speed and facilitating easier migration.
Enhanced Logging: offer better insights during test execution and debugging, making it easier to investigate flaky test
Structure:
The POM structure is organized around distinct page objects for each application UI screen. (Common components, such as the HeaderNavbar, are directly integrated as part of a screen's component when interaction is required. This approach eliminates the need for explicit class extension and allows for the exclusion of the HeaderNavbar in screens where interaction with it is unnecessary.)
Page functions and process:
I've introduced page objects, each designed to encapsulate the elements and interactions specific to their respective pages. Additionally, I've implemented processes such as
loginWaitBalanceandsendTransactionto efficiently manage common test flows that require interactions across multiple screens.Processes should be defined for sequences that involve multiple page objects, facilitating broader testing objectives like completing transactions or logging in. These are typically actions that navigate through several screens.
Functions within a class (page object) are best used for actions and verifications that are specific to a single page. This approach promotes the encapsulation and reusability of code for individual UI components or screens, making the tests more modular and maintainable.
3 Migrated Test Cases:
Migrated 3 transaction test cases to the new POM structure, showcasing the improved test architecture and log information. These migrations serve as a POC, demonstrating the effectiveness of POM in our testing environment and provide the base for future migrations.
Additionally, I'm eliminating CSS selectors that aren't robust and replacing them with more stable selectors in this PR.
Related issues
Fixes: #24985
Relates to: #22464
Manual testing steps
Tests should pass on CI. Code should be easy to understand.
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist