Created
May 28, 2018 21:17
-
-
Save RomainGoncalves/bd48bc85ab788aaa60a596ea11e5552b 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
describe('Fetch Movies', () => { | |
it('should contain all the expected attributes', () => { | |
cy.fetchFilm(1).as('firstMovie'); | |
const toTest = [ | |
{ target: 'body.title', value: 'A New Hope', should: 'contain' }, | |
{ target: 'body.director', value: 'George Lucas', should: 'contain' }, | |
// Check for at least 1 producer | |
{ target: 'body.producer', value: 'Rick McCallum', should: 'contain' }, | |
// We can also check for any assertion that Mocha/Chai provides | |
{ target: 'body.planets', value: 'array', should: 'to.be.a' }, | |
{ target: 'body.planets', value: 3, should: 'length' }, | |
]; | |
toTest.forEach(test => cy.get('@firstMovie').its(test.target).should(test.should, test.value)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment