Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WORLDSERVICE-346 - Remove amp from Homepage regex #12401

Merged
merged 15 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

🎏 What happens when we have serbian / uzbek / zhongwen configured?

Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need to tackle that if/when it happens 😅 Lou did point this out during our discussions on a solution, so we'll need some extra logic to cater for the serbianCyr naming etc.

Copy link
Contributor

@karinathomasbbc karinathomasbbc Feb 13, 2025

Choose a reason for hiding this comment

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

Yeah I checked the CD pipeline and scheduled E2Es and none of the variant services are configured in the cypress settings file for these cookie banner tests. If we were to add them, then we would need to fix it then, but don't need to worry about it at the moment. (We've had to workaround this annoying configuration many times in the Cypress tests 🙄)


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
Loading