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

WSTEAM1-1349: Lite Site CTA #12058

Merged
merged 38 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d3a2ab5
WSTEAM1-1349: Initial commit|
Isabella-Mitchell Oct 17, 2024
6e2cf02
WSTEAM1-1349: Implements Screen Reader UX
Isabella-Mitchell Oct 18, 2024
422ea18
WSTEAM1-1367: Add styles
shayneahchoon Oct 18, 2024
5bf4774
WSTEAM1-1349: Fix typo
Isabella-Mitchell Oct 18, 2024
0318d06
WSTEAM1-1349: Update spacing. Remove textDecoration
Isabella-Mitchell Oct 18, 2024
3f61500
WSTEAM1-1349: Update
shayneahchoon Oct 18, 2024
a0a91f2
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
shayneahchoon Oct 21, 2024
87f7aa8
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
shayneahchoon Oct 22, 2024
663ced9
WSTEAM1-1349: Add e2e tests (#12074)
shayneahchoon Oct 22, 2024
3a9e6e0
WSTEAM1-1349: Update
shayneahchoon Oct 22, 2024
d788f46
WSTEAM1-1349: Update
shayneahchoon Oct 22, 2024
0189858
WSTEAM1-1349: Update translations
shayneahchoon Oct 22, 2024
7b1ac14
WSTEAM1-1349: Add meta tags
shayneahchoon Oct 22, 2024
fbbdefd
WSTEAM1-1349: Update
shayneahchoon Oct 22, 2024
072922c
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
shayneahchoon Oct 22, 2024
df8bf71
WSTEAM1-1349: Update
shayneahchoon Oct 22, 2024
72c199b
WSTEAM1-1349: Add changes
shayneahchoon Oct 22, 2024
3f9c05d
WSTEAM1-1349: Adds Gahuza lite site information link
Isabella-Mitchell Oct 23, 2024
5b41330
WSTEAM1-1349: Adds width height to svg to ensure increase with browse…
Isabella-Mitchell Oct 23, 2024
cd2dad4
WSTEAM1-1349: Rewords tests
Isabella-Mitchell Oct 23, 2024
f142a6a
WSTEAM1-1349: Removes unnecessary span
Isabella-Mitchell Oct 23, 2024
bcaef4e
WSTEAM1-1349: Adds small margin under message to permit focus indicator
Isabella-Mitchell Oct 23, 2024
da2c9b9
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
amoore108 Oct 23, 2024
ea6006e
WSTEAM1-1349: Set up .lite Integration tests
Isabella-Mitchell Oct 24, 2024
ee98bad
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
Isabella-Mitchell Oct 24, 2024
49bc1d6
WSTEAM1-1349: Replace visuallyHiddenText with Hidden Text element
Isabella-Mitchell Oct 24, 2024
026b6eb
WSTEAM1-1349: Adds e2e coverage for link journeys
Isabella-Mitchell Oct 24, 2024
3b915be
WSTEAM1-1349: Update snapshot
Isabella-Mitchell Oct 24, 2024
1434ab1
WSTEAM1-1349: Wrap all e2e tests in service check statement
Isabella-Mitchell Oct 24, 2024
b1202bc
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
Isabella-Mitchell Oct 25, 2024
ef7b4c2
WSTEAM1-1349: Updates tests
Isabella-Mitchell Oct 25, 2024
12545df
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
HarveyPeachey Oct 28, 2024
35d03e0
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
amoore108 Oct 29, 2024
d0200e4
adds spacing changes and hcm fixes
HarveyPeachey Oct 29, 2024
af2724c
Merge branch 'latest' into WSTEAM1-1349-lite-site-cta
HarveyPeachey Oct 29, 2024
40044d3
updates integration snapshot
HarveyPeachey Oct 29, 2024
caac1b1
adds metadata.json for litesitecta
HarveyPeachey Oct 30, 2024
f751cab
adds readme and metadata to story for litecta
HarveyPeachey Oct 30, 2024
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
2 changes: 2 additions & 0 deletions cypress/e2e/pages/articles/index.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import runTestsForPage from '../../../support/helpers/runTestsForPage';
import { testsThatAlwaysRun, testsThatFollowSmokeTestConfig } from './tests';
import { testsThatFollowSmokeTestConfigForAMPOnly } from './testsForAMPOnly';
import { testsThatFollowSmokeTestConfigForCanonicalOnly } from './testsForCanonicalOnly';
import { testsForLiteOnly } from './testsForLiteOnly';

const testsForPage = {
pageType: 'articles',
testsThatAlwaysRun,
testsThatFollowSmokeTestConfig,
testsThatFollowSmokeTestConfigForCanonicalOnly,
testsThatFollowSmokeTestConfigForAMPOnly,
testsForLiteOnly,
};

runTestsForPage(testsForPage);
35 changes: 35 additions & 0 deletions cypress/e2e/pages/articles/testsForLiteOnly.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* eslint-disable import/prefer-default-export */
import { liteEnabledServices } from '#app/components/LiteSiteCta/liteSiteConfig';

export const testsForLiteOnly = ({ service, pageType }) => {
describe(`Running testsForLiteOnly for ${service} ${pageType}`, () => {
describe('CTA: Lite', () => {
if (liteEnabledServices.includes(service)) {
it('Clicking the link to the main site should navigate to canonical site', () => {
cy.get('[data-e2e="to-main-site"]').within(() => {
cy.get('a')
.should('have.attr', 'href')
.then($href => {
cy.get('a').click();
cy.url().should('eq', $href).should('not.contain', '.lite');
});
});
cy.go('back');
});

it('Clicking the link to the Information page should navigate to lite site', () => {
cy.get('[data-e2e="information-page"]').within(() => {
cy.get('a')
.should('have.attr', 'href')
.then($href => {
cy.get('a').click();
cy.url().should('eq', $href);
})
.and('contain', '.lite');
});
cy.go('back');
});
}
});
});
};
Isabella-Mitchell marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions cypress/support/config/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1518,11 +1518,11 @@ module.exports = () => ({
enabled: false,
},
local: {
paths: ['/gahuza/articles/cey23zx8wx8o'],
enabled: false,
paths: ['/gahuza/articles/c5y51yxeg53o'],
enabled: true,
},
},
smoke: false,
smoke: true,
},
errorPage404: {
environments: {
Expand Down
16 changes: 16 additions & 0 deletions cypress/support/helpers/getLiteUrl/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Url from 'url-parse';

export default path => {
/**
* Appends .lite to the pathname, before appending query string values
*
* */

const urlFromPath = new Url(path);

if (!urlFromPath.pathname.includes('.lite')) {
urlFromPath.set('pathname', `${urlFromPath.pathname}.lite`);
}

return urlFromPath.href;
};
35 changes: 35 additions & 0 deletions cypress/support/helpers/getLiteUrl/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const { default: getLiteUrl } = require('.');

describe('getLiteUrl', () => {
[
'http://localhost:7080',
'https://www.test.bbc.com',
'https://www.bbc.com',
].forEach(baseUrl => {
describe(`with base url ${baseUrl}`, () => {
it('should return lite url', () => {
expect(getLiteUrl(`${baseUrl}/pathname`)).toEqual(
`${baseUrl}/pathname.lite`,
);
});

it('should not append .lite to lite path', () => {
expect(getLiteUrl(`${baseUrl}/pathname.lite`)).toEqual(
`${baseUrl}/pathname.lite`,
);
});

it('should return lite url for path with query string params', () => {
expect(getLiteUrl(`${baseUrl}/pathname?query_string=value`)).toEqual(
`${baseUrl}/pathname.lite?query_string=value`,
);
});

it('should not append .lite to lite path with query string params', () => {
expect(
getLiteUrl(`${baseUrl}/pathname.lite?query_string=value`),
).toEqual(`${baseUrl}/pathname.lite?query_string=value`);
});
});
});
});
24 changes: 24 additions & 0 deletions cypress/support/helpers/runTestsForPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import serviceHasPageType from './serviceHasPageType';
import ampOnlyServices from './ampOnlyServices';
import visitPage from './visitPage';
import getAmpUrl from './getAmpUrl';
import getLiteUrl from './getLiteUrl';

// This function takes all types of tests we have and runs in this series of steps with the fewest possible page visits

Expand All @@ -26,6 +27,7 @@ const runTestsForPage = ({
testsThatNeverRunDuringSmokeTesting = noOp,
testsThatNeverRunDuringSmokeTestingForCanonicalOnly = noOp,
testsThatNeverRunDuringSmokeTestingForAMPOnly = noOp,
testsForLiteOnly = noOp,
}) => {
// For each Service and Page Type in the config file it visits the path and it writes a describe saying this.

Expand Down Expand Up @@ -137,6 +139,28 @@ const runTestsForPage = ({
}
}
});

// Switch to Lite page URL (NB only some of our pages have AMP variants)
describe(`${pageType} - ${currentPath} - Lite`, () => {
// TC2 MAPs are not loading the media player which causes the tests to fail when the page is visited, this is accepted behaviour
// The substring '/20' is common to all the TC2 MAPs test URLs in the settings and we will not be adding more
if (!currentPath.includes('/20')) {
before(() => {
Cypress.env('currentPath', currentPath);

visitPage(getLiteUrl(currentPath), pageType);
});

const testArgs = {
service,
pageType,
variant: config[service].variant,
isAmp: true,
};

testsForLiteOnly(testArgs);
}
});
});
});
};
Expand Down
Loading
Loading