DEV Community

SIYAMALA G
SIYAMALA G

Posted on

Playwright-JS

What is Playwright?
=> It is an open-source automation framework developed by Microsoft
=> It is a tool used to automate web browsers for test websites and web applications.

How to Work?
Developers build the website, and testers check if all its features are working correctly. They verify things like:

Does the website open when the URL is entered?
Does the username and password work?
Is the Login button clickable?
After clicking Login, does the dashboard or next page open?
Are all other features working as expected?
Enter fullscreen mode Exit fullscreen mode

Types of Testing
1. Functional Testing
It is the automated verification that every feature of a web application behaves as expected when users interact with it.
Example

Features to test:

Login
Search for products
Add items to cart
Remove items from cart
Checkout
Logout
Enter fullscreen mode Exit fullscreen mode

Playwright can automate all these functional tests instead of a tester performing them manually every time.

2.End-to-End (E2E) Testing
It means testing your application the same way a real user would interact with itβ€”from opening the website to completing a full workflow.

πŸ€– opens browser
↓
Visits website
↓
Clicks Login
↓
Types username
↓
Types password
↓
Clicks Sign In
↓
Checks "Welcome, Siyamala"
Enter fullscreen mode Exit fullscreen mode

3. Regression Testing
Regression Testing means checking that old features still work after you make changes to your application.

4. Cross-Browser Testing
Cross-Browser Testing means checking that your website works correctly in different web browsers.

βœ… Google Chrome
βœ… Microsoft Edge
βœ… Mozilla Firefox
βœ… Safari

5. UI Testing
UI (User Interface) Testing means checking that the visible parts of a website work and appear correctly.

+---------------------+
| Username [________] |
| Password [________] |
|                     |
|  [ Login Button ]   |
+---------------------+
Enter fullscreen mode Exit fullscreen mode

βœ… Buttons
βœ… Text boxes
βœ… Colors
βœ… Images
βœ… Menus
βœ… Forms
βœ… Labels
βœ… Links

6. Smoke Testing
Smoke Testing means running a small set of important tests to quickly check whether the application is basically working.

7. API Testing
API Testing in Playwright is the process of sending HTTP requests to an API and verifying that the responses are correct, without interacting with the application's user interface.

Playwright verifies that:

The response status code is 200 OK.
The response contains the expected data.
A valid authentication token is returned.

*Common API Requests *

GET – Retrieve data
POST – Create new data
PUT – Update existing data
DELETE – Remove data

Top comments (1)

Collapse
 
frank_signorini profile image
Frank

How does Playwright handle browser context, I've had issues with this in similar frameworks. Would love to hear more about your experience with it.