Skip to content

Conversation

oliveror
Copy link
Member

Changes

e2e/recipe-api.spec.ts (real PostgreSQL + API behind the built client) was one 90-second test, so a failure early in the journey hid everything after it. It is now:

Scenario Covers
publishes a recipe with an uploaded image that persists, then removes the image form, upload + crop, persistence after reload, image actually loads, Remove image
edits a recipe and keeps the change after reload edit flow
another user rates a recipe, changes the rating and removes it rating dialog, servings kept after rating, reload persistence
another user saves a recipe to My Cookbook and unsaves it there save, cookbook Saved view, unsave confirmation
a private recipe is hidden from other users, and a deleted recipe is gone visibility, delete confirmation
end-to-end journey: register, publish, find it in Explore, another user saves it real registration UI, publish, search, open, save, cookbook
  • Each scenario creates its own users and recipes, so they are independent of order and of each other.
  • Scenario users are created through the auth service with a real HttpOnly session cookie in a fresh browser context, because registration through the UI is rate limited (5 per minute per IP) and every test runs from 127.0.0.1. Their recipes are created through the repository. The journey still registers through the UI (two users).
  • Not added: Firefox/WebKit projects. The team review marked them lower priority, and they would roughly triple browser-test time on the single CI runner. Easy to add later in playwright.config.ts.

Validation

  • All 6 scenarios pass locally against PostgreSQL 16, also with --repeat-each=2 (12/12, ~11 s instead of one ~20 s test); full test:e2e and npm run check pass.

AI usage

Written with Claude Code (Anthropic) to address a teammate's review of the final-delivery findings. Please review the diff as you would any other contribution.

Closes #108

The real-API browser test was one 90-second journey, so an early failure
hid everything after it. It is now six independent scenarios (image
upload and removal, editing, rating, saving to the cookbook, privacy and
deletion) plus one short end-to-end journey through the real
registration and publishing UI. Scenario users are created through the
auth service with a real session cookie, because UI registration is rate
limited to 5 per minute per IP, and recipes through the repository.

Closes #108
@oliveror oliveror requested a review from a team as a code owner November 16, 2026 18:17
Copy link
Member

@olestan olestan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes:

The test split improves isolation, but a few regression checks from the original end-to-end test are lost or weakened:

  • Image preservation (recipe-api.spec.ts:227): The edit scenario uses a recipe without an image. Please verify that editing a recipe preserves its existing uploaded image after reload.
  • Rating-to-save flow (recipe-api.spec.ts:277): Splitting rating and saving into separate scenarios removes coverage of saving a recipe immediately after changing or removing a rating. Consider keeping this interaction in the rating scenario.
  • Explore search (recipe-api.spec.ts:374): The test may pass even if search doesn't work, because the newly created recipe is already visible in Explore. First search for an unrelated term and verify the recipe disappears, then search for its title and verify it appears again.

These are test coverage gaps rather than confirmed application bugs, but they're worth addressing to avoid losing regression protection.

- The edit scenario now edits a recipe that has an uploaded image and
  checks the same image is still shown, loaded, after reload.
- The rating scenario saves to My Cookbook straight after changing the
  rating, and unsaves/saves straight after removing it; after reload the
  recipe is saved and unrated.
- The journey first searches an unrelated term and waits for the empty
  result (so a loading state cannot pass the check), then finds the recipe
  by title. Verified that ignoring the search term on the server, or
  dropping the image on save, makes the scenarios fail.
@oliveror
Copy link
Member Author

Thanks, all three gaps restored in the latest commit:

  • Image preservation: the edit scenario now creates its recipe with a real uploaded image, stored through the image store just as the upload API stores it. The test checks that the image loads (naturalWidth > 0) and that the editor shows it. It then edits only the title, reloads, and checks that the same image src is still shown and loads.
  • Rating-to-save flow: the rating scenario now:
    • saves to My Cookbook straight after changing the rating from 5 to 3, and checks it shows both "Saved" and "Your rating: 3/5"
    • after removing the rating, unsaves and saves again straight away
    • after a reload, checks the recipe is still saved and has no rating
  • Explore search: the journey first checks that the new recipe is visible in Explore, then searches "unrelated porridge". It waits for the empty-result heading before checking that the recipe link is gone, because during loading the list is empty too and a missing link alone proves nothing. Only then does it search the title and open the recipe.

I checked that the new assertions can fail by temporarily breaking the app. Saving an edit without the image fails the edit scenario. Ignoring the search term on the server fails the journey; it passed before I added the wait for the empty result, which is why that wait is there.

All 6 recipe-api.spec.ts scenarios pass against a local PostgreSQL, and npm run check (213 unit tests) passes.

The recipe page now serves images with srcset width descriptors (#96), and
the browser scales naturalWidth by the chosen density, so the 1x1 test PNG
reported 0 although it loaded. The scenario now uploads a 600x400 PNG, and
calls upload() without the extension argument #96 removed.
Copy link
Member

@olestan olestan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three previously requested fixes are addressed.

One regression check from the original test is still missing: verifying that another user can save an edited recipe and see its updated title in My Cookbook. Please restore this assertion before merging.

Minor, non-blocking: Consider using expect.poll() to check naturalWidth > 0 in the image upload test. Currently, the assertion might run before the image finishes loading, causing occasional test failures even when the application works correctly.

Restores the original journey's check that another user can save an
edited recipe and sees its new title in My Cookbook, in the edit
scenario. The upload scenario now polls naturalWidth, as the image can
be visible before it has finished loading.

Refs #108
@oliveror
Copy link
Member Author

Thanks, both done in 95fc023:

  • Edited recipe saved by another user: the edit scenario now has a second user. After the owner's edit and reload, that user opens the recipe, saves it, and the Saved view of My Cookbook shows "Edited browser soup" and not the old title.
  • expect.poll() for naturalWidth: the upload scenario now polls until the image has loaded, like the edit scenario already did.

I also merged the latest dev into the branch. CI passes. This PR will be merged last of the current batch, after it is updated with the others, so its browser tests run on the final dev.

@oliveror oliveror merged commit e4089c6 into dev Nov 17, 2026
2 checks passed
@oliveror oliveror deleted the test/e2e-scenarios branch November 20, 2026 15:31
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants