Skip to content

Commit

Permalink
Merge in latest and refactor to use pageData, isAmp and service values
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Hinds committed May 11, 2019
2 parents 41e9a35 + 7425999 commit 5f64100
Show file tree
Hide file tree
Showing 90 changed files with 2,899 additions and 1,876 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
script:
- npm run build
- xvfb-run -a npm run test:prod:travis
- xvfb-run -a npm run test:lighthouse:ci
notifications:
email: false
slack:
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,7 @@ We also have a [Cypress](https://www.cypress.io/) project which runs a different

### Lighthouse Best Practice tests

We use [Lighthouse](https://github.com/googlechrome/lighthouse) to test the performance of our page. For running the tests locally we need two terminals running:

1. [Start the production server](https://github.com/bbc/simorgh#production-build)
2. `npm run lighthouse` runs our Lighthouse tests.

Lighthouse will output html reports to the `reports` folder. It will also open a HTML report in your browser allowing an individual to clearly see the best practice score of the page along with the audits that were run against it.
We use [Lighthouse](https://github.com/googlechrome/lighthouse) to test the performance of our page. However these have been moved out of Simorgh down to our own internal CD processes. This allows us to run these tests on a more accurate depiction of Simorgh. You are free to run lighthouse on your own from your Chrome browser or use the Node Lighthouse CLI.

### To-do

Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/newsBodySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Article Body Tests', () => {

it('should render a formatted timestamp', () => {
cy.window().then(win => {
const { lastPublished } = win.SIMORGH_DATA.data.metadata;
const { lastPublished } = win.SIMORGH_DATA.pageData.metadata;
const timeStamp = Cypress.moment(lastPublished).format('D MMMM YYYY');
const time = getElement('time');
shouldContainText(time, timeStamp);
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('Article Body Tests', () => {

it('should render a title', () => {
cy.window().then(win => {
const { seoHeadline } = win.SIMORGH_DATA.data.promo.headlines;
const { seoHeadline } = win.SIMORGH_DATA.pageData.promo.headlines;
renderedTitle(`${seoHeadline} - BBC News`);
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/persianBodySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describeForLocalOnly('Article Body Tests', () => {

it('should render a title', () => {
cy.window().then(win => {
const { seoHeadline } = win.SIMORGH_DATA.data.promo.headlines;
const { seoHeadline } = win.SIMORGH_DATA.pageData.promo.headlines;
renderedTitle(`${seoHeadline} - BBC News فارسی`);
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/bodyTestHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const shouldMatchReturnedData = (data, element) => {

export const getBlockData = (blockType, win) => {
let blockData;
const { blocks } = win.SIMORGH_DATA.data.content.model;
const { blocks } = win.SIMORGH_DATA.pageData.content.model;

blocks.forEach(block => {
if (!blockData && block.type === blockType) {
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/metaTestHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const checkDataMatchesMetadata = data => {
};
export const metadataAssertion = () => {
cy.window().then(win => {
const windowData = win.SIMORGH_DATA.data;
const windowData = win.SIMORGH_DATA.pageData;
checkDataMatchesMetadata(windowData);
});
};
Expand All @@ -133,7 +133,7 @@ export const metadataAssertion = () => {

export const metadataAssertionAMP = AMPURL => {
cy.window().then(win => {
const windowData = win.SIMORGH_DATA.data;
const windowData = win.SIMORGH_DATA.pageData;
cy.visit(AMPURL);
checkDataMatchesMetadata(windowData);
});
Expand Down
Loading

0 comments on commit 5f64100

Please sign in to comment.