Skip to content

Commit

Permalink
WORLDSERVICE-346 - Remove amp from Homepage regex (#12401)
Browse files Browse the repository at this point in the history
* remove amp from homepage regex

* update snapshots

* remove kyrgyz homepage from amp validator test

* amp test deletions

* another amp test file deletion

* filter paths to exclude homepage urls from amp tests

* refactor filter logic to exclude homepage urls

* addressing code comments
  • Loading branch information
louisearchibald authored Feb 13, 2025
1 parent d81ce95 commit 5558674
Show file tree
Hide file tree
Showing 16 changed files with 6 additions and 2,886 deletions.
8 changes: 0 additions & 8 deletions cypress/e2e/pages/homePage/testsForAMPOnly.js

This file was deleted.

3 changes: 3 additions & 0 deletions cypress/e2e/specialFeatures/cookieBanner/index.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Object.keys(config)
.filter(service => serviceFilter(service))
.forEach(service => {
const { variant } = config[service];
const variantPath = variant === 'default' ? '' : `/${variant}`;
const isHomePagePath = path => path === `/${service}${variantPath}`;

const paths = getPaths(service);
paths.forEach(path => {
Expand All @@ -56,6 +58,7 @@ Object.keys(config)
});

paths
.filter(path => !isHomePagePath(path))
.map(path => `${path}.amp`)
.forEach(path => {
if (!urlsToExcludeFromAmpTests.some(url => path.includes(url))) {
Expand Down
2 changes: 0 additions & 2 deletions scripts/ampHtmlValidator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ const runValidator = async () => {
.flat()
.filter(url => !excludedUrls.includes(url));

// include kyrgyz homepage in amp validator tests
const urlsToValidate = [
...urls,
'/kyrgyz',
'/mundo/articles/ce42wzqr2mko',
'/news/articles/cn7k01xp8kxo',
'/persian/articles/cej3lzd5e0go',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ exports[`regex utils snapshots should create expected regex from getFrontPageReg

exports[`regex utils snapshots should create expected regex from getFrontPageRegex when isLive = true 1`] = `"/:service(archive|cymrufyw|naidheachdan|news|newsround|scotland|sport|ukchina|ws):variant(/simp|/trad|/cyr|/lat)?:amp(.amp)?:lite(.lite)?"`;

exports[`regex utils snapshots should create expected regex from getHomePageRegex when isLive = false 1`] = `"/:service(afaanoromoo|afrique|amharic|arabic|archive|azeri|bengali|burmese|cymrufyw|gahuza|gujarati|hausa|hindi|igbo|indonesia|japanese|korean|kyrgyz|marathi|mundo|naidheachdan|nepali|news|newsround|pashto|persian|pidgin|portuguese|punjabi|russian|scotland|serbian|sinhala|somali|sport|swahili|tamil|telugu|thai|tigrinya|turkce|ukchina|ukrainian|urdu|uzbek|vietnamese|ws|yoruba|zhongwen):variant(/simp|/trad|/cyr|/lat)?:amp(.amp)?:lite(.lite)?"`;
exports[`regex utils snapshots should create expected regex from getHomePageRegex when isLive = false 1`] = `"/:service(afaanoromoo|afrique|amharic|arabic|archive|azeri|bengali|burmese|cymrufyw|gahuza|gujarati|hausa|hindi|igbo|indonesia|japanese|korean|kyrgyz|marathi|mundo|naidheachdan|nepali|news|newsround|pashto|persian|pidgin|portuguese|punjabi|russian|scotland|serbian|sinhala|somali|sport|swahili|tamil|telugu|thai|tigrinya|turkce|ukchina|ukrainian|urdu|uzbek|vietnamese|ws|yoruba|zhongwen):variant(/simp|/trad|/cyr|/lat)?:lite(.lite)?"`;

exports[`regex utils snapshots should create expected regex from getHomePageRegex when isLive = true 1`] = `"/:service(afaanoromoo|afrique|amharic|arabic|azeri|bengali|burmese|gahuza|gujarati|hausa|hindi|igbo|indonesia|japanese|korean|kyrgyz|marathi|mundo|nepali|pashto|persian|pidgin|portuguese|punjabi|russian|serbian|sinhala|somali|swahili|tamil|telugu|thai|tigrinya|turkce|ukrainian|urdu|uzbek|vietnamese|yoruba|zhongwen):variant(/simp|/trad|/cyr|/lat)?:amp(.amp)?:lite(.lite)?"`;
exports[`regex utils snapshots should create expected regex from getHomePageRegex when isLive = true 1`] = `"/:service(afaanoromoo|afrique|amharic|arabic|azeri|bengali|burmese|gahuza|gujarati|hausa|hindi|igbo|indonesia|japanese|korean|kyrgyz|marathi|mundo|nepali|pashto|persian|pidgin|portuguese|punjabi|russian|serbian|sinhala|somali|swahili|tamil|telugu|thai|tigrinya|turkce|ukrainian|urdu|uzbek|vietnamese|yoruba|zhongwen):variant(/simp|/trad|/cyr|/lat)?:lite(.lite)?"`;

exports[`regex utils snapshots should create expected regex from getLegacyAssetRegex when isLive = false 1`] = `"/:service(afaanoromoo|afrique|amharic|arabic|archive|azeri|bengali|burmese|cymrufyw|gahuza|gujarati|hausa|hindi|igbo|indonesia|japanese|korean|kyrgyz|marathi|mundo|naidheachdan|nepali|news|newsround|pashto|persian|pidgin|portuguese|punjabi|russian|scotland|serbian|sinhala|somali|sport|swahili|tamil|telugu|thai|tigrinya|turkce|ukchina|ukrainian|urdu|uzbek|vietnamese|ws|yoruba|zhongwen):variant(/simp|/trad|/cyr|/lat)?/:assetUri([a-z0-9-_]{1,}/[a-z0-9-_/]{1,}):amp(.amp)?:lite(.lite)?"`;

Expand Down
2 changes: 1 addition & 1 deletion src/app/routes/utils/regex/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const getHomePageRegex = services => {
homePages = services.filter(service => homePageServices.includes(service));
}
const homePageServiceRegex = getServiceRegex(homePages);
return `/:service(${homePageServiceRegex}):variant(${variantRegex})?:amp(${ampRegex})?:lite(${liteRegex})?`;
return `/:service(${homePageServiceRegex}):variant(${variantRegex})?:lite(${liteRegex})?`;
};

export const getSwRegex = services => {
Expand Down
28 changes: 0 additions & 28 deletions src/integration/pages/homePage/ampTests.js

This file was deleted.

Loading

0 comments on commit 5558674

Please sign in to comment.