Cart is not cleared on logout and is shown to the next user
MajorP1Happens with the reference user, not only the broken test accounts.
ReportA 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.
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 item | Where 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 Gherkin | features/: .feature files in plain language, connected to the same page objects through playwright-bdd. |
| Test plan, test cases, bug reports | docs/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 README | Strategy, results and lessons learned on the repository front page. |
| System | What it is | Why it was chosen |
|---|---|---|
| SauceDemo | Practice online store | Login, catalog, cart, checkout. It ships special user accounts with known defects, so the suite has to detect real failures, not only pass. |
| Swagger Petstore | REST API with a Swagger spec | Contract testing. Its data is shared with everyone on the internet, so tests must create and delete their own. |
| Restful-Booker | REST API with token auth | Authentication, full CRUD, partial updates. |
| QA Workspace | My own QA web app | Tested black-box from a separate repo, using its README as the specification, like an independent QA team would. |
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.
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)
| 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
// 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() { /* ... */ }
}
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);
});
}
# 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
standard_user it passes; for problem_user and error_user it fails as expected and shows the bug ID.
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".
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));
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.
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 });
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.
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.
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.
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.
Happens with the reference user, not only the broken test accounts.
Report
Measured at 5.1 s against 0.1 s for the other users; the time is recorded in the report on every run.
ReportA pet without the required name is accepted, so listings contain objects that clients cannot trust.
Found in my own app by the axe scan. One colour token (4.41:1 instead of 4.5:1) causes all 23 instances.
ReportFrom 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.
| Project | Tests | Passed | Expected failures |
|---|---|---|---|
api Petstore + Restful-Booker | 22 | 21 | 1 |
chromium SauceDemo + QA Workspace | 112 | 89 | 23 |
firefox | 112 | 89 | 23 |
webkit | 112 | 89 | 23 |
mobile Pixel 7 viewport | 2 | 2 | 0 |
bdd Gherkin scenarios | 19 | 18 | 1 |
| Total | 379 | 308 | 71 |
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.
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.
.feature files into runnable tests. Cheap, and it stops everything else if the code does not even compile.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.
async ({ page, inventory }).expect that keeps re-checking until the condition is true or a timeout passes, instead of checking once. It replaces fixed waits.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