π₯ Playwright: test.only, Hooks & Grouping with test.describe Explained
Let’s go step-by-step, showing how to build from a single test, to using beforeEach/afterEach, and then organizing things with test.describe.
✅ Step 1: Basic Single Test with test.only
test.onlyensures only this test runs — great for debugging.
✅ Step 2: Add beforeEach and afterEach
✅ Step 3: Use test.describe to Group Tests
Now both tests are grouped logically under one label.
✅ Step 4: test.describe with beforeEach and afterEach
✅ Summary Chart:
| Step | What’s Shown | Key Feature |
|---|---|---|
| 1 | test.only() | Run single test |
| 2 | beforeEach & afterEach globally | Setup/teardown |
| 3 | test.describe() | Group related tests |
| 4 | describe + beforeEach + afterEach | Reusable logic within group |
Comments
Post a Comment