Created
May 28, 2018 21:01
-
-
Save RomainGoncalves/522dd15c4e94a075b6b470f2881b67ef to your computer and use it in GitHub Desktop.
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
// cypress/support/commands.js | |
Cypress.Commands.add('fetchFilm', movieIndex => { | |
cy.request('GET', `https://swapi.co/api/films/${movieIndex}/`); | |
}); | |
// integration/api/fetchMovies.js | |
describe('API Requests', () => { | |
it('should get successful response', () => { | |
cy.fetchFilm(1).as('firstMovie'); | |
cy.get('@firstMovie').its('body.title').should('contain', 'A New Hope'); | |
cy.get('@firstMovie').its('body.director').should('contain', 'George Lucas'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment