Skip to content

CCM-18631: stabilise component tests#602

Merged
francisco-videira-nhs merged 6 commits into
mainfrom
feature/CCM-18631
Jun 1, 2026
Merged

CCM-18631: stabilise component tests#602
francisco-videira-nhs merged 6 commits into
mainfrom
feature/CCM-18631

Conversation

@francisco-videira-nhs

@francisco-videira-nhs francisco-videira-nhs commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Description

Removes global setup letter creation.

Uses the letterIds sent by the utility.

Each test creates its own letters.

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

DT3-Specific Checklist

  • If I have added a new resource (SQS, Lambda, Gateway, DDB table, etc), I have created the appropriate alarms

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.

Copilot AI left a comment

Copy link
Copy Markdown

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 aims to stabilise the Playwright component tests by making test data creation deterministic (returning created letter IDs) and waiting for expected DynamoDB state before exercising API operations, reducing reliance on pre-seeded/global test data.

Changes:

  • Update the test-data CLI helper to capture and return created letter IDs from command output.
  • Refactor component tests to create their own letters and wait for the expected status instead of querying “any pending letters”.
  • Adjust queue visibility timestamp assertions and update internal-dev mTLS secret configuration.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/helpers/pnpm-helpers.ts Capture CLI stdout and return created LETTER_IDS to callers.
tests/helpers/generate-fetch-test-data.ts Make createTestData return IDs; expand DynamoDB projection for waitForLetterStatus.
tests/config/global-setup.ts Remove global creation of test letters during setup.
tests/component-tests/letterQueue-tests/queue-operations.spec.ts Make visibility timeout assertion less timing-sensitive.
tests/component-tests/apiGateway-tests/update-multiple-letter-status.spec.ts Use created IDs + waitForLetterStatus instead of querying by supplier.
tests/component-tests/apiGateway-tests/update-letter-status.spec.ts Create and wait for letters per-test instead of shared beforeAll query.
tests/component-tests/apiGateway-tests/get-letter-status.spec.ts Create a letter and wait for status before GET-by-id assertions.
tests/component-tests/apiGateway-tests/get-letter-pdf.spec.ts Switch to deterministic creation/wait flow; remove a brittle 404 test.
specification/api/components/environments/internal-dev/target.yml Update internal-dev mTLS secret name.

Comment thread tests/helpers/pnpm-helpers.ts
Comment thread tests/helpers/generate-fetch-test-data.ts
Comment thread tests/component-tests/apiGateway-tests/get-letter-pdf.spec.ts
Namitha-Prabhu
Namitha-Prabhu previously approved these changes Jun 1, 2026
@francisco-videira-nhs francisco-videira-nhs merged commit fc6ef15 into main Jun 1, 2026
40 checks passed
@francisco-videira-nhs francisco-videira-nhs deleted the feature/CCM-18631 branch June 1, 2026 11:19

logger.info(
`Supplier ${supplierId} allocated for domainId ${domainId} in supplier allocator lambda`,
`Supplier ${supplierId} allocated to letter ${domainId} in supplier allocator lambda`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we call it letter, but the variable is called domainId?

supplierAllocatorLog.msg?.allocationDetails?.supplierSpec?.supplierId;

logger.info(
`Supplier ${supplierId} allocated for domainId ${domainId} in supplier allocator lambda`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same as above comment

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