A hybrid scenario
Seed state through the API and verify it in the browser within one scenario.
Why SDODS uses one merged fixture set, how a scenario chains API responses into UI steps, and how a leased user starts the browser already logged in.
Why one fixture set matters
Frameworks that keep separate test objects for UI and API cannot mix them in one scenario. SDODS has a single test with API, page, data, user, screenshot and heal fixtures, so a scenario can prepare state over HTTP and assert in the browser without glue code.
The feature
projects/demo-shop/features/hybrid/seed-then-verify.feature:
@hybrid @regression
Feature: Seed a post and see it in the UI
Scenario: API seeds, UI verifies
Given I use a leased user with role "standard"
When I seed via POST "/posts" with body:
"""json
{ "title": "SDODS {{username}}", "userId": 1 }
"""
And I save the response JSON path "title" as "title"
And I mock "**/inventory.html" with HTML:
"""
<main><h1>{{title}}</h1><p>rendered from the seeded API response</p></main>
"""
And I navigate to the "inventory" page
Then the UI should show the text from JSON path "title"What happens:
I use a leased usertakes an account of rolestandardfrom the pool for this worker and applies its cached storage state to the browser context.I seed via POSTuses the API client bound toenvs/staging.yaml.- Variables captured from the response flow into later steps through
{{title}}. - The mock step answers the UI request with the seeded value so the demo works against a public sandbox; against your own application you would skip the mock and assert on real data.
Run it here — watch the title the API returns arrive in the browser panel, and note that the browser starts on the products page because the leased user brought its own storage state:
A merchandiser renames a listing and the storefront keeps showing the old title for an hour. Nadia wants a scenario that creates a listing over HTTP and then proves the page renders that exact title — no clicking through a form to get there.
Done means
- The scenario starts already signed in, using an account leased from the pool.
- The listing is created over HTTP, in one step, not through the UI.
- The page is asserted against the value the API returned, not a hard-coded string.
@hybrid@regression· lint clean · 7 steps
Swag Labs
LoginAccepted usernames: standard_user, problem_user, performance_glitch_user, locked_out_user. Password: secret_sauce.
- not run: Given I use a leased user with role "standard"
- not run: When I seed via POST "/posts" with body:
- not run: Then the response status should be 201
- not run: When I save the response JSON path "title" as "title"
- not run: And I mock "**/inventory.html" with HTML:
- not run: And I navigate to the "inventory" page
- not run: Then the UI should show the text from JSON path "title"
Run the same scenario on your machine:
sdods run -p demo-shop -e staging -l hybrid -b chromium
Run it
bun run sdods run -p demo-shop -e staging -l hybrid -b chromiumHybrid scenarios take screenshots for UI steps and attach request and response JSON for API steps, so the run viewer shows the whole story.