test.describe() groups related tests under one name. The tests inside it still run as separate cases in this lesson. A failure in one does not cancel the others. The group name shows up in the report.
test.beforeEach() runs before every test in the group. test.afterEach() runs after every test, including a test that failed. Use beforeEach for a shared starting point, such as opening a page. Use afterEach for cleanup that must happen even when an assertion fails.
A test should not need another test to have run first. Playwright can run tests at the same time and can retry one test alone. If the second test needs a note that only the first test types, the file breaks as soon as the order changes.
Opening a shop repeats the same first step: unlock the door. You would not write that step only on the first task and assume every later task finds the door open. beforeEach is that repeated first step. Each scenario still has its own expected result.
Order dependence feels convenient and then breaks. Someone runs one test from the file, and the next test looks for data the first test never created. The failure looks like a product bug. It is a test design bug. Shared setup belongs in a hook or inside the test that needs it.
A passing run shows the heading "Orders desk" in one test and the note "Call the customer" in the other. Each test opens the desk through beforeEach. A failing run means the heading was missing or the field value differed. Either test can run alone.
๐ง๐ฎ๐ธ๐ฒ๐ฎ๐๐ฎ๐๐
test.describe() groups scenarios. It does not merge them into one long test.
beforeEach builds the shared start. afterEach cleans up, including after a failure.
Do not make one test's result depend on another test's actions.
Each test gets its own page. Shared application data still needs cleanup.
๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐พ๐๐ฒ๐๐๐ถ๐ผ๐ป: Why is it risky to chain tests so that one prepares the next?
๐๐ป๐๐๐ฒ๐ฟ: Playwright can run or retry a single test. The later test then fails because its setup never ran. Put shared setup in a hook or in the test that needs it.
Our little shelf test for KรรK. We gave each recipe its own colour and vegetable drawing, then kept the lettering and layout in the same place on every can.
What happens to a startup launch once the original post gets buried?
I founded StartupAccelerator.dev to give independent founders a page they can keep sharing after launch day. Founders submit their projects for human review. Once approved, each project gets a public profile where early adopters can discover it, watch a demo, and vote for it. Selected launches can also be featured on the homepage or in the weekly newsletter.
As of November 29, the platform had 453 approved projects and 1,049 community votes.
In the case study, I walk through how we connected the submission form, searchable directory, and community launch board. Youโll see the live product on desktop, laptop, tablet, and mobile.