Skip to content

pdf updates#770

Merged
RyonLeightonDEFRA merged 2 commits intoFCRM-6803-AddP1TestsToResultsAndNextStepsfrom
P1Changes
Apr 28, 2026
Merged

pdf updates#770
RyonLeightonDEFRA merged 2 commits intoFCRM-6803-AddP1TestsToResultsAndNextStepsfrom
P1Changes

Conversation

@RyonLeightonDEFRA
Copy link
Copy Markdown
Contributor

Suggested simplifications to PDF test implementation
Summary
Reviewed the P1 PDF test code and made some simplifications and improvements to the PdfDriver, test structure, and page object usage. These are suggestions to discuss, happy to adjust based on your thoughts.

Changes
PdfDriver simplified

Replaced the dual-strategy download (Promise.any racing a download event against response interception) with Playwright's standard awaitDownload() pattern, the server returns content-disposition: attachment so the download event is sufficient
Removed clearPdfFiles() / listPdfFiles(). Server filenames include timestamps so collisions aren't an issue, and the folder is gitignored
Merged expectRequiredLinks + expectAllLinksAreValid into a single expectLinks method
Added expectPdfContent() that wraps all four assertion methods into one call
Dropped async from assertion methods that had no awaits
Removed normalizedLinks from the parsePdf return, normalization happens inline in expectLinks
Tests consolidated

Removed PDF tests from next-steps spec
Reduced from 6 tests (2 per zone) to 4 (1 per zone + 1 for the unspecified reference case) — the "without reference" tests were duplicating all assertions except checking "unspecified"
Flattened the nested describe/beforeEach structure into a single loop with inline setup

Co-authored-by: Copilot <copilot@github.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

Test Results

68 tests  ±0   68 ✅ ±0   56s ⏱️ -1s
14 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 09fb3ae. ± Comparison against base commit 4a2a5b9.

♻️ This comment has been updated with latest results.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Collaborator

@garydawsonDEFRA garydawsonDEFRA left a comment

Choose a reason for hiding this comment

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

Approved

@RyonLeightonDEFRA RyonLeightonDEFRA merged commit fc3b38a into FCRM-6803-AddP1TestsToResultsAndNextSteps Apr 28, 2026
3 checks passed
garydawsonDEFRA added a commit that referenced this pull request Apr 28, 2026
* Removed Confirmation page test from Check your details spec file

* added projects and tags to separate e2e test

* Updated framework to handle P1 PDF validation and updates Results page tests

* Added P1 PDF tests to Next Steps spec file, updated pdf driver to handle potentially conflicting pdf jobs between spec files

* Sonar Qube fixes

* Further Sonar Qube fixes

* pdf updates (#770)

* pdf updates

Co-authored-by: Copilot <copilot@github.com>

* removed test.describe.only from results spec file

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Gary Dawson <gary.dawson@defra.gov.uk>

---------

Co-authored-by: RyonLeightonDEFRA <ryon.leighton@defra.gov.uk>
Co-authored-by: Copilot <copilot@github.com>
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.

2 participants