Skip to content

WS-2092: Migrate cypress tests for OnDemandAudio pages to NextJS#13688

Merged
Isabella-Mitchell merged 8 commits intolatestfrom
WS-2092-migrate-audio-cypress-tests
Feb 11, 2026
Merged

WS-2092: Migrate cypress tests for OnDemandAudio pages to NextJS#13688
Isabella-Mitchell merged 8 commits intolatestfrom
WS-2092-migrate-audio-cypress-tests

Conversation

@Isabella-Mitchell
Copy link
Copy Markdown
Contributor

@Isabella-Mitchell Isabella-Mitchell commented Feb 6, 2026

Resolves JIRA: https://bbc.atlassian.net/browse/WS-2092

Summary

Migrate cypress tests for OnDemandAudio pages to NextJS

Code changes

Testing

Run locally
Also check on Test, Live and non-smoke tests, using flags like CYPRESS_APP_ENV=test or live and CYPRESS_SMOKE=false

Useful Links

@Isabella-Mitchell Isabella-Mitchell changed the title WS-2092: Uncomments out e2e tests. Removes falsy checks WS-2092: Migrate cypress tests for OnDemandAudio pages to NextJS Feb 6, 2026
cy.log(
`On Demand Radio Page configured for Radio Schedule? ${scheduleIsEnabled}`,
);
cy.fixture(`toggles/${service}.json`).then(toggles => {
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.

Refactors this test so that it won't fail on live and test before the ALB changes are live.

The issue is that the getPageDataFromWindow() function relies on the Next object. This will always return false before the ALB changes are live. So the check on line 92 cy.get('[data-e2e=radio-schedule]').should('not.exist'); was being run against live and test pages which did have the radio schedule.

This refactor means that the the cy.get('[data-e2e=radio-schedule]').should('not.exist'); is only run on assets were the toggle is false. If the pageData object is false, there are no assertions.

@Isabella-Mitchell Isabella-Mitchell marked this pull request as ready for review February 10, 2026 10:06
Copilot AI review requested due to automatic review settings February 10, 2026 10:06
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

Migrates Cypress E2E coverage for OnDemandAudio pages into the Next.js app, converting the main spec to TypeScript and removing the legacy Express-app equivalents.

Changes:

  • Moved OnDemandAudio Cypress specs into ws-nextjs-app and converted the main entry spec to .ts
  • Removed the old .js Cypress spec files from the prior locations
  • Updated page type usage to align with Next.js route/page type constants

Reviewed changes

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

File Description
ws-nextjs-app/cypress/e2e/onDemandAudio/tests.ts Updates OnDemandAudio test logic around radio schedule toggle/data handling
ws-nextjs-app/cypress/e2e/onDemandAudio/index.cy.ts Converts the spec to TS, updates imports, and introduces typing for test suites
ws-nextjs-app/cypress/e2e/onDemandAudio/index.cy.js Removes legacy JS spec in favor of TS version
cypress/e2e/pages/onDemandAudio/tests.js Removes legacy Express-app OnDemandAudio tests

Comment thread ws-nextjs-app/cypress/e2e/onDemandAudio/tests.ts
Comment thread ws-nextjs-app/cypress/e2e/onDemandAudio/index.cy.ts
Comment thread ws-nextjs-app/cypress/e2e/onDemandAudio/index.cy.ts
Copy link
Copy Markdown
Contributor

@pvaliani pvaliani left a comment

Choose a reason for hiding this comment

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

Looks good, maybe worth [DNM]-ing in the PR title in case it's not spotted from the description

edit: just saw you added the label so ignore my comment

Comment thread ws-nextjs-app/cypress/e2e/onDemandAudio/tests.ts
Copilot AI review requested due to automatic review settings February 11, 2026 12:25
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 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines 84 to 87
if (scheduleIsEnabled && radioScheduleData) {
cy.log('Schedule has enough data');
cy.get('[data-e2e=radio-schedule]').should('exist');
// cy.get('[data-e2e=live]').should('exist');
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

When the schedule toggle is enabled but radioScheduleData is missing/insufficient, the test currently makes no assertion (it will pass regardless). Re-introduce the negative assertion (and/or an explicit log) for the !radioScheduleData case so the test reliably validates expected behavior.

Suggested change
if (scheduleIsEnabled && radioScheduleData) {
cy.log('Schedule has enough data');
cy.get('[data-e2e=radio-schedule]').should('exist');
// cy.get('[data-e2e=live]').should('exist');
if (radioScheduleData) {
cy.log('Schedule has enough data');
cy.get('[data-e2e=radio-schedule]').should('exist');
// cy.get('[data-e2e=live]').should('exist');
} else {
cy.log(
'Schedule toggle is on but schedule data is missing or insufficient',
);
cy.get('[data-e2e=radio-schedule]').should('not.exist');

Copilot uses AI. Check for mistakes.
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.

Created a tech ticket for this - https://bbc.atlassian.net/browse/WS-2175

Comment thread ws-nextjs-app/cypress/e2e/onDemandAudio/index.cy.ts
@Isabella-Mitchell Isabella-Mitchell merged commit ccbd891 into latest Feb 11, 2026
13 checks passed
@amoore108 amoore108 deleted the WS-2092-migrate-audio-cypress-tests branch April 14, 2026 15:55
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