| 
									
										
										
										
											2019-10-05 23:38:38 +01:00
										 |  |  | /* global cy */ | 
					
						
							|  |  |  | const selectors = { | 
					
						
							|  |  |  |   heading: "[data-test-label='landing-header']", | 
					
						
							| 
									
										
										
										
											2020-08-24 21:06:40 +03:00
										 |  |  |   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 23:38:38 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-24 12:34:35 +02:00
										 |  |  | const certifications = [ | 
					
						
							|  |  |  |   'Responsive Web Design', | 
					
						
							|  |  |  |   'JavaScript Algorithms and Data Structures', | 
					
						
							| 
									
										
										
										
											2021-01-13 07:09:45 -06:00
										 |  |  |   'Front End Development Libraries', | 
					
						
							| 
									
										
										
										
											2020-09-24 12:34:35 +02:00
										 |  |  |   'Data Visualization', | 
					
						
							|  |  |  |   'APIs and Microservices', | 
					
						
							|  |  |  |   'Quality Assurance', | 
					
						
							|  |  |  |   'Scientific Computing with Python', | 
					
						
							|  |  |  |   'Data Analysis with Python', | 
					
						
							|  |  |  |   'Information Security', | 
					
						
							|  |  |  |   'Machine Learning with Python' | 
					
						
							|  |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-04 22:27:21 +06:00
										 |  |  | describe('Landing page', () => { | 
					
						
							|  |  |  |   it('Should render', () => { | 
					
						
							| 
									
										
										
										
											2019-10-05 23:38:38 +01:00
										 |  |  |     cy.visit('/'); | 
					
						
							| 
									
										
										
										
											2020-12-07 13:15:11 +03:00
										 |  |  |     cy.title().should( | 
					
						
							|  |  |  |       'eq', | 
					
						
							| 
									
										
										
										
											2021-01-15 17:39:59 +03:00
										 |  |  |       'Learn to Code — For Free — Coding Courses for Busy People' | 
					
						
							| 
									
										
										
										
											2020-12-07 13:15:11 +03:00
										 |  |  |     ); | 
					
						
							| 
									
										
										
										
											2020-05-11 20:26:12 +07:00
										 |  |  |     cy.contains(selectors.callToAction, "Get started (it's free)"); | 
					
						
							| 
									
										
										
										
											2020-08-24 21:06:40 +03:00
										 |  |  |     cy.get(selectors.callToAction).should('have.length', 2); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-04 22:27:21 +06:00
										 |  |  |   it('Has visible header and sub-header', () => { | 
					
						
							| 
									
										
										
										
											2021-01-15 17:39:59 +03:00
										 |  |  |     cy.contains(selectors.heading, 'Learn to code — for free.'); | 
					
						
							| 
									
										
										
										
											2020-09-04 22:27:21 +06:00
										 |  |  |     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', () => { | 
					
						
							| 
									
										
										
										
											2021-03-11 00:31:46 +05:30
										 |  |  |     cy.get('.logo-row').children().its('length').should('eq', 5); | 
					
						
							| 
									
										
										
										
											2020-09-04 22:27:21 +06:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('Has `as seens as` section', () => { | 
					
						
							|  |  |  |     cy.contains('Build projects.').should('be.visible'); | 
					
						
							| 
									
										
										
										
											2021-03-11 00:31:46 +05:30
										 |  |  |     cy.get('.big-heading').siblings().get('svg'); | 
					
						
							| 
									
										
										
										
											2020-09-04 22:27:21 +06:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-11 00:31:46 +05:30
										 |  |  |   it('Has a visible large image on large viewports', function () { | 
					
						
							|  |  |  |     cy.viewport(1200, 660).get(selectors.landingPageImage).should('be.visible'); | 
					
						
							| 
									
										
										
										
											2020-08-24 21:06:40 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-11 00:31:46 +05:30
										 |  |  |     cy.viewport(1199, 660).get(selectors.landingPageImage).should('not.exist'); | 
					
						
							| 
									
										
										
										
											2020-08-24 21:06:40 +03:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-11 00:31:46 +05:30
										 |  |  |   it('Has links to all the certifications', function () { | 
					
						
							|  |  |  |     cy.get(selectors.certifications).children().its('length').should('eq', 10); | 
					
						
							| 
									
										
										
										
											2020-09-24 12:34:35 +02:00
										 |  |  |     cy.wrap(certifications).each(cert => { | 
					
						
							|  |  |  |       cy.get(selectors.certifications).contains(cert); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2020-08-24 21:06:40 +03:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2020-09-04 22:27:21 +06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-11 00:31:46 +05:30
										 |  |  |   it('Has 3 testimonial cards', function () { | 
					
						
							|  |  |  |     cy.get(selectors.testimonials).children().its('length').should('eq', 3); | 
					
						
							| 
									
										
										
										
											2019-10-05 23:38:38 +01:00
										 |  |  |   }); | 
					
						
							|  |  |  | }); |