Skip to content

Tech Design suggestion: Improvements in e2e using Page Object Pattern #9805

Open
@zodman

Description

@zodman

It's very rare to find a open-source project that has e2e testing, it is fantastic because it works very well.

This e2e test will start growing! and maintaining will be painful if you don't follow some good pattern or practice.

I suggest changing pattern the e2e to Page Object Pattern, its a pattern used in automation

I think the best pages to understand the pattern:

https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/
https://martinfowler.com/bliki/PageObject.html

The benefits of use Page Object Pattern:

  • Clean separation between test and page-specific code
  • Locators are in the same place
  • If the UI changes the test doesn't change only the Page object

Rules to follow

  • The public methods represent the services that the page offers
  • Try not to expose the internals of the page
  • Generally don’t make assertions
  • Methods return other PageObjects
  • Need not represent an entire page
  • Different results for the same action are modelled as different methods

Page Object Pattern research : https://sepl.dibris.unige.it/publications/2013-leotta-ICSTW.pdf

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions