Created
May 28, 2018 19:55
-
-
Save RomainGoncalves/e3c95bf1d4067ba5ae5bd51ab0381918 to your computer and use it in GitHub Desktop.
Doing multiple API request with Cypress
This file contains hidden or 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
describe('API Requests', () => { | |
it('should get successful response', () => { | |
cy.request('GET', 'https://swapi.co/api/films/1/') | |
.its('body.title').should('contain', 'A New Hope'); | |
}); | |
it('should get successful response', () => { | |
cy.request('GET', 'https://swapi.co/api/films/1/') | |
.then(response => { | |
response.body.planets.forEach(planet => | |
cy.request('GET', planet) | |
.its('body.gravity').should('contain', '1 standard'), | |
); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment