Careeroza
Real World Example
The Checkout Journey Test
The single most valuable UI test in any e-commerce company (Flipkart, Amazon, Meesho) is the end-to-end purchase. This is the ShopEase version, using everything from this level: API setup, page objects, waits inside pages, soft assertions and a clear report.
public class CheckoutJourneyTest extends BaseTest {
private final ShopEaseApi api = new ShopEaseApi();
@Test(groups = {"smoke", "regression", "payments"}, description = "Search to order confirmation with COD")
public void customerCanBuyHeadphonesWithCod() {
TestUser user = api.createUserWithAddress(TestData.uniqueEmail("journey"), "Secret@123", "560001");
SoftAssert soft = new SoftAssert();
ProductPage product = new LoginPage(driver).open()
.loginAs(user.email(), user.password())
.header.searchFor("boat rockerz 450")
.openResult(0);
soft.assertEquals(product.price(), "₹1,499", "listing price");
CheckoutPage checkout = product.addToCart().openCart().proceedToCheckout();
soft.assertEquals(checkout.deliveryPincode(), "560001", "default address");
OrderConfirmationPage confirmation = checkout.payWithCod();
soft.assertTrue(confirmation.orderId().matches("ORD-\\d{6}"), "order id format");
soft.assertEquals(confirmation.header.cartCount(), "0", "cart empty after order");
Assert.assertEquals(api.orderStatus(confirmation.orderId()), "PLACED"); // backend agrees
soft.assertAll();
}
}Example
mvn test -Dtest=CheckoutJourneyTest -Denv=stagingExample output
11:48:02.331 INFO [main] ShopEaseApi - POST /api/users -> 201 (188 ms) 11:48:03.902 INFO [main] LoginPage - Logging in as [email protected] 11:48:05.417 INFO [main] SearchPage - Searching for 'boat rockerz 450' 11:48:08.096 INFO [main] CartPage - Cart has 1 item(s), clicking checkout 11:48:10.774 INFO [main] CheckoutPage - Placing COD order 11:48:12.205 INFO [main] ShopEaseApi - GET /api/orders/ORD-100517 -> PLACED [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.92 s [INFO] BUILD SUCCESS
Where to Go Next
- Practise explaining this framework aloud: interviewers ask "walk me through your framework" in almost every SDET round.
- Add one feature yourself: wishlist page object and two tests, run them in parallel on the Docker Grid.
- Continue with the Selenium interview questions to prepare for QA automation rounds.