Compose flows by reusing grouped steps and actions
Segments work just like reusable functions in a normal Playwright structure. They allow you to save a common portion of a test (like a “Login” or “Add to Cart” flow) and then reuse that set of steps in any other test.
Let’s say you have a test called “Login Test” and you want to use those same login steps at the beginning of all your other tests.
Navigate to the Segments tab in the main navigation.
Click the “Add Segment” button.
A pop-up will appear. First, give your new segment a clear name (e.g., “Login Flow”).
Next, select the test you want to build from (e.g., “Login Test”) from the dropdown.
Finally, choose the Start Step and the End Step. This tells the system that all steps between (and including) these two points will be saved as your reusable segment.