added for loops for multiple tests

This commit is contained in:
Marc 2022-11-20 14:01:48 -08:00
parent 5d331c3800
commit f2edc4dc6a

View File

@ -40,11 +40,8 @@ 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 10 new reviews", async () => { describe("test create 10 new reviews", async () => {
for (var i=0; i < 10; i++) { 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();
@ -103,15 +100,11 @@ describe("test App end to end", async () => {
} }
await checkCorrectness(shadowRoot, "a", expected); await checkCorrectness(shadowRoot, "a", expected);
}); });
} }
}); });
describe("test read 10 reviews after refresh", async () => { describe("test read 10 reviews after refresh", async () => {
for (var i=0; i < 10; i++) { 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"] });
@ -158,17 +151,12 @@ describe("test App end to end", async () => {
} }
await checkCorrectness(shadowRoot, "a", expected); await checkCorrectness(shadowRoot, "a", expected);
}); });
} }
}); });
describe("test update 10 reviews", async () => { describe("test update 10 reviews", async () => {
for (var i=0; i < 10; i++) { for (var i=0; i < 10; i++) {
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");
await review_card.click(); await review_card.click();
@ -231,15 +219,11 @@ describe("test App end to end", async () => {
} }
await checkCorrectness(shadowRoot, "a", expected); await checkCorrectness(shadowRoot, "a", expected);
}); });
} }
}); });
describe("test delete 10 reviews", async () => { describe("test delete 10 reviews", async () => {
for (var i=0; i < 10; i++) { 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");
@ -260,10 +244,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);
}); });
} }
}); });
}); });
after(async () => { after(async () => {