added for loops to tests

This commit is contained in:
Marc 2022-11-20 13:56:27 -08:00
parent 3b1b0cfd57
commit 5d331c3800

View File

@ -39,8 +39,12 @@ describe("test App end to end", async () => {
describe("test CRUD on simple inputs and default image", () => { describe("test CRUD on simple inputs and default image", () => {
describe("test create 1 new review", async () => { describe("test create 10 new reviews", async () => {
for (var i=0; i < 10; i++) {
it("create 1 new review", async () => { it("create 1 new review", async () => {
// Click the button to create a new review // Click the button to create a new review
let create_btn = await page.$("#create-btn"); let create_btn = await page.$("#create-btn");
await create_btn.click(); await create_btn.click();
@ -55,6 +59,7 @@ describe("test App end to end", async () => {
tags: ["tag 0", "tag 1", "tag 2", "tag 3", "tag 4"], tags: ["tag 0", "tag 1", "tag 2", "tag 3", "tag 4"],
rating: 1 rating: 1
} }
await setReviewForm(page, review); await setReviewForm(page, review);
// Click the save button to save updates // Click the save button to save updates
@ -98,9 +103,15 @@ describe("test App end to end", async () => {
} }
await checkCorrectness(shadowRoot, "a", expected); await checkCorrectness(shadowRoot, "a", expected);
}); });
}
}); });
describe("test read 1 review after refresh", async () => { describe("test read 10 reviews after refresh", async () => {
for (var i=0; i < 10; i++) {
it("refresh page", async () => { it("refresh page", async () => {
// Reload the page // Reload the page
await page.reload({ waitUntil: ["networkidle0", "domcontentloaded"] }); await page.reload({ waitUntil: ["networkidle0", "domcontentloaded"] });
@ -147,9 +158,14 @@ describe("test App end to end", async () => {
} }
await checkCorrectness(shadowRoot, "a", expected); await checkCorrectness(shadowRoot, "a", expected);
}); });
}
}); });
describe("test update 1 review", async () => { describe("test update 10 reviews", async () => {
for (var i=0; i < 10; i++) {
it("update 1 review", async () => { it("update 1 review", async () => {
@ -216,9 +232,14 @@ describe("test App end to end", async () => {
await checkCorrectness(shadowRoot, "a", expected); await checkCorrectness(shadowRoot, "a", expected);
}); });
}
}); });
describe("test delete 1 review", async () => { describe("test delete 10 reviews", async () => {
for (var i=0; i < 10; i++) {
it("delete 1 review", async () => { 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");
@ -239,6 +260,8 @@ 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);
}); });
}
}); });
}); });