alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.16k stars 320 forks source link

Investigate consolidating all test examples in the same place #4438

Open romaricpascal opened 10 months ago

romaricpascal commented 10 months ago

What

Investigate how we could regroup all examples used for testing our components in the same place (likely the govuk-frontend package): both those from the YAML files used for individual components (for ex. those of the accordion) and those for "Other examples" pages.

Why

Reducing our test depending on the review app highlighted that some of these tests were depending on the "Other examples" page in the review app. These are pages rendering multiple instances of components (could be the same component or different ones, depending on the page).

This means what we use a reference for testing our components is split into two places:

Regrouping these may help maintainability by reducing the number of places to look at when finding out how components are tested.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

colinrotherham commented 10 months ago

Some ideas so far for spikes and alternatives:

  1. Spike "scoped examples" in Puppeteer (e.g. To replace Example: Exit this page with skiplink)
  2. Spike "multiple component examples" in Puppeteer(e.g. To replace Example: Scoped initialisation)
  3. Update the Skip link tests to avoid Example: Template default
  4. Move the Example: Conditional reveals Radios and Checkboxes demo into YAML
  5. Move the Example: Translated Accordion demo into YAML

All of these together would resolve all remaining goToExample() tests in https://github.com/alphagov/govuk-frontend/pull/4359#issuecomment-1772741697