Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions create-new-post.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe('Create New Post API Test API', () => {
it('should create new post', () => {
cy.api('POST', 'https://jsonplaceholder.typicode.com/posts', {
title: 'foo',
body: 'bar',
userId: 1,
}).should((response) => {
expect(response.status).to.eq(201);
expect(response.body).to.have.property('id');
});
});
});
10 changes: 10 additions & 0 deletions delete.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe('Delete Post by ID API Test API', () => {
it('should delete post by id', () => {
cy.api('DELETE', 'https://jsonplaceholder.typicode.com/posts/1')
.should((response) => {
expect(response.status).to.eq(200);
});
});
});


10 changes: 10 additions & 0 deletions get-posts-list.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe('Get Posts List API Test API', () => {
it('should get posts list', () => {
cy.api('GET', 'https://jsonplaceholder.typicode.com/posts')
.should((response) => {
expect(response.status).to.eq(200);
expect(response.body.length).to.be.greaterThan(0);
});
});
});

9 changes: 9 additions & 0 deletions post-by-id.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Get Post by ID API Test API', () => {
it('should get post by id', () => {
cy.api('GET', 'https://jsonplaceholder.typicode.com/posts/1')
.should((response) => {
expect(response.status).to.eq(200);
expect(response.body).to.have.property('id', 1);
});
});
});
15 changes: 15 additions & 0 deletions update-post-by-id.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('Update Post by ID API Test API', () => {
it('should update post by id', () => {
cy.api('PUT', 'https://jsonplaceholder.typicode.com/posts/1', {
id: 1,
title: 'foo',
body: 'bar',
userId: 1,
}).should((response) => {
expect(response.status).to.eq(200);
expect(response.body).to.have.property('title', 'foo');
});
});
});