Skip to content

CCM-16489: Add letter authoring e2e tests#930

Open
andykay-nhs wants to merge 10 commits intomainfrom
feature/CCM-16489
Open

CCM-16489: Add letter authoring e2e tests#930
andykay-nhs wants to merge 10 commits intomainfrom
feature/CCM-16489

Conversation

@andykay-nhs
Copy link
Copy Markdown
Contributor

@andykay-nhs andykay-nhs commented Apr 30, 2026

Description

for each letter type

  • create a new template of the letter type
  • upload standard docx. (Im unsure if the template type matters here? the rendered output isn't checked. I did create a spanish translated copy of the standard template but if we're not actually validating the final rendered content then I'm not sure this matters and just the standard one works?)
  • validates persisted template data is expected by querying dynamo via templateStorageHelper. (Saw this in the existing pdf-letter e2e tests)
  • edit template name
  • edit template campaign
  • set printing and postage. (Do we need further e2e tests for different printing and postage types? or is setting the same one okay for this?)
  • fill out short and long form preview inputs and update preview
  • approve
  • confirm approved status of template in template list view
  • validate approved template cannot be edited

One test covers off invalid template scenario (missing address).

Added arabic and large print letters.

Tests succeeding locally:
image

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.

Description

Raising draft to check CI pipeline status

for each letter type

  • create a new template of the letter type
  • upload standard docx. (Im unsure if the template type matters here? the rendered output isn't checked. I did create a spanish translated copy of the standard template but if we're not actually validating the final rendered content then I'm not sure this matters and just the standard one works?)
  • validates persisted template data is expected by querying dynamo via templateStorageHelper. (Saw this in the existing pdf-letter e2e tests)
  • set printing and postage. (Do we need further e2e tests for different printing and postage types? or is setting the same one okay for this?)
  • fill out short and long form preview inputs and update preview
  • approve
  • confirm approved status of template in template list view

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.

@andykay-nhs andykay-nhs force-pushed the feature/CCM-16489 branch 3 times, most recently from bcfb235 to 5de6a57 Compare May 1, 2026 09:26
@andykay-nhs andykay-nhs force-pushed the feature/CCM-16489 branch from 5cb1262 to 5a8a9d4 Compare May 1, 2026 13:34
@andykay-nhs andykay-nhs force-pushed the feature/CCM-16489 branch from 5a8a9d4 to aa1ec8e Compare May 1, 2026 13:35
@andykay-nhs andykay-nhs marked this pull request as ready for review May 1, 2026 13:36
@andykay-nhs andykay-nhs requested a review from a team as a code owner May 1, 2026 13:36
Comment thread tests/test-team/pages/letter/template-mgmt-upload-letter-base-page.ts Outdated
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated

const compareSrc = (a: string | null, b: string | null) => {
if (!a || !b) {
throw new Error('123');
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.

Needs a message

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

just spotted this as well, so silly 🤦 woops!

expect(path.basename(a)).not.toEqual(path.basename(b));
};

let updatedShortRenderSrc: string;
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.

you can return values from test.step, rather than mutating these, if you prefer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes! totally forgot about that. Already did this with the template key last week but can also be done here

return;
}

await this.languageInput.selectOption(input.language);
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.

could this whole implementation go in TemplateMgmtUploadLetterBasePage? only difference is that the other ones don't have the language check, but this version handles the language being absent just fine

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i think so, I will try and dedupe it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah wait, now I remember why i hesitated to do this. It would mean moving all of the references to the elements up into the base page class. When you do that you pretty much remove the need for template-mgmt-upload-standard-english-letter-template-page.ts, template-mgmt-upload-large-print-letter-template-page.ts and template-mgmt-upload-bsl-letter-template-page.ts which would then mean going and changing all those references and then the PR becomes a lot bigger. Happy to go through and do this but felt like light touch was simpler despite some duplication of code

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.

i don't think you'd need to change all the references in the tests, if you move everything shared up into the base class then won't the individual pages inherit them?

i'm not sure there's any reason to have a shared base class if you're not going to put all the shared attributes in it. the individual pages still have different URLs so you'd still have the individual classes.

not a big deal so happy to approve regardless but i don't see how moving all the shared attributes up would have any effect outside of these page classes

Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated
Comment thread tests/test-team/template-mgmt-e2e-tests/letter.e2e.spec.ts Outdated
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.

3 participants