2021-12-11 10:04:16 +01:00
const certifiedUser = '/certification/certifieduser/responsive-web-design' ;
2020-09-24 07:03:11 -05:00
2021-03-11 00:31:46 +05:30
describe ( 'A certification,' , function ( ) {
2021-06-11 18:06:46 +02:00
before ( ( ) => {
2021-12-11 10:04:16 +01:00
cy . exec ( 'npm run seed:certified-user' ) ;
2021-06-11 18:06:46 +02:00
} ) ;
2020-09-24 07:03:11 -05:00
2021-06-11 18:06:46 +02:00
describe ( 'while viewing your own,' , function ( ) {
2021-12-11 10:04:16 +01:00
beforeEach ( ( ) => {
2021-06-11 18:06:46 +02:00
cy . login ( ) ;
2020-09-24 07:03:11 -05:00
} ) ;
2021-03-11 00:31:46 +05:30
it ( 'should render a LinkedIn button' , function ( ) {
2021-12-11 10:04:16 +01:00
cy . visit ( certifiedUser ) ;
2020-10-01 16:10:00 +02:00
cy . contains ( 'Add this certification to my LinkedIn profile' )
. should ( 'have.attr' , 'href' )
. and (
'match' ,
// eslint-disable-next-line max-len
2021-12-11 10:04:16 +01:00
/https:\/\/www\.linkedin\.com\/profile\/add\?startTask=CERTIFICATION_NAME&name=Responsive Web Design&organizationId=4831032&issueYear=\d\d\d\d&issueMonth=\d\d?&certUrl=https:\/\/freecodecamp\.org\/certification\/certifieduser\/responsive-web-design/
2020-10-01 16:10:00 +02:00
) ;
2020-09-24 07:03:11 -05:00
} ) ;
2021-03-11 00:31:46 +05:30
it ( 'should render a Twitter button' , function ( ) {
2021-12-11 10:04:16 +01:00
cy . visit ( certifiedUser ) ;
2020-09-24 07:03:11 -05:00
cy . contains ( 'Share this certification on Twitter' ) . should (
'have.attr' ,
'href' ,
2021-12-11 10:04:16 +01:00
'https://twitter.com/intent/tweet?text=I just earned the Responsive Web Design certification @freeCodeCamp! Check it out here: https://freecodecamp.org/certification/certifieduser/responsive-web-design'
2020-09-24 07:03:11 -05:00
) ;
} ) ;
2020-10-13 11:30:18 +02:00
2021-12-11 10:04:16 +01:00
it ( 'should be issued with the submission date' , ( ) => {
cy . visit ( certifiedUser ) ;
const issued = ` Issued \x a0August 3, 2018 ` ;
2020-10-13 11:30:18 +02:00
cy . get ( '[data-cy=issue-date]' ) . should ( 'have.text' , issued ) ;
} ) ;
2020-09-24 07:03:11 -05:00
} ) ;
2021-03-11 00:31:46 +05:30
describe ( "while viewing someone else's," , function ( ) {
2020-09-24 07:03:11 -05:00
before ( ( ) => {
2021-12-11 10:04:16 +01:00
cy . visit ( certifiedUser ) ;
2021-06-11 18:06:46 +02:00
} ) ;
it ( 'should display certificate' , function ( ) {
cy . contains ( 'has successfully completed the freeCodeCamp.org' ) . should (
'exist'
) ;
cy . contains ( 'Responsive Web Design' ) . should ( 'exist' ) ;
2020-09-24 07:03:11 -05:00
} ) ;
2021-03-11 00:31:46 +05:30
it ( 'should not render a LinkedIn button' , function ( ) {
2020-09-24 07:03:11 -05:00
cy . contains ( 'Add this certification to my LinkedIn profile' ) . should (
'not.exist'
) ;
} ) ;
2021-03-11 00:31:46 +05:30
it ( 'should not render a Twitter button' , function ( ) {
2020-09-24 07:03:11 -05:00
cy . contains ( 'Share this certification on Twitter' ) . should ( 'not.exist' ) ;
} ) ;
} ) ;
} ) ;