| 
									
										
										
										
											2020-11-16 08:19:45 +00:00
										 |  |  | describe('Top contributor in user profile', () => { | 
					
						
							|  |  |  |   before(() => { | 
					
						
							|  |  |  |     cy.clearCookies(); | 
					
						
							| 
									
										
										
										
											2020-12-03 15:45:45 +00:00
										 |  |  |     cy.exec('npm run seed -- --top-contributor'); | 
					
						
							| 
									
										
										
										
											2020-11-16 08:19:45 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   after(() => { | 
					
						
							|  |  |  |     cy.exec('npm run seed'); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   beforeEach(() => { | 
					
						
							|  |  |  |     cy.login(); | 
					
						
							|  |  |  |     cy.contains('Profile').click({ force: true }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // The following line is only required if you want to test it in development
 | 
					
						
							|  |  |  |     // cy.contains('Preview custom 404 page').click();
 | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('Should show `Top Contributor` text with badge', () => { | 
					
						
							|  |  |  |     cy.contains('Top Contributor') | 
					
						
							|  |  |  |       .parent() | 
					
						
							|  |  |  |       .within(() => { | 
					
						
							|  |  |  |         cy.contains('Top Contributor').should('be.visible'); | 
					
						
							|  |  |  |         cy.get('svg').should('be.visible'); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // eslint-disable-next-line max-len
 | 
					
						
							|  |  |  |   it('Should take user to `Top Contributor` page when `Top Contributor` gets clicked', () => { | 
					
						
							|  |  |  |     cy.contains('Top Contributor').should( | 
					
						
							|  |  |  |       'have.attr', | 
					
						
							|  |  |  |       'href', | 
					
						
							| 
									
										
										
										
											2021-08-23 19:50:28 +04:00
										 |  |  |       'https://www.freecodecamp.org/news/freecodecamp-top-contributors/' | 
					
						
							| 
									
										
										
										
											2020-11-16 08:19:45 +00:00
										 |  |  |     ); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('Should show years when it was achieved', () => { | 
					
						
							|  |  |  |     cy.contains('2017, 2018 and 2019').should('be.visible'); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |