1. What is a UI Test?
A UI test checks that your application behaves as expected when users interact with it (e.g., clicking buttons, filling forms).2. What’s an Assert and Why It Matters
An assert is a checkpoint in your test. It confirms that something is correct—like verifying a confirmation message appears after clicking “Submit”. Think of it as asking: “Did this work as expected?”Example, after logging in: Assert that you see “Welcome, Joseph!“
3. Best Practices for UI Testing
- ✅ Start with key user flows (e.g., login, checkout).
- ✅ Place asserts after important actions (e.g., after submitting a form).
- ✅ Check visible outcomes, like messages, buttons, or page changes.
- ✅ Build one test per key user flow to ease up debugging
- ⚠️ Avoid overloading with unnecessary asserts — focus on what really matters for the user experience.
4. Your First Test in 3 Steps
- Define the goal: “Test that users can send a contact form.”
- Record or describe the steps: Click “Contact”, fill out fields step by step, click “Send”.
- Add asserts: Confirm “Message sent!” appears.
Example: Creating a Test for an Ecommerce
- Goal: Validate that users can add items into their carts.
- Steps: Click on “Shop Now”, click “Add to Cart” for an item and navigate to your cart.
- Asserts: Validate that there is an item in the cart.
