diff --git a/jest.config.js b/jest.config.js index 7371105785d..578343273f3 100644 --- a/jest.config.js +++ b/jest.config.js @@ -61,15 +61,7 @@ const ampIntegrationTests = { moduleNameMapper: jestDirAlias, setupFilesAfterEnv: ['./src/testHelpers/setupTests.js'], testMatch: ['**/src/integration/!(utils)/**/*.test.js'], - testPathIgnorePatterns: [ - '.*lite\\.test\\.js$', - '.*canonical\\.test\\.js$', - '/src/integration/pages/articles/', - '/src/integration/pages/mediaArticlePage/', - '/src/integration/pages/mediaAssetPage/', - '/src/integration/pages/photoGalleryPage/', - '/src/integration/pages/storyPage/', - ], + testPathIgnorePatterns: ['.*lite\\.test\\.js$', '.*canonical\\.test\\.js$'], }; const canonicalIntegrationTests = { @@ -82,15 +74,7 @@ const canonicalIntegrationTests = { moduleNameMapper: jestDirAlias, setupFilesAfterEnv: ['./src/testHelpers/setupTests.js'], testMatch: ['**/src/integration/!(utils)/**/*.test.js'], - testPathIgnorePatterns: [ - '.*lite\\.test\\.js$', - '.*amp\\.test\\.js$', - '/src/integration/pages/articles/', - '/src/integration/pages/mediaArticlePage/', - '/src/integration/pages/mediaAssetPage/', - '/src/integration/pages/photoGalleryPage/', - '/src/integration/pages/storyPage/', - ], + testPathIgnorePatterns: ['.*lite\\.test\\.js$', '.*amp\\.test\\.js$'], }; const liteIntegrationTests = { @@ -103,15 +87,7 @@ const liteIntegrationTests = { moduleNameMapper: jestDirAlias, setupFilesAfterEnv: ['./src/testHelpers/setupTests.js'], testMatch: ['**/src/integration/!(utils)/**/*.test.js'], - testPathIgnorePatterns: [ - '.*canonical\\.test\\.js$', - '.*amp\\.test\\.js$', - '/src/integration/pages/articles/', - '/src/integration/pages/mediaArticlePage/', - '/src/integration/pages/mediaAssetPage/', - '/src/integration/pages/photoGalleryPage/', - '/src/integration/pages/storyPage/', - ], + testPathIgnorePatterns: ['.*canonical\\.test\\.js$', '.*amp\\.test\\.js$'], }; const puppeteerTests = { diff --git a/ws-nextjs-app/cypress/e2e/errorPage404/tests.ts b/ws-nextjs-app/cypress/e2e/errorPage404/tests.ts index ba242db42c0..d5f693fa0db 100644 --- a/ws-nextjs-app/cypress/e2e/errorPage404/tests.ts +++ b/ws-nextjs-app/cypress/e2e/errorPage404/tests.ts @@ -102,8 +102,9 @@ export default ({ ); }); }); - // SKIPPED: The following tests have been skipped as the Error Page hasn't yet been migrated. if ((envConfig as EnvironmentConfigType).standaloneErrorPages) { + // These tests are skipped because the Next.js application doesn't currently have dedicated routes for /{service}/404 and /{service}/500 that return HTTP 200. + // These would need to be explicitly configured in the Next.js routing/middleware to work as standalone error pages. describe.skip(`${service} error page routes`, () => { it(`/${service}/404 should have response code 200`, () => { cy.testResponseCodeAndType({ diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/scriptSwitching/assertions/index.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/scriptSwitching/assertions/index.ts index 00d297f994a..475f8873f29 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/scriptSwitching/assertions/index.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/scriptSwitching/assertions/index.ts @@ -1,11 +1,10 @@ -import { Variants } from '#app/models/types/global'; import serviceConfigs from '#src/server/utilities/serviceConfigs'; import { ServiceParametersType } from '../../../../types'; import { clickScriptSwitcher, - // clickHomePageLink, - // clickPromoLinkOnHomePage, + clickHomePageLink, + clickPromoLinkOnHomePage, } from '../helpers'; const assertScriptSwitchButton = ({ @@ -57,7 +56,7 @@ const allVariantAssertions = ({ service, variant }: ServiceParametersType) => { export default ({ service, - // pageType, + pageType, variant, otherVariant, }: ServiceParametersType) => { @@ -69,38 +68,36 @@ export default ({ allVariantAssertions({ service, variant }); // Clicks script switcher - clickScriptSwitcher(otherVariant as Variants); + clickScriptSwitcher({ service, variant: otherVariant }); cy.log( `Asserting script switch button, url and document lang for other variant: ${otherVariant}`, ); allVariantAssertions({ service, variant: otherVariant }); - // SKIPPED: The following tests have been skipped as the Home Page hasn't yet been migrated. - // SKIPPED: When we migrate home pages we should consider refactoring these tests to reduce visits we make to home pages - // // Navigate to home page by clicking link in the banner - // clickHomePageLink(service, otherVariant); + // Navigate to home page by clicking link in the banner + clickHomePageLink({ service, variant: otherVariant }); - // cy.log( - // `Asserting script switch button, url and document lang has persisted for other variant: ${otherVariant}`, - // ); - // allVariantAssertions(service, otherVariant); + cy.log( + `Asserting script switch button, url and document lang has persisted for other variant: ${otherVariant}`, + ); + allVariantAssertions({ service, variant: otherVariant }); - // // Finding a link to click on the home page - // clickPromoLinkOnHomePage(pageType); + // Finding a link to click on the home page + clickPromoLinkOnHomePage({ service, variant, pageType }); - // cy.log( - // `Asserting script switch button, url and document lang has persisted for other variant: ${otherVariant}`, - // ); - // allVariantAssertions(service, otherVariant); + cy.log( + `Asserting script switch button, url and document lang has persisted for other variant: ${otherVariant}`, + ); + allVariantAssertions({ service, variant: otherVariant }); - // // Clicks script switcher to original variant - // clickScriptSwitcher(variant as Variants); + // Clicks script switcher to original variant + clickScriptSwitcher({ service, variant }); - // cy.log( - // `Asserting script switch button, url and document lang have changed after clicking script switcher to ${variant}`, - // ); - // allVariantAssertions({ service, variant }); + cy.log( + `Asserting script switch button, url and document lang have changed after clicking script switcher to ${variant}`, + ); + allVariantAssertions({ service, variant }); }); }); }; diff --git a/ws-nextjs-app/cypress/e2e/specialFeatures/scriptSwitching/helpers/index.ts b/ws-nextjs-app/cypress/e2e/specialFeatures/scriptSwitching/helpers/index.ts index bdd260dcd24..ac40b06dcfb 100644 --- a/ws-nextjs-app/cypress/e2e/specialFeatures/scriptSwitching/helpers/index.ts +++ b/ws-nextjs-app/cypress/e2e/specialFeatures/scriptSwitching/helpers/index.ts @@ -22,14 +22,14 @@ const clickFirstMapLink = () => { }); }; -export const clickScriptSwitcher = (variant: string) => { +export const clickScriptSwitcher = ({ variant }: ServiceParametersType) => { cy.get(`a[data-variant="${variant}"]`).click(); }; -export const clickHomePageLink = ( - service: ServiceParametersType, - variant: ServiceParametersType, -) => { +export const clickHomePageLink = ({ + service, + variant, +}: ServiceParametersType) => { cy.get('header[role="banner"]').within(() => { cy.get( `a[aria-labelledby="BrandLink-topPage"][href="/${service}/${variant}"]`, @@ -37,7 +37,9 @@ export const clickHomePageLink = ( }); }; -export const clickPromoLinkOnHomePage = (pageType: string) => { +export const clickPromoLinkOnHomePage = ({ + pageType, +}: ServiceParametersType) => { // If it is a MAP test, find first MAP on the homepage and click it if (pageType === MEDIA_ASSET_PAGE) { clickFirstMapLink();