Skip to content

Step 2: Test Scenarios

Every feature gets at least three scenarios: a Pass (the way it's supposed to work), a Fail (feed it something invalid and make sure it's rejected), and an Edge (a boundary or an odd case). Each row below is one real test in the suite, and the spec file is noted at the top of each section.

In the tables, P is Pass, F is Fail, E is Edge. One precondition holds for all of them and isn't repeated: the demo store is up and the home page has loaded, which means the Cloudflare challenge has cleared.


1. User Registration: tests/registration.spec.ts

IDTypePreconditionStepsExpected Result
REG-P1POn /register, email not yet usedSelect gender → enter first/last name, unique email, valid password + matching confirm → click Register"Your registration completed" is shown and the user is logged in (Log out link visible). Runs data-driven for a male and a female profile.
REG-F1FAn account already exists with email XOpen /register → fill the form using email X → RegisterError summary shows "The specified email already exists"; no new account created.
REG-E1EOn /registerEnter an invalid email format, a 3-char password, and a non-matching confirm password → RegisterInline field errors appear: email "Wrong email", password length error, and "The password and confirmation password do not match."

2. Login: tests/login.spec.ts

IDTypePreconditionStepsExpected Result
LOG-P1PA registered account exists (created by fixture)Open /login → enter valid email + password → Log inUser is authenticated; Log out link visible and account link shows the email.
LOG-F1FnoneOpen /login → enter an unknown email + password → Log inLogin rejected, error "No customer account found"; user stays unauthenticated. (Data-driven)
LOG-F2FnoneOpen /login → leave email emptyLog inField validation "Please enter your email"; not authenticated. (Data-driven)
LOG-F3FnoneOpen /login → enter a malformed emailLog inValidation "Please enter a valid email address"; not authenticated. (Data-driven)
LOG-E1EA registered account existsOpen /login → enter the correct email but a wrong passwordLog inError summary shown; user not authenticated.

3. Product Search: tests/search.spec.ts

IDTypePreconditionStepsExpected Result
SRCH-P1POn home pageType a real keyword (laptop, phone, book) in the header search → SearchAt least one product is returned and the result titles contain the keyword. (Data-driven over 3 keywords.)
SRCH-F1FOn home pageSearch for a gibberish term (zxqwvbnmasdf123) → Search"No products were found" message; zero results.
SRCH-E1EOn home pageSearch for a 2-character term (ab) → SearchWarning "Search term minimum length is 3 characters".

4. Add to Cart: tests/addToCart.spec.ts

IDTypePreconditionStepsExpected Result
CART-P1POn product page (HTC smartphone)Click Add to cartSuccess toast "The product has been added to your shopping cart"; cart counter increases by 1; cart page shows the line item.
CART-F1FCart contains a productOpen /cart → enter an invalid coupon code → Apply couponFailure message "The coupon code cannot be found".
CART-E1ECart contains a productOpen /cart → change the line quantity to 3Quantity field shows 3 and cart counter shows (3); totals recalculated.

5. Wishlist: tests/wishlist.spec.ts

IDTypePreconditionStepsExpected Result
WISH-P1POn product page (HTC smartphone)Click Add to wishlistSuccess toast "The product has been added to your wishlist"; wishlist counter shows (1); item appears on /wishlist.
WISH-F1FFresh session, nothing addedOpen /wishlistEmpty-state message "The wishlist is empty!".
WISH-E1EA product is in the wishlistOpen /wishlist → tick the item → Add to cartUser is taken to /cart and the item is present in the cart.

6. Currency Change: tests/currency.spec.ts

IDTypePreconditionStepsExpected Result
CUR-P1POn home page (default USD)Choose Euro in the currency selectorProduct prices re-render with the symbol.
CUR-F1FOn home pageInspect the currency selector options; attempt to select an unsupported currency ("Bitcoin")Only "US Dollar" and "Euro" are offered; selecting an unsupported value throws / is impossible (input is constrained).
CUR-E1EOn home pageSwitch to Euro → navigate to a search results pageEuro stays selected and prices still display after navigation (selection persists).

7. Newsletter Subscription: tests/newsletter.spec.ts

IDTypePreconditionStepsExpected Result
NEWS-P1POn any page (footer visible)Enter a valid unique email → SubscribeResult block shows "Thank you for signing up …".
NEWS-F1FOn any pageEnter a malformed email (plainaddress) → SubscribeError "Enter valid email".
NEWS-E1EOn any pageLeave the email empty → SubscribeError "Enter valid email" (empty boundary rejected).

8. Contact Us: tests/contactUs.spec.ts

IDTypePreconditionStepsExpected Result
CON-P1POn /contactusEnter name, valid email, enquiry text → Send"Your enquiry has been successfully sent to the store owner …" confirmation.
CON-F1FOn /contactusEnter name, invalid email, enquiry → SendInline email validation "Wrong email"; enquiry not sent.
CON-E1EOn /contactusEnter a very long (~3,300 char) enquiry body with valid name/email → SendLong body accepted; success confirmation shown (boundary input handled).

9. End-to-End Checkout: tests/e2e-checkout.spec.ts

Three complete purchase journeys (guest, logged-in user, and register-then-buy) plus negative/edge coverage of the checkout gate.

IDTypePreconditionStepsExpected Result
E2E-P1P (guest)Not logged inVisit store → search a product → scroll to it → open it → Add to cart → /cart → accept Terms → Checkout → Checkout as Guest → fill billing (US address) → accept default shipping/payment → Confirm order"Your order has been successfully processed!" confirmation.
E2E-P2P (logged-in user)A registered account existsLog in → add product to cart → /cart → accept Terms → Checkout (no guest step) → fill billing → confirm orderOrder placed; confirmation shown for the authenticated customer.
E2E-P3P (register → buy)New visitorRegister a new account (auto-login) → add product to cart → /cart → accept Terms → Checkout → fill billing → confirm orderOrder placed; confirmation shown end-to-end from sign-up to purchase.
E2E-F1FEmpty cartOpen /cart with nothing added → attempt to checkout"Your Shopping Cart is empty!" message; no checkout button available.
E2E-E1ECart has a productOpen /cart → click Checkout WITHOUT ticking Terms of ServiceA validation popup appears and the user stays on the cart page.

How it adds up

Eight core features at three scenarios each is 24, and the ninth (checkout) adds five more (three full journeys plus the empty-cart and terms-of-service cases), for 29 scenarios on paper.

A few of those are data-driven, so they run more than once: the registration profiles, the invalid-login sets, and the search keywords each loop over their data. Counted as executed tests, the 29 become 34.

Every one is a real test that runs on its own, gives a clear pass or fail, and leaves a screenshot, trace, and video behind when it fails.

Built with Playwright + TypeScript · Page Object Model