How can the code be improved #10
Locked
AzimzadaMurad
started this conversation in
Show and tell
Replies: 4 comments 3 replies
-
Please, before my answer: See as example |
Beta Was this translation helpful? Give feedback.
2 replies
-
Please 🙏 make review my test case and code in Cypress. It should retrieve users
Test on Cypress describe('API', () => {
it('should retrieve users', () => {
cy.api('GET', 'https://reqres.in/api/users?page=2')
.then(({ status, body }) => {
expect(status).to.eq(200);
expect(body).to.have.all.keys(
'page',
'per_page',
'total',
'total_pages',
'data',
'support'
);
const { data: users, support } = body;
for (let user of users) {
expect(user.id).to.be.a('number');
expect(user.first_name).to.not.be.empty;
expect(user.last_name).to.not.be.empty;
expect(user.email).to.include('@');
expect(user.avatar).to.match(/^https/);
};
expect(support.url).to.match(/^https/);
expect(support.text).to.not.be.empty;
});
});
}); |
Beta Was this translation helpful? Give feedback.
0 replies
-
Please 🙏 make review my code in Cypress |
Beta Was this translation helpful? Give feedback.
1 reply
-
Great job. Thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Please 🙏 make review my test case and code in Cypress.
It should retrieve users
Test on Cypress ~/cypress/integration/users-api.spec.js
Beta Was this translation helpful? Give feedback.
All reactions