Skip to content

Instantly share code, notes, and snippets.

@ArCiGo
Last active January 29, 2023 23:51
Show Gist options
  • Save ArCiGo/51bae3e3d8d946e3ba35d1af199a8307 to your computer and use it in GitHub Desktop.
Save ArCiGo/51bae3e3d8d946e3ba35d1af199a8307 to your computer and use it in GitHub Desktop.
describe('Banking mock server API tests', () => {
it('should post a user successfully', () => {
cy.fixture('requests/usersPostRequest').then((bodyRequest) => {
cy.request('POST', '/users', { bodyRequest }).then((response) => {
expect(response.isOkStatusCode).to.be.true;
expect(response.status).to.be.eq(200);
cy.fixture('responses/usersPostResponse').should('deep.equal', response.body);
/**
* In my sample, once the user is created, the system
* automatically assigns him/her an account.
*/
cy.wrap(response.body.account).as('account');
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment