Created
March 25, 2020 16:10
-
-
Save bmitchinson/2c38e47b0dece42e434962e760d6e49e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { baseURL } from '../../../cypress'; | |
describe('API Testing with Cypress', () => { | |
beforeEach(() => { | |
cy.request(${baseURL}/25).as('pikachu'); | |
}); | |
it('Validate the header', () => { | |
cy.get('@pikachu') | |
.its('headers') | |
.its('content-type') | |
.should('include', 'application/json; charset=utf-8'); | |
}); | |
it('Validate the status code', () => { | |
cy.get('@pikachu') | |
.its('status') | |
.should('equal', 200); | |
}); | |
it('Validate the pokemon\'s name', () => { | |
cy.get('@pikachu') | |
.its('body') | |
.should('include', { name: 'pikachu' }); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment