diff --git a/create-new-post.cy.js b/create-new-post.cy.js new file mode 100644 index 0000000..278949b --- /dev/null +++ b/create-new-post.cy.js @@ -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'); + }); + }); +}); diff --git a/delete.cy.js b/delete.cy.js new file mode 100644 index 0000000..cd05772 --- /dev/null +++ b/delete.cy.js @@ -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); + }); + }); +}); + + diff --git a/get-posts-list.cy.js b/get-posts-list.cy.js new file mode 100644 index 0000000..e68a047 --- /dev/null +++ b/get-posts-list.cy.js @@ -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); + }); + }); +}); + diff --git a/post-by-id.cy.js b/post-by-id.cy.js new file mode 100644 index 0000000..c1b0f33 --- /dev/null +++ b/post-by-id.cy.js @@ -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); + }); + }); +}); diff --git a/update-post-by-id.cy.js b/update-post-by-id.cy.js new file mode 100644 index 0000000..c94aa5c --- /dev/null +++ b/update-post-by-id.cy.js @@ -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'); + }); + }); +}); + +