Last active
February 8, 2019 09:01
-
-
Save ronderksen/0219f3ab06f9febaf3bd951f76c58576 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('Page: list of Star Wars characters', () => { | |
const characters = [ | |
{ | |
name: 'Chewbacca', | |
species: 'Wookie', | |
}, | |
{ | |
name: 'Luke Skywalker', | |
species: 'Human', | |
} | |
]; | |
beforeEach(() => { | |
cy.mockGraphQL((operationName) => { | |
switch (operationName) { | |
case 'GET_CHARACTER_LIST': | |
return { | |
test(variables) { | |
expect(variables.faction).toEqual('Rebels'); | |
}, | |
mockResult: { | |
data: { | |
getCharacterList: characters | |
} | |
} | |
}; | |
default: | |
return {}; | |
} | |
}); | |
}); | |
it('should show a list of Rebel characters', () => { | |
cy.visit('/characters/rebels') | |
.get('li.character') | |
.each((li, idx) => cy | |
.wrap(li) | |
.find('span.name') | |
.should('contain', characters[idx].name) | |
.find('span.species') | |
.should('contain', characters[idx].species) | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment