mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2024-12-27 09:29:10 +00:00
populate part of add review,
various bug fixes, TODO: resolve issue with star selectors
This commit is contained in:
parent
82be561bfe
commit
cac2b0bf07
@ -12,7 +12,7 @@ describe("test App end to end", async () => {
|
|||||||
browser = await puppeteer.launch();
|
browser = await puppeteer.launch();
|
||||||
page = await browser.newPage();
|
page = await browser.newPage();
|
||||||
try{
|
try{
|
||||||
await page.goto("http://localhost:8080", {timeout: 1000});
|
await page.goto("http://localhost:8080", {timeout: 5000});
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log("❌ failed to connect to localhost webserver on port 8080");
|
console.log("❌ failed to connect to localhost webserver on port 8080");
|
||||||
@ -28,7 +28,32 @@ describe("test App end to end", async () => {
|
|||||||
|
|
||||||
describe("test create 1 new review", async () => {
|
describe("test create 1 new review", async () => {
|
||||||
it("create 1 new review", async () => {
|
it("create 1 new review", async () => {
|
||||||
|
// Click the button to show update form
|
||||||
|
let create_btn = await page.$("#create-btn");
|
||||||
|
await create_btn.click();
|
||||||
|
await page.waitForNavigation();
|
||||||
|
|
||||||
|
// Set text fields
|
||||||
|
await page.$eval("#mealImg", el => el.value = "sample src");
|
||||||
|
await page.$eval("#imgAlt", el => el.value = "sample alt");
|
||||||
|
await page.$eval("#mealName", el => el.value = "sample name");
|
||||||
|
await page.$eval("#comments", el => el.value = "sample comment");
|
||||||
|
await page.$eval("#restaurant", el => el.value = "sample restaurant");
|
||||||
|
|
||||||
|
// Get the button needed to add new tags
|
||||||
|
let tag_btn = await page.$("#tag-add-btn");
|
||||||
|
for(let i = 0; i < 5; i++){
|
||||||
|
await page.$eval("#tag-form", (el, value) => el.value = `tag ${value}`, i);
|
||||||
|
await tag_btn.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select a new rating of 1 star
|
||||||
|
let rating_select = await page.$("#s1");
|
||||||
|
rating_select.click();
|
||||||
|
|
||||||
|
// Click the save button to save updates
|
||||||
|
page.click("#save-btn");
|
||||||
|
await page.waitForNavigation();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("check details page", async () => {
|
it("check details page", async () => {
|
||||||
@ -36,7 +61,11 @@ describe("test App end to end", async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("check home page", async () => {
|
it("check home page", async () => {
|
||||||
|
// Click the button to return to the home page
|
||||||
|
let home_btn = await page.$("#home-btn");
|
||||||
|
home_btn.click();
|
||||||
|
|
||||||
|
await page.waitForNavigation();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -57,14 +86,15 @@ describe("test App end to end", async () => {
|
|||||||
describe("test update 1 review", async () => {
|
describe("test update 1 review", async () => {
|
||||||
|
|
||||||
it("update 1 review", async () => {
|
it("update 1 review", async () => {
|
||||||
|
|
||||||
// Get the only review card and click it
|
// Get the only review card and click it
|
||||||
let review_card = await page.$("review-card");
|
let review_card = await page.$("review-card");
|
||||||
|
console.log(JSON.stringify(review_card));
|
||||||
await review_card.click();
|
await review_card.click();
|
||||||
|
|
||||||
await page.waitForNavigation();
|
await page.waitForNavigation();
|
||||||
|
|
||||||
// Click the button to show update form
|
// Click the button to show update form
|
||||||
let update_btn = await page.$("update-btn");
|
let update_btn = await page.$("#update-btn");
|
||||||
await update_btn.click();
|
await update_btn.click();
|
||||||
|
|
||||||
// Set text fields
|
// Set text fields
|
||||||
@ -83,17 +113,17 @@ describe("test App end to end", async () => {
|
|||||||
// Get the button needed to add new tags
|
// Get the button needed to add new tags
|
||||||
let tag_btn = await page.$("#tag-add-btn");
|
let tag_btn = await page.$("#tag-add-btn");
|
||||||
for(let i = 0; i < 5; i++){
|
for(let i = 0; i < 5; i++){
|
||||||
await page.$eval("#tag-form", (el, value) => el.value = `tag -${value}`, i);
|
await page.$eval("#tag-form", (el, value) => el.value = `updated tag -${value}`, i);
|
||||||
tag_btn.click();
|
await tag_btn.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select a new rating of 1 star
|
// Select a new rating of 1 star
|
||||||
let rating_select = await page.$("#s1");
|
let rating_select = await page.$("#s1");
|
||||||
rating_select.click();
|
rating_select.click();
|
||||||
|
|
||||||
// Click the save button to save updates
|
// Click the save button to save updates
|
||||||
let save_btn = await page.$("#save-btn");
|
page.click("#save-btn");
|
||||||
save_btn.click();
|
await page.waitForNavigation();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("check details page", async () => {
|
it("check details page", async () => {
|
||||||
@ -121,7 +151,7 @@ describe("test App end to end", async () => {
|
|||||||
let tags = page.$(".tag");
|
let tags = page.$(".tag");
|
||||||
for(let i = 0; i < tags.length; i++){
|
for(let i = 0; i < tags.length; i++){
|
||||||
let tag_text = await tags[i].getProperty("innerText");
|
let tag_text = await tags[i].getProperty("innerText");
|
||||||
assert.strictEqual(await tag_text.jsonValue(), `tag -${i}`);
|
assert.strictEqual(await tag_text.jsonValue(), `updated tag -${i}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check stars
|
// Check stars
|
||||||
|
Loading…
Reference in New Issue
Block a user