Skip to content

miguelvazsilva/playwright-amazon

Repository files navigation

playwright-amazon

Playwright Tests

End-to-end test automation framework for amazon.com, built with Playwright and TypeScript.

Demonstrates a production-ready three-layer Test Automation Framework (TAF) applied to a real-world e-commerce scenario: signing in, searching for a product, and adding it to a wish list.


What this project shows

  • Page Object Model — every page is a dedicated TypeScript class; locators live in the constructor, actions are methods
  • Custom Playwright fixtures — page objects and credentials are injected into tests via test.extend(), keeping specs clean and free of setup boilerplate
  • Three-layer architectureTest Script → Business Logic (POMs + Fixtures) → Core Library, with strict layer boundaries
  • Secure credential handling — credentials loaded from .env at runtime with fail-fast validation; never hardcoded or logged
  • Resilient locators — role-based and data-attribute selectors over fragile CSS classes; locale-aware where Amazon localises its UI

Test scenario

Feature: Insert searched item on Amazon wish list

  Scenario: Search for a MacBook Air, sign in, and add the item successfully to the wish list
    Given I am on the Amazon homepage
    And I click in the "Sign In" button
    And I enter "youremail@provider.com" into the field "Email"
    And I enter "yourpw" into the field "Password"
    And I click in the "Sign In" button
    And I click in the "Search In" button selecting the "Computers" Category
    And I enter "macBook Air" in the search box
    And I click in the "Search" button
    And I click in the image of the first result in the search list result page
    And I click in the button "Add to List" in the item page
    And I click in the button "View Your List" in the "Add to List" page
    Then My wish list, should be populated with the item macBook Air

Tech stack

Playwright Browser automation & web-first assertions
TypeScript Type safety across the entire framework
dotenv Secure runtime credential loading

Requirements

  • Node.js 22+
  • An Amazon account with at least one wish list

Setup

npm install
npx playwright install chromium
copy .env.example .env   # fill in AMAZON_EMAIL and AMAZON_PASSWORD

Run

npm run test:headed   # headed — browser visible (recommended)
npm test              # headless
npm run test:report   # open the HTML report

About

End-to-end test automation framework for amazon.com, using Playwright and TypeScript with a three-layer Page Object Model architecture.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors