forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtop-contributor.js
42 lines (35 loc) · 1.06 KB
/
top-contributor.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* global cy */
describe('Top contributor in user profile', () => {
before(() => {
cy.clearCookies();
cy.exec('npm run seed -- --top-contributor');
});
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',
'/top-contributors'
);
});
it('Should show years when it was achieved', () => {
cy.contains('2017, 2018 and 2019').should('be.visible');
});
});