Udemy Playwright: Web Automation Testing From Zero to Hero: Difference between revisions

Jump to navigation Jump to search
m
Line 708: Line 708:
== Section 6: Page Object Model ==
== Section 6: Page Object Model ==
=== Intro ===
=== Intro ===
* design pattern to improve maintainability and reusability
* there's no industry standard way to do it though
* Core concepts
** each page has a class
** with methods for operations
* Two Important Principles
** DRY - don't repeat yourself
** KISS - keep it simple stupid
* Two Good Practices
** Descriptive naming
** <s>Avoid tiny methods</s> => I don't agree, especially if this leads to code repetition.
Note:
For me I like POM's to encapsulate the page (or component) so that the object knows
* how to find things it contains
* how to do things that it implements
with the end result being that code consuming the object interacts with it in a way that feels and reads like a real user might.
=== First Page Object ===
=== First Page Object ===
=== Navigation Page Object ===
=== Navigation Page Object ===

Navigation menu