Web Testing Lab

A QA portfolio project that tests four public web systems: an online store, two REST APIs and a QA web app. This page is a guided tour: what was built, why, and how each piece works, with the real code next to the explanation.

What this project is

Unlike an app you click through, a test automation project's product is the testing itself. It takes a checklist that recruiters use for web QA portfolios and covers every item on real, public systems.

Portfolio itemWhere it is in this project
UI automation (Playwright)tests/saucedemo/ and tests/qa-workspace/, built on page objects in src/. Runs in Chromium, Firefox, WebKit and a phone viewport.
API tests (Postman and Swagger)postman/ collections run by Newman, plus the same checks in code in tests/api/, validated against the published Swagger contract.
BDD scenarios in Gherkinfeatures/: .feature files in plain language, connected to the same page objects through playwright-bdd.
Test plan, test cases, bug reportsdocs/test-plan.md, docs/test-cases/ (with traceability to requirements), docs/bug-reports/ (11 bugs with screenshots).
CI/CD pipeline.github/workflows/tests.yml: every push and every night, all suites run and the report is published to this site.
Clear READMEStrategy, results and lessons learned on the repository front page.

Systems under test

SystemWhat it isWhy it was chosen
SauceDemoPractice online storeLogin, catalog, cart, checkout. It ships special user accounts with known defects, so the suite has to detect real failures, not only pass.
Swagger PetstoreREST API with a Swagger specContract testing. Its data is shared with everyone on the internet, so tests must create and delete their own.
Restful-BookerREST API with token authAuthentication, full CRUD, partial updates.
QA WorkspaceMy own QA web appTested black-box from a separate repo, using its README as the specification, like an independent QA team would.

One test, from idea to green check

The best way to understand the project is to follow a single case through every layer. This is TC-SD-022, "a shopper completes a purchase", the most important flow in a store.

  1. Exploration: learn what the site actually does Before writing any test, I used the site with every account and wrote down what I saw: messages, prices, which buttons misbehave. Three of my first assumptions were wrong (for example, the lazy-load page never ends), which is exactly why exploration comes first.
    Tax observed: Backpack + Bike Light → item total $39.98, tax $3.20, total $43.18.
    The tax rate is 8%, rounded to the cent.            (docs/exploration/2026-11-16-saucedemo-recon.md)
  2. Requirement and test case SauceDemo has no written spec, so the observed behaviour of the reference user became numbered requirements. Each test case links to one, which is what "traceability" means: you can always answer "which requirement does this test protect?".
    | REQ-SD-08 | The overview shows item total, 8% tax rounded to the cent, and total = item total + tax. |
    
    | TC-SD-022 | Complete purchase (happy path) | 07, 08, 09 | P1 |
    |   Add Backpack + Bike Light → Checkout → Ana / Silva / 86000 → Continue → Finish
    |   Overview: item total $39.98, tax $3.20, total $43.18 → "Thank you for your order!"; badge hidden
  3. Page objects: one class per screen Instead of repeating selectors in every test, each page of the site gets a class that knows where its elements are and what you can do there. If the site changes a button, you fix one line here, not fifty tests.
    // src/saucedemo/pages/CheckoutPage.ts
    export class CheckoutPage {
      constructor(private readonly page: Page) {
        this.firstName = page.getByTestId('firstName');
        this.finishButton = page.getByTestId('finish');
        this.completeHeader = page.getByTestId('complete-header');
        // ...
      }
      async submitInformation(info) { await this.fillInformation(info); await this.continueButton.click(); }
      /** Reads labels such as "Item total: $39.98" as numbers. */
      async amounts() { /* ... */ }
    }
  4. The automated test, once per user The same test runs for all five accounts that can log in. expectKnownDefect marks the run as an expected failure when a documented bug applies to that user (see Known bugs).
    // tests/saucedemo/checkout.spec.ts
    for (const user of ACCEPTED_USERS) {
      test(`TC-SD-022 ${user} completes a purchase @p1 @smoke`, async ({ loginAs, inventory, cart, checkout }) => {
        expectKnownDefect('TC-SD-022', user);
        await loginAs(user);
        await inventory.add(backpack, bikeLight);
        await inventory.openCart();
        await cart.checkout();
        await checkout.submitInformation(CUSTOMER);
        await checkout.expectOnOverview();
        expect(await checkout.amounts()).toEqual({ subtotal: 39.98, tax: 3.2, total: 43.18 });
        await checkout.finish();
        await expect(checkout.completeHeader).toHaveText(MESSAGES.orderComplete);
        await inventory.expectCartCount(0);
      });
    }
  5. The same flow in plain language (BDD) A Gherkin scenario describes the behaviour in words a product owner can read. Each line is matched to a step function that reuses the page objects above, so there is one implementation and two ways to read it.
    # features/saucedemo/checkout.feature
    Scenario: TC-SD-022 A shopper completes a purchase
      Given I add "Sauce Labs Backpack" and "Sauce Labs Bike Light" to the cart
      When I check out as "Ana" "Silva" with postal code "86000-000"
      Then the overview shows an item total of $39.98, tax of $3.20 and a total of $43.18
      When I finish the order
      Then I see "Thank you for your order!"
      And the cart is empty
  6. CI runs it and publishes the result On every push, and every night at 06:00 UTC, GitHub Actions runs this test in four browsers and the BDD version, then builds the report you can open from the top of this page. For standard_user it passes; for problem_user and error_user it fails as expected and shows the bug ID.

The layers, and why there are several

Each rule is checked at the lowest level where it can be checked. API tests are fast and precise; browser tests are slow but are the only way to test what a user actually sees. Having both is the "test pyramid".

API, in Postman

Collections anyone on a team can open

Postman is the tool most teams use to explore and share API tests. Each request carries its own assertions; Newman runs the whole collection from the command line in CI.

// postman/restful-booker.postman_collection.json, request "TC-RB-005 Update without token is forbidden"
pm.test('403 Forbidden', () => pm.response.to.have.status(403));
API, in code

Contract testing against the Swagger document

The Petstore publishes a Swagger (OpenAPI) file that says what every response must look like. The test downloads it and validates the real response against it, so a field that silently disappears is caught.

// tests/api/petstore.spec.ts
const validate = await swaggerValidator(request, 'Pet');       // compiled from /swagger.json
const createdBody = await expectJson(await request.post(`${PETSTORE_URL}/pet`, { data: pet }), 200);
expectValid(validate, createdBody, 'POST /pet response');

Because the Petstore is shared with the whole internet, every test creates a pet with a random ID far above the ones other people use, and deletes it afterwards. Tests never depend on data they did not create.

UI

Waiting for state, never sleeping

SauceDemo's dynamic pages load content late on purpose: a spinner, an infinite list, a slider that moves on its own. A test that waits "2 seconds" is wrong on a slow day and slow on a fast one. Playwright's assertions keep checking until the state is right.

// tests/saucedemo/dynamic-catalog.spec.ts
await menu.openDynamicPage('Spinner');
await expect(dynamicCatalog.spinnerNames).toHaveCount(PRODUCTS.length, { timeout: 10_000 });
Accessibility

An axe scan on every key page

axe is the engine behind most accessibility checkers. The test fails on critical and serious WCAG violations and attaches the full list to the report. This is how BUG-011 in my own app was found.

Black-box

Testing my own app from the outside

QA Workspace already has its own test suite inside its repo. Here it is tested the way an independent QA team would: only the deployed site and the public README, in browsers its own suite does not run, after every deploy.

Known bugs stay visible without turning the build red

SauceDemo's special users are broken on purpose. Skipping their tests would hide the defects; letting them fail would make every run red and meaningless. The middle way: a map of confirmed defects, and tests that are expected to fail.

// src/saucedemo/known-defects.ts
const KNOWN = {
  'TC-SD-022': { problem_user: 'BUG-004', error_user: 'BUG-006' },
  'TC-SD-037': { '*': 'BUG-001' },        // affects every user
  // ...
};

export function expectKnownDefect(caseId, user) {
  const bug = bugFor(caseId, user);
  if (!bug) return;
  test.info().annotations.push({ type: 'issue', description: `${bug}: ${BUGS[bug]}` });
  test.fail(true, `${bug}: ${BUGS[bug]}`);   // expected failure, linked to the bug report
}

In the report these show as "expected failures" with the bug ID. If the site ever fixes a bug, that test passes unexpectedly, the run fails, and that is the signal to close the bug report and remove the entry.

Bugs found

Eleven defects, each with a report in the same format: environment, severity (impact on the user) and priority (fix order) rated separately, steps, expected vs actual, and evidence. The screenshots were taken by a script that replays the exact steps in the report, so they can be regenerated at any time.

Cart page showing two items right after a different user logged in
BUG-001 · SauceDemo

Cart is not cleared on logout and is shown to the next user

MajorP1

Happens with the reference user, not only the broken test accounts.

Report
Product list where every product shows the same placeholder image
BUG-002 · SauceDemo

Product images replaced by a "not found" placeholder

MinorP3Report
Product list with the cart badge at 3 after clicking all six Add to cart buttons
BUG-003 · SauceDemo

"Add to cart" does nothing for three products

MajorP1Report
Checkout form with Silva in the first-name field, an empty last-name field and the error Last Name is required
BUG-004 · SauceDemo

Typing in Last Name overwrites First Name, so checkout is blocked

CriticalP1Report
Checkout form where the last-name field stayed empty after typing
BUG-005 · SauceDemo

Last Name ignores input, but checkout continues without it

MajorP2Report
Checkout overview still shown after clicking Finish
BUG-006 · SauceDemo

Finish does nothing, so the order never completes

CriticalP1Report
Product list still in A to Z order after choosing Z to A
BUG-007 · SauceDemo

Sorting does not reorder the product list

MajorP2Report
Product list showing prices that differ from the catalog
BUG-008 · SauceDemo

Catalog shows wrong prices that change on every page load

CriticalP1Report
BUG-009 · SauceDemo

Login takes about 5 seconds

MinorP3

Measured at 5.1 s against 0.1 s for the other users; the time is recorded in the report on every run.

Report
BUG-010 · Swagger Petstore

The API stores pets that break its own contract

MajorP2

A pet without the required name is accepted, so listings contain objects that clients cannot trust.

Report
BUG-011 · QA Workspace

Secondary text falls below the WCAG AA contrast ratio on every page

MajorP2

Found in my own app by the axe scan. One colour token (4.41:1 instead of 4.5:1) causes all 23 instances.

Report
Questions, not bugs. Two behaviours were logged as questions for the product owner because no requirement says they are wrong: SauceDemo completes an order with an empty cart ($0.00), and Restful-Booker accepts a checkout date before the checkin date. Keeping the two apart is what makes a bug list trustworthy.

Results

From the full run on 2026-11-16 (2.9 minutes locally with 4 workers; the same suites run in CI). An "expected failure" is a test that hit a documented bug.

ProjectTestsPassedExpected failures
api Petstore + Restful-Booker22211
chromium SauceDemo + QA Workspace1128923
firefox1128923
webkit1128923
mobile Pixel 7 viewport220
bdd Gherkin scenarios19181
Total37930871

Postman through Newman: Restful-Booker 12 requests and 16 assertions, Petstore 9 requests and 13 assertions, all passing. The 23 expected failures per browser are the 9 SauceDemo bugs across the users they affect, plus the 4 axe scans of QA Workspace.

The pipeline

A test that only runs on one laptop proves little. The workflow in .github/workflows/tests.yml runs on every push, on every pull request, every night, and on demand.

  1. Typecheck and BDD generation Compiles the TypeScript and turns the .feature files into runnable tests. Cheap, and it stops everything else if the code does not even compile.
  2. API job Playwright API tests, then both Postman collections through Newman, with an HTML report saved as an artifact.
  3. UI matrix Five jobs in parallel: Chromium, Firefox, WebKit, the phone viewport and the BDD scenarios. Each first checks that the sites under test are reachable, so an outage shows as a clear error rather than a hundred failures. On failure, traces and screenshots are uploaded.
  4. Publish Merges every job's results into one Allure report and deploys it, together with this page, to GitHub Pages.

The first real run in CI failed in one job: the BDD tests were generated in the typecheck job but not in the job that ran them. That is the kind of thing a first run is for; the fix was one step in the workflow.

Glossary

Page object
A class that represents one screen: where its elements are and what a user can do there. Tests call it instead of touching selectors directly.
Fixture
Something a test receives ready-made, such as a logged-in page or a page object. In Playwright, fixtures are the parameters in async ({ page, inventory }).
Data-driven test
One test written once and run for each row of data, here once per SauceDemo user.
Web-first assertion
An expect that keeps re-checking until the condition is true or a timeout passes, instead of checking once. It replaces fixed waits.
Contract test
Checking a response against the API's published description (the Swagger file), not only against values you expect.
BDD / Gherkin
Writing scenarios as Given / When / Then in plain language, with each line bound to code that performs it.
Expected failure
A test marked as "we know this fails because of bug X". It is reported, not hidden, and alerts you when it starts passing.
Flaky test
A test that sometimes passes and sometimes fails without the product changing. Every flaky result here was traced to a cause and fixed at the source.
Traceability
The link from each test case back to the requirement it covers, so you can see what is and is not protected.
Severity vs priority
Severity is the impact on the user; priority is the order in which the team should fix it. They are rated separately: a cosmetic bug on the home page can be low severity and high priority.
CI (continuous integration)
Running the tests automatically on a server for every change, so results do not depend on anyone's laptop.
Allure
The report tool that merges results from all jobs into one browsable page with steps, screenshots, videos and attachments.

Run it yourself

git clone https://github.com/heloisatorres1/web-testing-lab.git
cd web-testing-lab
npm install
npx playwright install                       # downloads the browsers

npm run test:smoke                           # the P1 journeys, Chromium + API, about a minute
npx playwright test --project=chromium --headed --grep "TC-SD-022"   # watch the purchase test in a visible browser
npm run report                               # open the local HTML report