From 20e9842aea186f3cecefe961af729ff0dc8ed7b8 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sat, 19 Nov 2022 12:00:59 -0800 Subject: [PATCH] fix expected values for ratings and src tests Signed-off-by: Arthur Lu --- source/ReviewDetails.html | 2 +- source/assets/scripts/main.e2e.test.js | 32 ++++++++++++-------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/source/ReviewDetails.html b/source/ReviewDetails.html index 8c457aa..552c2f3 100644 --- a/source/ReviewDetails.html +++ b/source/ReviewDetails.html @@ -72,7 +72,7 @@ - + diff --git a/source/assets/scripts/main.e2e.test.js b/source/assets/scripts/main.e2e.test.js index 482f67c..48ec53c 100644 --- a/source/assets/scripts/main.e2e.test.js +++ b/source/assets/scripts/main.e2e.test.js @@ -43,7 +43,7 @@ describe("test App end to end", async () => { await page.waitForNavigation(); // Set text fields - await page.$eval("#mealImg", el => el.value = "sample src"); + await page.$eval("#mealImg", el => el.value = ""); 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"); @@ -72,7 +72,7 @@ describe("test App end to end", async () => { let imgSrc = await img.getProperty("src"); let imgAlt = await img.getProperty("alt"); // Check src and alt - assert.strictEqual(await imgSrc.jsonValue(), "sample src"); + assert.strictEqual(await imgSrc.jsonValue(), "http://localhost:8080/assets/images/icons/plate_with_cutlery.png"); assert.strictEqual(await imgAlt.jsonValue(), "sample alt"); // Get the title, comment, and restaurant @@ -98,7 +98,7 @@ describe("test App end to end", async () => { // Check stars let stars = await page.$("#d-rating"); let stars_src = await stars.getProperty("src"); - assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/5-star.svg"); + assert.strictEqual(await stars_src.jsonValue(), "http://localhost:8080/assets/images/icons/1-star.svg"); }); it("check home page", async () => { @@ -116,7 +116,7 @@ describe("test App end to end", async () => { let imgSrc = await img.getProperty("src"); let imgAlt = await img.getProperty("alt"); // Check src and alt - assert.strictEqual(await imgSrc.jsonValue(), "sample src"); + assert.strictEqual(await imgSrc.jsonValue(), "http://localhost:8080/assets/images/icons/plate_with_cutlery.png"); assert.strictEqual(await imgAlt.jsonValue(), "sample alt"); // Get the title, comment, and restaurant @@ -141,7 +141,7 @@ describe("test App end to end", async () => { // Check stars let stars = await shadowRoot.$("#a-rating"); let stars_src = await stars.getProperty("src"); - assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/5-star.svg"); + assert.strictEqual(await stars_src.jsonValue(), "http://localhost:8080/assets/images/icons/1-star.svg"); }); }); @@ -154,7 +154,6 @@ describe("test App end to end", async () => { it("check details page", async () => { // click review card let review_card = await page.$("review-card"); - console.log(JSON.stringify(review_card)); await review_card.click(); await page.waitForNavigation(); @@ -163,7 +162,7 @@ describe("test App end to end", async () => { let imgSrc = await img.getProperty("src"); let imgAlt = await img.getProperty("alt"); // Check src and alt - assert.strictEqual(await imgSrc.jsonValue(), "sample src"); + assert.strictEqual(await imgSrc.jsonValue(), "http://localhost:8080/assets/images/icons/plate_with_cutlery.png"); assert.strictEqual(await imgAlt.jsonValue(), "sample alt"); // Get the title, comment, and restaurant @@ -189,7 +188,7 @@ describe("test App end to end", async () => { // Check stars let stars = await page.$("#d-rating"); let stars_src = await stars.getProperty("src"); - assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/5-star.svg"); + assert.strictEqual(await stars_src.jsonValue(), "http://localhost:8080/assets/images/icons/1-star.svg"); }); it("check home page", async () => { @@ -207,7 +206,7 @@ describe("test App end to end", async () => { let imgSrc = await img.getProperty("src"); let imgAlt = await img.getProperty("alt"); // Check src and alt - assert.strictEqual(await imgSrc.jsonValue(), "sample src"); + assert.strictEqual(await imgSrc.jsonValue(), "http://localhost:8080/assets/images/icons/plate_with_cutlery.png"); assert.strictEqual(await imgAlt.jsonValue(), "sample alt"); // Get the title, comment, and restaurant @@ -232,7 +231,7 @@ describe("test App end to end", async () => { // Check stars let stars = await shadowRoot.$("#a-rating"); let stars_src = await stars.getProperty("src"); - assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/5-star.svg"); + assert.strictEqual(await stars_src.jsonValue(), "http://localhost:8080/assets/images/icons/1-star.svg"); }); }); @@ -242,7 +241,6 @@ describe("test App end to end", async () => { // Get the only review card and click it let review_card = await page.$("review-card"); - console.log(JSON.stringify(review_card)); await review_card.click(); await page.waitForNavigation(); @@ -251,7 +249,7 @@ describe("test App end to end", async () => { await update_btn.click(); // Set text fields - await page.$eval("#mealImg", el => el.value = "updated src"); + await page.$eval("#mealImg", el => el.value = ""); await page.$eval("#imgAlt", el => el.value = "updated alt"); await page.$eval("#mealName", el => el.value = "updated name"); await page.$eval("#comments", el => el.value = "updated comment"); @@ -272,7 +270,7 @@ describe("test App end to end", async () => { // Select a new rating of 5 stars let rating_select = await page.$("#s5-select"); - await rating_selects.click(); + await rating_select.click(); // Click the save button to save updates let save_btn = await page.$("#save-btn"); @@ -286,7 +284,7 @@ describe("test App end to end", async () => { let imgSrc = await img.getProperty("src"); let imgAlt = await img.getProperty("alt"); // Check src and alt - assert.strictEqual(await imgSrc.jsonValue(), "updated src"); + assert.strictEqual(await imgSrc.jsonValue(), "http://localhost:8080/assets/images/icons/plate_with_cutlery.png"); assert.strictEqual(await imgAlt.jsonValue(), "updated alt"); // Get the title, comment, and restaurant @@ -311,7 +309,7 @@ describe("test App end to end", async () => { // Check stars let stars = await page.$("#d-rating"); let stars_src = await stars.getProperty("src"); - assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/1-star.svg"); + assert.strictEqual(await stars_src.jsonValue(), "http://localhost:8080/assets/images/icons/5-star.svg"); }); it("check home page", async () => { @@ -329,7 +327,7 @@ describe("test App end to end", async () => { let imgSrc = await img.getProperty("src"); let imgAlt = await img.getProperty("alt"); // Check src and alt - assert.strictEqual(await imgSrc.jsonValue(), "updated src"); + assert.strictEqual(await imgSrc.jsonValue(), "http://localhost:8080/assets/images/icons/plate_with_cutlery.png"); assert.strictEqual(await imgAlt.jsonValue(), "updated alt"); // Get the title, comment, and restaurant @@ -354,7 +352,7 @@ describe("test App end to end", async () => { // Check stars let stars = await shadowRoot.$("#a-rating"); let stars_src = await stars.getProperty("src"); - assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/1-star.svg"); + assert.strictEqual(await stars_src.jsonValue(), "http://localhost:8080/assets/images/icons/5-star.svg"); }); });