diff --git a/cypress/integration/tags.js b/cypress/integration/tags.js
index 92976f42d0..74c50487a5 100644
--- a/cypress/integration/tags.js
+++ b/cypress/integration/tags.js
@@ -1,87 +1,98 @@
+const challenges = {
+ responsiveWebDesign:
+ '/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements',
+ rosettaCode: '/learn/coding-interview-prep/rosetta-code/100-doors',
+ projectEuler:
+ '/learn/coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5'
+};
+
+const social = {
+ description: 'Learn to Code — For Free'
+};
+
+const scripts = {
+ mathjax: {
+ selector: 'body script[id="mathjax"]',
+ src: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML'
+ }
+};
+
describe('The Document Metadata', () => {
- before(() => {
- cy.visit('/');
- cy.document();
- });
+ describe('landing page', () => {
+ before(() => {
+ cy.visit('/');
+ });
- const social = {
- description: 'Learn to Code — For Free'
- };
-
- const challengs = {
- responsiveWebDesign:
- '/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements',
- rosetaCode: '/learn/coding-interview-prep/rosetta-code/100-doors',
- projectEuler:
- '/learn/coding-interview-prep/project-euler/problem-1-multiples-of-3-and-5'
- };
-
- const scripts = {
- mathjax: {
- selector: 'body script[id="mathjax"]',
- src: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML'
- }
- };
- it('landing page has correct for description', () => {
- cy.get('head meta[name="description"]').should(
- 'have.attr',
- 'content',
- 'Learn to Code — For Free'
- );
+ it('has correct for description', () => {
+ cy.get('head meta[name="description"]').should(
+ 'have.attr',
+ 'content',
+ 'Learn to Code — For Free'
+ );
+ });
+ it('has correct for og title', () => {
+ cy.get('head meta[name="og:title"]').should(
+ 'have.attr',
+ 'content',
+ 'freeCodeCamp.org'
+ );
+ });
+ it('has correct for og description', () => {
+ cy.get('head meta[name="og:description"]').should(
+ 'have.attr',
+ 'content',
+ social.description
+ );
+ });
+ it('has correct for twitter title', () => {
+ cy.get('head meta[name="twitter:title"]').should(
+ 'have.attr',
+ 'content',
+ 'freeCodeCamp.org'
+ );
+ });
+ it('has correct for twitter description', () => {
+ cy.get('head meta[name="twitter:description"]').should(
+ 'have.attr',
+ 'content',
+ social.description
+ );
+ });
+ it('should not have mathjax body script', () => {
+ cy.get(scripts.mathjax.selector).should('not.exist');
+ });
});
- it('landing page has correct for og title', () => {
- cy.get('head meta[name="og:title"]').should(
- 'have.attr',
- 'content',
- 'freeCodeCamp.org'
- );
+ describe('responsive webdesign challenges', () => {
+ it('should not have mathjax body script', () => {
+ cy.visit(challenges.responsiveWebDesign);
+ cy.contains('Basic HTML and HTML5');
+ cy.get(scripts.mathjax.selector).should('not.exist');
+ });
});
- it('landing page has correct for og description', () => {
- cy.get('head meta[name="og:description"]').should(
- 'have.attr',
- 'content',
- social.description
- );
+ describe('project euler challenges', () => {
+ it('should have mathjax body script', () => {
+ // TODO: this is flaky, because (somehow) a chunk error is thrown when
+ // visiting this page and browser (somehow) ends up on
+ // challenges/responsiveWebDesign
+ // The second visit to this page works fine.
+ cy.visit(challenges.projectEuler);
+ cy.contains('Project Euler');
+ cy.get(scripts.mathjax.selector).should(
+ 'have.attr',
+ 'src',
+ scripts.mathjax.src
+ );
+ });
});
- it('landing page has correct for twitter title', () => {
- cy.get('head meta[name="twitter:title"]').should(
- 'have.attr',
- 'content',
- 'freeCodeCamp.org'
- );
- });
- it('landing page has correct for twitter description', () => {
- cy.get('head meta[name="twitter:description"]').should(
- 'have.attr',
- 'content',
- social.description
- );
- });
- it('landing page should not have mathjax body script', () => {
- cy.reload();
- cy.get(scripts.mathjax.selector).should('not.exist');
- });
- it('responsive webdesign challenges should not have mathjax body script', () => {
- cy.visit(challengs.responsiveWebDesign);
- cy.reload();
- cy.get(scripts.mathjax.selector).should('not.exist');
- });
- it('project euler challenges should have mathjax body script', () => {
- cy.visit(challengs.projectEuler);
- cy.reload();
- cy.get(scripts.mathjax.selector).should(
- 'have.attr',
- 'src',
- scripts.mathjax.src
- );
- });
- it('rosetta code challenges should have mathjax body script', () => {
- cy.visit(challengs.projectEuler);
- cy.reload();
- cy.get(scripts.mathjax.selector).should(
- 'have.attr',
- 'src',
- scripts.mathjax.src
- );
+ describe('rosetta code challenges', () => {
+ it('should have mathjax body script', () => {
+ cy.visit(challenges.rosettaCode);
+ cy.contains('Rosetta Code');
+ cy.get(scripts.mathjax.selector).should(
+ 'have.attr',
+ 'src',
+ scripts.mathjax.src
+ );
+ });
});
});