cypress
This commit is contained in:
21
cypress/e2e/Pokedemo/pokemon.cy.js
Normal file
21
cypress/e2e/Pokedemo/pokemon.cy.js
Normal file
@@ -0,0 +1,21 @@
|
||||
describe('Pokemon API Tests', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('http://localhost:4200')
|
||||
})
|
||||
|
||||
it('should get the database', () => {
|
||||
/*https://docs.cypress.io/api/commands/request*/
|
||||
cy.request('GET', 'https://pokeapi.co/api/v2/pokemon')
|
||||
.then((response) => {
|
||||
// 200 = OK
|
||||
expect(response.status).to.eq(200)
|
||||
const pokeData = response.body
|
||||
expect(pokeData).to.have.property('count')
|
||||
expect(pokeData.count).to.be.a('number')
|
||||
expect(pokeData.next).to.be.a('string')
|
||||
expect(pokeData.results[0]).to.have.property('name')
|
||||
expect(pokeData.results[0].name).to.eq('bulbasaur')
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user