-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test(bookmarks): ✅ added test and new api for get bookmark by id * test(meta data): 🚧 WIP * test(meta data): ✅ added all the meta data test cases * test(meta data): 🐛 fixed TS issues
- Loading branch information
1 parent
e40213c
commit ca01388
Showing
13 changed files
with
9,727 additions
and
1,927 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//@ts-nocheck | ||
|
||
describe("Meta data testing", () => { | ||
beforeEach(() => { | ||
// cy.visit("/all-bookmarks"); | ||
cy.visit("/login"); | ||
}); | ||
|
||
it("bookmark meta_data check", async () => { | ||
cy.login( | ||
Cypress.env("test_email") as string, | ||
Cypress.env("test_password") as string, | ||
); | ||
|
||
cy.request(`/api/bookmark/add-bookmark-min-data`, { | ||
category_id: 0, | ||
update_access: true, | ||
url: "https://unsplash.com/photos/a-city-street-with-a-lot-of-tall-buildings-badrIRxBqmk", | ||
}).as("addRequest"); | ||
|
||
let bookmarkId; | ||
|
||
cy.get("@addRequest")?.then((addBookmarkData) => { | ||
bookmarkId = addBookmarkData?.body?.data?.[0]?.id; | ||
|
||
// check meta data | ||
|
||
cy.reload(); | ||
|
||
cy.wait(40000); | ||
|
||
cy.request(`/api/v1/bookmarks/get/fetch-by-id`, { | ||
data: { | ||
id: addBookmarkData?.body?.data?.[0]?.id, | ||
}, | ||
}).as("fetchRequest"); | ||
|
||
cy.get("@fetchRequest").then((data) => { | ||
expect(data?.body?.data?.[0]?.meta_data).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.ocr).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.img_caption).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.ogImgBlurUrl).to.not.be.null; | ||
}); | ||
|
||
// delete the bookmark | ||
cy.request(`/api/bookmark/delete-bookmark`, { | ||
data: { | ||
deleteData: [ | ||
{ | ||
id: addBookmarkData?.body?.data?.[0]?.id, | ||
ogImage: addBookmarkData?.body?.data?.[0]?.ogImage, | ||
title: addBookmarkData?.body?.data?.[0]?.title, | ||
url: addBookmarkData?.body?.data?.[0]?.url, | ||
}, | ||
], | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
//@ts-nocheck | ||
|
||
describe("Meta data testing", () => { | ||
beforeEach(() => { | ||
// cy.visit("/all-bookmarks"); | ||
cy.visit("/login"); | ||
}); | ||
|
||
it("file upload check", async () => { | ||
cy.wait(3000); | ||
|
||
cy.login( | ||
Cypress.env("test_email") as string, | ||
Cypress.env("test_password") as string, | ||
); | ||
|
||
const headers = { | ||
Accept: "application/json", | ||
"Content-Type": "application/json", | ||
}; | ||
cy.request({ | ||
method: "POST", | ||
url: "/api/v1/tests/file/post/upload", // Ensure this URL is correct | ||
body: { | ||
name: "image.png", | ||
type: "image/png", | ||
uploadFileNamePath: "m05eqwhx-image.png", | ||
}, | ||
headers: headers, | ||
}).as("uploadRequest"); | ||
|
||
cy.get("@uploadRequest")?.then((addBookmarkData) => { | ||
bookmarkId = addBookmarkData?.body?.data?.[0]?.id; | ||
|
||
// check meta data | ||
|
||
cy.reload(); | ||
|
||
cy.wait(60000); | ||
|
||
cy.reload(); | ||
|
||
cy.wait(2000); | ||
|
||
cy.request(`/api/v1/bookmarks/get/fetch-by-id`, { | ||
data: { | ||
id: addBookmarkData?.body?.data?.[0]?.id, | ||
}, | ||
}).as("fetchRequest"); | ||
|
||
cy.get("@fetchRequest").then((data) => { | ||
cy.wait(1000); | ||
|
||
expect(data?.body?.data?.[0]?.meta_data).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.ocr).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.img_caption).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.ogImgBlurUrl).to.not.be.null; | ||
}); | ||
|
||
// delete the bookmark | ||
|
||
cy.request("DELETE", `/api/v1/bookmarks/delete/non-cascade`, { | ||
data: { | ||
id: addBookmarkData?.body?.data?.[0]?.id, | ||
}, | ||
}).as("deleteRequest"); | ||
|
||
cy.get("@deleteRequest").then((data) => { | ||
cy.wait(1000); | ||
|
||
expect(data.status).to.eq(200); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
//@ts-nocheck | ||
|
||
describe("Meta data testing", () => { | ||
beforeEach(() => { | ||
// cy.visit("/all-bookmarks"); | ||
cy.visit("/login"); | ||
}); | ||
|
||
it("tweet upload check", async () => { | ||
cy.wait(3000); | ||
|
||
cy.login( | ||
Cypress.env("test_email") as string, | ||
Cypress.env("test_password") as string, | ||
); | ||
|
||
// add the tweet | ||
cy.request("POST", `/api/v1/twitter/sync`, { | ||
data: [ | ||
{ | ||
description: "test tweet description", | ||
ogImage: "https://pbs.twimg.com/media/GVRv2bGWcAA--aC.jpg", | ||
title: "test title", | ||
type: "tweet", | ||
url: `https://x.com/passportprofit/status/${Math.floor( | ||
Math.random() * 1000000000, | ||
)}`, // we are generating random number , as the duplicates are removed in the sync api | ||
meta_data: { | ||
twitter_avatar_url: "test url", | ||
}, | ||
inserted_at: "2024-08-22T14:30:00Z", | ||
sort_index: "89", | ||
}, | ||
], | ||
}).as("addRequest"); | ||
|
||
let bookmarkId; | ||
|
||
cy.get("@addRequest")?.then((addBookmarkData) => { | ||
bookmarkId = addBookmarkData?.body?.data?.[0]?.id; | ||
|
||
// check meta data | ||
|
||
cy.reload(); | ||
|
||
cy.wait(40000); | ||
|
||
cy.request(`/api/v1/bookmarks/get/fetch-by-id`, { | ||
data: { | ||
id: addBookmarkData?.body?.data?.[0]?.id, | ||
}, | ||
}).as("fetchRequest"); | ||
|
||
cy.get("@fetchRequest").then((data) => { | ||
expect(data?.body?.data?.[0]?.meta_data).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.ocr).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.img_caption).to.not.be.null; | ||
expect(data?.body?.data?.[0]?.meta_data?.ogImgBlurUrl).to.not.be.null; | ||
}); | ||
|
||
// delete the bookmark | ||
cy.request(`/api/bookmark/delete-bookmark`, { | ||
data: { | ||
deleteData: [ | ||
{ | ||
id: addBookmarkData?.body?.data?.[0]?.id, | ||
ogImage: addBookmarkData?.body?.data?.[0]?.ogImage, | ||
title: addBookmarkData?.body?.data?.[0]?.title, | ||
url: addBookmarkData?.body?.data?.[0]?.url, | ||
}, | ||
], | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.