Add Playwright end-to-end tests - #93
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- e2e/ Playwright project (API + browser tests, webServer starts docker compose) - GitHub Actions workflow running the suite against docker compose - Fix Shared project reference paths so the services build in Docker - Customer/Product: minimal EF Core CRUD replacing the scaffold stubs - Notification: format currency with en-US so containers render $ not ¤ - docker-compose: wait for Postgres health, configurable host port
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Playwright suite under
e2e/(26 tests,@playwright/test1.63.0) that runs against the fullsrc/docker-compose.ymlstack, plus a GitHub Actions workflow that runs it on every PR and push tomain. Getting the stack to a state where these tests could run required a few small repo fixes, listed below.What is tested (
e2e/tests/*.spec.ts)health.spec.ts—/healthzreturns200 Healthyon the gateway and all five services.swagger.spec.ts— Swagger UI loads in Chromium for Notification and Customer (title, operations visible);swagger/v1/swagger.jsonis a valid OpenAPI 3 doc for every service.gateway.spec.ts— every routed list endpoint returns 200 JSON through YARP; unknown path is 404.customers.spec.ts/products.spec.ts— create → get → list → update → delete round-trip through the gateway, then 404 on re-read/re-delete; 404 for unknown id; 400 for a malformed body.notification.spec.ts—POST .../events/order-placed→ 201 with{id, previewUrl};GET /{id}returns the stored event data andrenderedSubject: 'Order Confirmed — $149.99';/previewopened in the browser renders the order summary card with the customer name, order number, and total as$1,234.56; edge cases$0.05,$1.00,$10,000.00; 404 for unknown id/preview.Note on gateway paths: YARP only strips the
/api/<plural>prefix, so the downstream controller route must be repeated, e.g.GET /api/customers/api/customer.e2e/helpers/urls.tscentralises this. I left the gateway config unchanged.Note on amounts:
NotificationRenderer.FormatCurrencydocumentsTotalAmountas cents and divides by 100, so the tests send cents (14999→$149.99).How to run
BASE_URL(orPLAYWRIGHT_BASE_URL) overrides the gateway URL;SERVICES_HOST/<SERVICE>_URLoverride direct service URLs;SKIP_WEBSERVER=1skips compose (CI uses this);POSTGRES_HOST_PORTchanges the published Postgres port. Details ine2e/README.md.Local run:
SKIP_WEBSERVER=1 npx playwright test→ 26 passed, 0 failed, 0 skipped. Also verified from a torn-down stack vianpm run test:e2e(webServer path) → 26 passed.Repo fixes needed to run the stack
*.API.csprojreferenced..\..\Shared\...; the correct path is..\..\..\Shared\.... Docker builds failed onmainwithout this. (global.jsonleft as-is; it works with thesdk:10.0image and SDK 10.0.4xx.)DbContext.Database.EnsureCreated()on startup, same as Notification.API.ToString("C2")rendered¤149.99.FormatCurrencynow usesCultureInfo.GetCultureInfo("en-US").depends_on: postgres: condition: service_healthy(with apg_isreadyhealthcheck) andrestart: on-failure. PreviouslyEnsureCreated()raced Postgres startup and Customer/Product/Notification crashed on first boot. Postgres host port is${POSTGRES_HOST_PORT:-5432}. Removed the obsoleteversion:key.CI
.github/workflows/playwright.yml: setup-node 22 →npm ci→playwright install --with-deps chromium→node scripts/start-stack.mjs(compose up + health wait) →npm run test:e2e→ uploadplaywright-report(always) → dump compose logs on failure →docker compose down -v(always).No tests are skipped.
Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/62d614c5bc714cae9d77a348597e66c5
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/62d614c5bc714cae9d77a348597e66c5?variant=devin
Requested by: @mbatchelor81