update e2e test layout

This commit is contained in:
Arthur Lu 2022-11-18 12:34:59 -08:00
parent 6c00246e2d
commit 5f84e700d1
2 changed files with 158 additions and 136 deletions

View File

@ -13,11 +13,11 @@
"devDependencies": { "devDependencies": {
"eslint": "^8.27.0", "eslint": "^8.27.0",
"htmlhint": "1.1.4", "htmlhint": "1.1.4",
"http-server": "",
"mocha": "10", "mocha": "10",
"mock-local-storage": "^1.1.23", "mock-local-storage": "^1.1.23",
"puppeteer": "^18.2.1",
"stylelint": "14.14.1", "stylelint": "14.14.1",
"stylelint-config-standard": "^29.0.0", "stylelint-config-standard": "^29.0.0"
"puppeteer": "18",
"http-server": ""
} }
} }

View File

@ -20,27 +20,43 @@ describe("test App end to end", async () => {
} }
}); });
describe("test simple properties", async () => {
it("page should have correct title", async () => { it("page should have correct title", async () => {
assert.strictEqual(await page.title(), "Food Journal"); assert.strictEqual(await page.title(), "Food Journal");
}); });
});
it("test create review functionality on details page", async () => { describe("test create 1 new review", async () => {
it("create 1 new review", async () => {
}); });
it("test create review functionality on home page", async () => { it("check details page", async () => {
}); });
it("test read review functionality on details page", async () => { it("check home page", async () => {
});
});
describe("test read 1 review after refresh", async () => {
it("refresh page", async () => {
}); });
it("test read review functionality on home page", async () => { it("check details page", async () => {
}); });
it("test update review functionality on details page", async () => { it("check home page", async () => {
});
});
describe("test 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");
await review_card.click(); await review_card.click();
@ -76,7 +92,9 @@ describe("test App end to end", async () => {
// Click the save button to save updates // Click the save button to save updates
let save_btn = await page.$("#save-btn"); let save_btn = await page.$("#save-btn");
save_btn.click(); save_btn.click();
});
it("check details page", async () => {
// Get the review image and check src and alt // Get the review image and check src and alt
let img = await page.$("#d-mealImg"); let img = await page.$("#d-mealImg");
let imgSrc = await img.getProperty("src"); let imgSrc = await img.getProperty("src");
@ -110,7 +128,7 @@ describe("test App end to end", async () => {
assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/1-star.svg"); assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/1-star.svg");
}); });
it("test update review funcionality on home page", async () => { it("check home page", async () => {
// Click the button to return to the home page // Click the button to return to the home page
let home_btn = await page.$("#home-btn"); let home_btn = await page.$("#home-btn");
home_btn.click(); home_btn.click();
@ -152,7 +170,10 @@ describe("test App end to end", async () => {
assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/1-star.svg"); assert.strictEqual(await stars_src.jsonValue(), "./assets/images/icons/1-star.svg");
}); });
it("test delete review functionality", async () => { });
describe("test delete 1 review", () => {
it("delete 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");
await review_card.click(); await review_card.click();
@ -165,6 +186,7 @@ describe("test App end to end", async () => {
review_card = await page.$("#review-card"); review_card = await page.$("#review-card");
assert.strictEqual(review_card, null); assert.strictEqual(review_card, null);
}); });
});
after(async () => { after(async () => {
await page.close(); await page.close();