Skip to content

Commit b82ea12

Browse files
committed
Minor text and comment improvements
1 parent 115815b commit b82ea12

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

website_and_docs/content/documentation/test_practices/encouraged/page_object_models.en.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,15 @@ requests from the test.
198198

199199
## Page Component Objects
200200
A page object does not necessarily need to represent all the parts of a
201-
page itself. The same principles used for page objects can be used to
202-
create "Page _Component_ Objects" that represent discrete chunks of the
201+
page itself. This was [noted by Martin Fowler](https://martinfowler.com/bliki/PageObject.html#footnote-panel-object) in the early days, while first coining the term "panel objects".
202+
203+
The same principles used for page objects can be used to
204+
create "Page _Component_ Objects", as it was later called, that represent discrete chunks of the
203205
page and can be included in page objects. These component objects can
204206
provide references to the elements inside those discrete chunks, and
205207
methods to leverage the functionality provided by them.
206208

207-
For example, a Product page has multiple products.
209+
For example, a Products page has multiple products.
208210

209211
```html
210212
<!-- Products Page -->
@@ -242,7 +244,7 @@ Each product is a component of the Products page.
242244
</div>
243245
```
244246

245-
The Product page HAS-A list of products. This relationship is called Composition. In simpler terms, something is _composed of_ another thing.
247+
The Products page HAS-A list of products. This object relationship is called Composition. In simpler terms, something is _composed of_ another thing.
246248

247249
```java
248250
public abstract class BasePage {
@@ -325,7 +327,7 @@ So now, the products test would use the page object and the page component objec
325327
public class ProductsTest {
326328
@Test
327329
public void testProductInventory() {
328-
var productsPage = new ProductsPage(driver);
330+
var productsPage = new ProductsPage(driver); // page object
329331
var products = productsPage.getProducts();
330332
assertEquals(6, products.size()); // expected, actual
331333
}
@@ -336,7 +338,7 @@ public class ProductsTest {
336338

337339
// Pass a lambda expression (predicate) to filter the list of products
338340
// The predicate or "strategy" is the behavior passed as parameter
339-
var backpack = productsPage.getProduct(p -> p.getName().equals("Backpack"));
341+
var backpack = productsPage.getProduct(p -> p.getName().equals("Backpack")); // page component object
340342
var bikeLight = productsPage.getProduct(p -> p.getName().equals("Bike Light"));
341343

342344
assertEquals(new BigDecimal("29.99"), backpack.getPrice());
@@ -489,5 +491,4 @@ public class LoginPage {
489491
return submitLogin();
490492
}
491493
}
492-
493494
```

0 commit comments

Comments
 (0)