Skip to content

[HOTE-812] feat: Automated tests fixes#294

Merged
przemyslawbiesek merged 10 commits intomainfrom
feature/hote-812/automatedTestsFixes
Mar 31, 2026
Merged

[HOTE-812] feat: Automated tests fixes#294
przemyslawbiesek merged 10 commits intomainfrom
feature/hote-812/automatedTestsFixes

Conversation

@przemyslawbiesek
Copy link
Copy Markdown
Contributor

Description

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

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.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

- 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
Copilot AI review requested due to automatic review settings March 30, 2026 10:07
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 30, 2026

Lambdas Coverage Report

Lines Statements Branches Functions
Coverage: 97%
97.79% (1239/1267) 91.35% (370/405) 95.04% (192/202)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 30, 2026

UI Coverage Report

Lines Statements Branches Functions
Coverage: 95%
95.5% (5583/5846) 87.28% (652/747) 87.5% (203/232)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 WireMockUserManager to mitigate redirect-related flakiness.
  • Updated the test DB client base to use a pg connection 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");
    },

Comment thread tests/db/BaseDbClient.ts
Comment thread tests/tests/integration/UpdateResultStatus.spec.ts
Comment thread tests/tests/integration/UpdateResultStatus.spec.ts
Comment thread tests/tests/api/OrderStatusEndpointTest.spec.ts
Comment thread tests/tests/api/FullOrderEndpointTest.spec.ts
Comment thread tests/fixtures/consoleErrorFixture.ts
Comment thread tests/fixtures/consoleErrorFixture.ts Outdated
Comment thread tests/tests/api/ResultsEndpointTest.spec.ts
Comment thread tests/tests/api/ResultsEndpointTest.spec.ts
Comment thread tests/tests/api/FullOrderEndpointTest.spec.ts Outdated
Comment thread tests/fixtures/consoleErrorFixture.ts Outdated
Comment thread tests/fixtures/DbFixture.ts Outdated
Copilot AI review requested due to automatic review settings March 31, 2026 07:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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).

Comment thread tests/db/BaseDbClient.ts
Comment thread tests/utils/users/WireMockUserManager.ts
Comment thread tests/page-objects/HowComfortablePrickingFingerPage.ts
Comment thread lambdas/src/eligibility-lookup-lambda/init.test.ts Outdated
…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
Copilot AI review requested due to automatic review settings March 31, 2026 09:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 7 comments.

Comment thread tests/tests/integration/UpdateResultStatus.spec.ts
Comment thread tests/tests/api/ResultsEndpointTest.spec.ts
Comment thread tests/tests/api/ResultsEndpointTest.spec.ts
Comment thread tests/tests/api/FullOrderEndpointTest.spec.ts Outdated
Comment thread tests/fixtures/consoleErrorFixture.ts
Comment thread scripts/tests/reset-login-lambda-cache.sh Outdated
Comment thread tests/utils/users/WireMockUserManager.ts
Comment thread tests/fixtures/DbFixture.ts
@sonarqubecloud
Copy link
Copy Markdown

@przemyslawbiesek przemyslawbiesek merged commit bd46257 into main Mar 31, 2026
11 checks passed
@przemyslawbiesek przemyslawbiesek deleted the feature/hote-812/automatedTestsFixes branch March 31, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants