[HOTE-812] feat: Automated tests fixes#294
Merged
przemyslawbiesek merged 10 commits intomainfrom Mar 31, 2026
Merged
Conversation
- Removed direct instantiation of TestOrderDbClient and TestResultDbClient in multiple test files. - Updated tests to utilize testOrderDb and testResultDb from CombinedTestFixture for creating, updating, and deleting orders and results. - Commented out error assertion in consoleErrorFixture. - Adjusted database connection and disconnection logic in various tests to streamline setup and teardown processes.
…ions refactor: improve Firefox login handling with stable URL checks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR focuses on stabilising and simplifying the Playwright automated test suite by centralising DB access into fixtures and addressing browser-specific auth timing issues.
Changes:
- Added worker-scoped DB fixtures (
testOrderDb,testResultDb) and refactored multiple specs to use them instead of manual DB client lifecycle management. - Improved Firefox login flow handling in
WireMockUserManagerto mitigate redirect-related flakiness. - Updated the test DB client base to use a
pgconnection pool, plus several small test/page-object/config cleanups.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/users/WireMockUserManager.ts | Adds Firefox-specific waiting logic to stabilise OAuth redirect completion. |
| tests/tests/ui/SuppliersTermsOfUseTest.spec.ts | Refactors DB usage to testOrderDb fixture. |
| tests/tests/ui/SuppliersPrivacyPolicyTest.spec.ts | Refactors DB usage to testOrderDb fixture. |
| tests/tests/ui/ResultsTestJourneyTest.spec.ts | Refactors DB usage to testOrderDb/testResultDb fixtures and removes manual DB clients. |
| tests/tests/ui/OrderStatusJourneyTest.spec.ts | Refactors DB usage to testOrderDb fixture. |
| tests/tests/integration/UpdateResultStatus.spec.ts | Refactors DB usage to fixtures; updates imports and setup/teardown. |
| tests/tests/e2e/fullUserJourney.spec.ts | Refactors DB usage to fixtures and increases polling timeout. |
| tests/tests/api/ResultsEndpointTest.spec.ts | Refactors DB usage to fixtures; updates setup/teardown and assertions. |
| tests/tests/api/OrderStatusEndpointTest.spec.ts | Refactors DB usage to fixtures. |
| tests/tests/api/FullOrderEndpointTest.spec.ts | Refactors result DB polling helper to accept fixture and refactors DB usage to fixtures. |
| tests/tests/accessibility/OrderSubmittedTest.spec.ts | Updates cleanup to use testOrderDb fixture. |
| tests/tests/accessibility/OrderStatusTest.spec.ts | Refactors DB usage to testOrderDb fixture. |
| tests/tests/accessibility/NegativeResultsTest.spec.ts | Refactors DB usage to testOrderDb/testResultDb fixtures. |
| tests/playwright.config.ts | Removes commented-out webServer block. |
| tests/page-objects/HowComfortablePrickingFingerPage.ts | Formatting + changes radio selection from check() to click(). |
| tests/fixtures/consoleErrorFixture.ts | Adjusts imports and changes post-test error handling behaviour. |
| tests/fixtures/DbFixture.ts | Introduces worker-scoped DB fixtures for order/result DB clients. |
| tests/fixtures/CombinedTestFixture.ts | Merges in dbFixture so DB fixtures are available in UI tests. |
| tests/db/BaseDbClient.ts | Migrates from pg Client to pg Pool for DB access. |
Comments suppressed due to low confidence (1)
tests/tests/api/ResultsEndpointTest.spec.ts:49
- Logging the full result API response body risks emitting sensitive clinical/result data into CI logs. Please remove this
console.log(and similar status confirmation logs) or replace with a minimal, non-sensitive assertion-focused message.
const responseBody = await response.json();
console.log("The response received: " + JSON.stringify(responseBody, null, 2));
const resultStatus = responseBody.interpretation[0].coding[0].display;
expect(resultStatus).toBe("Normal");
console.log("Confirmed status: Normal");
},
…dler' into feature/hote-812/automatedTestsFixes
krssw
reviewed
Mar 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
tests/tests/api/ResultsEndpointTest.spec.ts:48
- Logging the full API response body here can include sensitive health data (e.g. result interpretation) and will leak into CI logs.
Remove this log or replace it with minimal, non-sensitive diagnostics (e.g. status code / correlationId only).
lewisbirks
reviewed
Mar 31, 2026
…matedTestsFixes # Conflicts: # lambdas/src/eligibility-lookup-lambda/init.test.ts # lambdas/src/get-order-lambda/init.test.ts # lambdas/src/get-results-lambda/init.test.ts # lambdas/src/login-lambda/init.test.ts # lambdas/src/login-lambda/init.ts # lambdas/src/order-result-lambda/init.test.ts # lambdas/src/order-router-lambda/init.test.ts # lambdas/src/order-service-lambda/init.test.ts # lambdas/src/order-status-lambda/init.test.ts # lambdas/src/postcode-lookup-lambda/init.ts # lambdas/src/session-lambda/init.ts
lewisbirks
reviewed
Mar 31, 2026
|
krssw
approved these changes
Mar 31, 2026
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.



Description
Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.