freeCodeCamp/cypress/integration/landing.js

70 lines
2.2 KiB
JavaScript
Raw Normal View History

2019-10-05 22:38:38 +00:00
const selectors = {
heading: "[data-test-label='landing-header']",
callToAction: "[data-test-label='landing-big-cta']",
certifications: "[data-test-label='certifications']",
testimonials: "[data-test-label='testimonial-cards']",
landingPageImage: '.landing-page-image'
2019-10-05 22:38:38 +00:00
};
const certifications = [
'Responsive Web Design',
'JavaScript Algorithms and Data Structures',
'Front End Development Libraries',
'Data Visualization',
feat: add 'back/front end' in curriculum (#42596) * chore: rename APIs and Microservices to include "Backend" (#42515) * fix typo * fix typo * undo change * Corrected grammar mistake Corrected a grammar mistake by removing a comma. * change APIs and Microservices cert title * update title * Change APIs and Microservices certi title * Update translations.json * update title * feat(curriculum): rename apis and microservices cert * rename folder structure * rename certificate * rename learn Markdown * apis-and-microservices -> back-end-development-and-apis * update backend meta * update i18n langs and cypress test Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> * fix: add development to front-end libraries (#42512) * fix: added-the-word-Development-to-front-end-libraries * fix/added-the-word-Development-to-front-end-libraries * fix/added-word-development-to-front-end-libraries-in-other-related-files * fix/added-the-word-Development-to-front-end-and-all-related-files * fix/removed-typos-from-last-commit-in-index.md * fix/reverted-changes-that-i-made-to-dependecies * fix/removed xvfg * fix/reverted changes that i made to package.json * remove unwanted changes * front-end-development-libraries changes * rename backend certSlug and README * update i18n folder names and keys * test: add legacy path redirect tests This uses serve.json from the client-config repo, since we currently use that in production * fix: create public dir before moving serve.json * fix: add missing script * refactor: collect redirect tests * test: convert to cy.location for stricter tests * rename certificate folder to 00-certificates * change crowdin config to recognise new certificates location * allow translations to be used Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * add forwards slashes to path redirects * fix cypress path tests again * plese cypress * fix: test different challenge Okay so I literally have no idea why this one particular challenge fails in Cypress Firefox ONLY. Tom and I paired and spun a full build instance and confirmed in Firefox the page loads and redirects as expected. Changing to another bootstrap challenge passes Cypress firefox locally. Absolutely boggled by this. AAAAAAAAAAAAAAA * fix: separate the test Okay apparently the test does not work unless we separate it into a different `it` statement. >:( >:( >:( >:( Co-authored-by: Sujal Gupta <55016909+heysujal@users.noreply.github.com> Co-authored-by: Noor Fakhry <65724923+NoorFakhry@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com>
2021-08-14 02:57:13 +00:00
'Back End Development and APIs',
'Quality Assurance',
'Scientific Computing with Python',
'Data Analysis with Python',
'Information Security',
'Machine Learning with Python'
];
describe('Landing page', () => {
it('Should render', () => {
2019-10-05 22:38:38 +00:00
cy.visit('/');
2020-12-07 10:15:11 +00:00
cy.title().should(
'eq',
'Learn to Code — For Free — Coding Courses for Busy People'
2020-12-07 10:15:11 +00:00
);
cy.contains(selectors.callToAction, "Get started (it's free)");
cy.get(selectors.callToAction).should('have.length', 2);
});
it('Has visible header and sub-header', () => {
cy.contains(selectors.heading, 'Learn to code — for free.');
cy.contains('Build projects.').should('be.visible');
cy.contains('Earn certifications.').should('be.visible');
cy.contains(
'Since 2014, more than 40,000 freeCodeCamp.org ' +
'graduates have gotten jobs at tech companies including:'
).should('be.visible');
});
it('Has 5 brand logos', () => {
cy.get('.logo-row').children().its('length').should('eq', 5);
});
it('Has `as seens as` section', () => {
cy.contains('Build projects.').should('be.visible');
cy.get('.big-heading').siblings().get('svg');
});
it('Has a visible large image on large viewports', function () {
cy.viewport(1200, 660).get(selectors.landingPageImage).should('be.visible');
cy.viewport(1199, 660).get(selectors.landingPageImage).should('not.exist');
});
it('Has links to all the certifications', function () {
cy.get(selectors.certifications).children().its('length').should('eq', 10);
cy.wrap(certifications).each(cert => {
cy.get(selectors.certifications).contains(cert);
});
});
it('Has 3 testimonial cards', function () {
cy.get(selectors.testimonials).children().its('length').should('eq', 3);
2019-10-05 22:38:38 +00:00
});
});