0% found this document useful (0 votes)
3 views

Paywright - 2

The document is a practical guide on mastering Playwright, covering essential testing techniques such as assertions, link validation, screenshot comparisons, and product listing verification. It emphasizes the importance of structured test hierarchies and the use of hooks, along with the implementation of the Page Object Model for organizing test code. Additionally, it addresses common issues that may arise during testing, such as navigation errors and dialog handling during the purchase process.

Uploaded by

haq.abdul.two16
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Paywright - 2

The document is a practical guide on mastering Playwright, covering essential testing techniques such as assertions, link validation, screenshot comparisons, and product listing verification. It emphasizes the importance of structured test hierarchies and the use of hooks, along with the implementation of the Page Object Model for organizing test code. Additionally, it addresses common issues that may arise during testing, such as navigation errors and dialog handling during the purchase process.

Uploaded by

haq.abdul.two16
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Mastering Playwright: A Practical Guide

By David Udoh
Note: In subsequent folders for a new project on same system, start with (Test:
Install Playwright - Select JavaScript), other steps above it covered.
Assertions
1. Sign up and assert the title ‘Store’.

2. Login and ensure welcome meesage is displayed.

3. Changing text for welcome message.


Verify that links on a page are valid or not broken.
.
1.How to get links on a web page

2. Ensure that the links are valid and accessible.

3. Handle navigation error like Type error null response

Note: Some common reasons why page might return null


Invalid URL.
Network issues. Exceeding default Timeouts.
JavaScript errors on the page.
Blocked Requests due to security setting.
Take screenshot of webpage, add path and compare.

1. How to take screenshot of a web page.


.

2. Take screenshot of a full web page and include time.

3. Take screenshot of element in a web page.

4. Compare screenshot of a web page.

5. Compare screenshot of element in a web page.

Note: Compare screenshot fails at first run


List out product on a page

Verify the number of products and list them out.

Note: Shorter codes is best and structure your test into a hierrachy.
In test pyramid, Unit test, Integration and End-to-end test.
Hooks

Employ Hooks in your tests.


Dialogs
Place an order.
Asserting that the Cart link is enabled for click.
Asserting that the Place Order button (element) is visible.
Users can’t proceed to purchase without filling card number.

Note: All fields throw a dialog if you proceed to purchase without filling details
Page Object Model
LoginPage.js

pomLogin.spec.js

Note: Create page folder in project (not under test) for your LoginPage.js

You might also like