From 8978099f65c000ba43a8aa1d09989edf51ad9e9d Mon Sep 17 00:00:00 2001 From: ThomasTDS Date: Sun, 18 Oct 2026 11:18:46 -0300 Subject: [PATCH] Adiciona README em ingles README.en.md e uma traducao completa do README.md, como alternativa (a versao em portugues continua sendo a principal). Toggle de idioma adicionado no topo dos dois arquivos, mesmo padrao usado no projeto sql-defect-investigation. --- README.en.md | 261 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 5 +- 2 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 README.en.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..a08f808 --- /dev/null +++ b/README.en.md @@ -0,0 +1,261 @@ +# πŸ§ͺ QA Playwright + Cucumber - Automation Exercise + +[PortuguΓͺs](README.md) Β· **English** + +![tests](https://github.com/ThomasTDS/qa-playwright-sd/actions/workflows/tests.yml/badge.svg) +![license](https://img.shields.io/badge/license-MIT-blue.svg) +![node](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg) + +πŸ“Š **[Live Allure report](https://ThomasTDS.github.io/qa-playwright-sd/)** β€” automatically updated on every push to `main`. + +## Description + +This repository contains automated tests for **[automationexercise.com](https://automationexercise.com)**, built with **Playwright**, **Cucumber (BDD/Gherkin)** and the **Page Object Model (POM)** pattern. + +The goal is to demonstrate practical **QA Automation** skills, covering login, sign-up, logout, products, cart, checkout, contact, newsletter and passive security checks through End-to-End (E2E) tests. + +> **Status:** migration complete (the project originally targeted saucedemo.com, a much simpler site). Current coverage: login, sign-up, logout, product search, cart, checkout, contact, newsletter and security (headers, HTTPS, cookies). + +> **About the language:** the Gherkin scenarios (`.feature` files), the step definitions and the SQL/code comments are all in Portuguese. This README is a full translation of the [Portuguese README](README.md), written for an English-speaking reader of the repository, not a translation of the test suite itself. + +--- + +## Project Structure + +```text +qa-playwright-sd/ +β”œβ”€β”€ .github/ +β”‚ β”œβ”€β”€ workflows/ # CI pipeline (GitHub Actions) +β”‚ β”œβ”€β”€ ISSUE_TEMPLATE/ # Bug report template +β”‚ └── dependabot.yml # Automatic dependency updates +β”œβ”€β”€ docs/ +β”‚ β”œβ”€β”€ criterios-aceite/ # Acceptance criteria per feature (Given/When/Then) +β”‚ └── test-cases.md # Test case traceability matrix +β”œβ”€β”€ features/ # Gherkin scenarios (.feature) +β”œβ”€β”€ steps/ # Cucumber step implementations +β”œβ”€β”€ pages/ # Page Objects (LoginPage, RegisterPage, ...) +β”œβ”€β”€ reports/ # HTML report generated on each run (not versioned) +β”œβ”€β”€ allure-results/ # Raw Allure Report data (not versioned) +β”œβ”€β”€ cucumber.js # Cucumber configuration +β”œβ”€β”€ eslint.config.js # ESLint configuration +β”œβ”€β”€ .prettierrc.json # Prettier configuration +β”œβ”€β”€ .env.example # Environment variables template +β”œβ”€β”€ package.json # Dependencies and npm scripts +β”œβ”€β”€ tsconfig.json # TypeScript configuration +β”œβ”€β”€ Dockerfile # Image to run the tests containerized +β”œβ”€β”€ LICENSE # MIT license +β”œβ”€β”€ SECURITY.md # Vulnerability disclosure policy +β”œβ”€β”€ README.md # Portuguese +└── README.en.md # English (this file) + +``` + +--- + +### Clone the Repository + +``` +git clone https://github.com/ThomasTDS/qa-playwright-sd.git + +cd qa-playwright-sd +``` + +### Install Dependencies + +Requires Node.js 22 or higher (see `engines` in `package.json`). + +``` +npm install +``` + +### Install Playwright Browsers + +``` +npx playwright install +``` + +### Run All Tests + +``` +npm test +``` + +**NOTE:** _By default, tests run with the browser visible (headless = false). To run in headless mode (e.g. like in CI), use the `HEADLESS` environment variable:_ + +``` +# PowerShell +$env:HEADLESS="true"; npm test + +# bash +HEADLESS=true npm test +``` + +### Run Only the Smoke Subset + +Critical end-to-end scenarios are tagged `@smoke`. To run only that subset: + +``` +npm run test:smoke +``` + +### Lint and Formatting + +The project uses **ESLint** (code quality/errors) and **Prettier** (consistent formatting): + +``` +npm run lint # checks for lint issues +npm run lint:fix # auto-fixes what it can +npm run format # formats every file with Prettier +npm run format:check # check-only, no changes (used in CI) +npm run typecheck # checks TypeScript type errors (no output files) +``` + +A **pre-commit** hook (via [Husky](https://typicode.github.io/husky/) + [lint-staged](https://github.com/lint-staged/lint-staged)) runs automatically on every `git commit`, applying ESLint and Prettier only to staged files β€” so lint/formatting issues are caught before they even reach CI. The hook is installed automatically by `npm install` (the `prepare` script). + +### Run on a Different Browser + +By default the tests run on Chromium. To run on a different browser, set `BROWSER` (`chromium`, `firefox` or `webkit`): + +``` +# PowerShell +$env:BROWSER="firefox"; npm test + +# bash +BROWSER=firefox npm test +``` + +CI runs the full suite on all three browsers on every run. + +### Run with Mobile Device Emulation + +Scenarios tagged `@mobile` (the ones most sensitive to layout: login, product search, cart and the full checkout flow) also run with Pixel 7 emulation (real-device viewport, user agent and touch, via Playwright's own device preset). To run locally: + +``` +# PowerShell +$env:DEVICE="mobile"; npm test -- --tags "@mobile" + +# bash +DEVICE=mobile npm test -- --tags "@mobile" +``` + +With `DEVICE=mobile`, the `BROWSER` variable is ignored and Chromium is always used β€” it's the `defaultBrowserType` of the Pixel 7 preset itself in Playwright. CI runs this subset automatically on every run, in addition to the three desktop browsers. + +> **Real finding while validating this:** on narrow mobile viewports, Google AdSense ads (including a fixed "side rail" widget) load asynchronously and late, causing a layout shift big enough to overlap real buttons on the page β€” reproduced and confirmed through Playwright's actionability log (`