prettier style fixes

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu
2022-12-03 02:02:52 +00:00
parent dbbd14399e
commit 793e7891b3
70 changed files with 2123 additions and 1849 deletions

View File

@@ -1,30 +1,27 @@
import {strict as assert} from "node:assert";
import {describe, it, before, after} from "mocha";
import { strict as assert } from "node:assert";
import { describe, it, before, after } from "mocha";
import puppeteer from "puppeteer-core";
import {setReviewForm, checkCorrectness} from "./appTestHelpers.js";
import { setReviewForm, checkCorrectness } from "./appTestHelpers.js";
describe("test App end to end", async () => {
let browser;
let page;
before(async () => {
let root;
try {
root = process.getuid() == 0;
}
catch (error) {
root = process.getuid() == 0;
} catch (error) {
root = false;
}
//browser = await puppeteer.launch({headless: false, slowMo: 250, args: root ? ['--no-sandbox'] : undefined});
browser = await puppeteer.launch({args: root ? ["--no-sandbox"] : undefined});
browser = await puppeteer.launch({ args: root ? ["--no-sandbox"] : undefined });
page = await browser.newPage();
try{
await page.goto("http://localhost:8080", {timeout: 2000});
try {
await page.goto("http://localhost:8080", { timeout: 2000 });
await console.log(`✔ connected to localhost webserver as ${root ? "root" : "user"}`);
}
catch (error) {
} catch (error) {
await console.log("❌ failed to connect to localhost webserver on port 8080");
}
});
@@ -36,7 +33,6 @@ describe("test App end to end", async () => {
});
describe("test CRUD on simple inputs and default image", () => {
describe("test create 1 new review", async () => {
it("create 1 new review", async () => {
// Click the button to create a new review
@@ -50,7 +46,7 @@ describe("test App end to end", async () => {
comments: "sample comment",
restaurant: "sample restaurant",
tags: ["tag 0", "tag 1", "tag 2", "tag 3", "tag 4"],
rating: 1
rating: 1,
};
await setReviewForm(page, review);
@@ -68,11 +64,11 @@ describe("test App end to end", async () => {
comments: "sample comment",
restaurant: "sample restaurant",
tags: ["tag 0", "tag 1", "tag 2", "tag 3", "tag 4"],
rating: "http://localhost:8080/assets/images/1-star.svg"
rating: "http://localhost:8080/assets/images/1-star.svg",
};
await checkCorrectness(page, "d", expected);
});
it("check home page", async () => {
// Click the button to return to the home page
let home_btn = await page.$("#home-btn");
@@ -89,7 +85,7 @@ describe("test App end to end", async () => {
comments: "sample comment",
restaurant: "sample restaurant",
tags: ["tag 0", "tag 1", "tag 2", "tag 3", "tag 4"],
rating: "http://localhost:8080/assets/images/1-star.svg"
rating: "http://localhost:8080/assets/images/1-star.svg",
};
await checkCorrectness(shadowRoot, "a", expected);
});
@@ -114,7 +110,7 @@ describe("test App end to end", async () => {
comments: "sample comment",
restaurant: "sample restaurant",
tags: ["tag 0", "tag 1", "tag 2", "tag 3", "tag 4"],
rating: "http://localhost:8080/assets/images/1-star.svg"
rating: "http://localhost:8080/assets/images/1-star.svg",
};
await checkCorrectness(page, "d", expected);
});
@@ -136,16 +132,14 @@ describe("test App end to end", async () => {
comments: "sample comment",
restaurant: "sample restaurant",
tags: ["tag 0", "tag 1", "tag 2", "tag 3", "tag 4"],
rating: "http://localhost:8080/assets/images/1-star.svg"
rating: "http://localhost:8080/assets/images/1-star.svg",
};
await checkCorrectness(shadowRoot, "a", expected);
});
});
describe("test update 1 review", async () => {
it("update 1 review", async () => {
// Get the only review card and click it
let review_card = await page.$("review-card");
await review_card.click();
@@ -161,7 +155,7 @@ describe("test App end to end", async () => {
comments: "updated comment",
restaurant: "updated restaurant",
tags: ["tag -0", "tag -1", "tag -2", "tag -3", "tag -4", "tag -5"],
rating: 5
rating: 5,
};
await setReviewForm(page, review);
@@ -179,7 +173,7 @@ describe("test App end to end", async () => {
comments: "updated comment",
restaurant: "updated restaurant",
tags: ["tag -0", "tag -1", "tag -2", "tag -3", "tag -4", "tag -5"],
rating: "http://localhost:8080/assets/images/5-star.svg"
rating: "http://localhost:8080/assets/images/5-star.svg",
};
await checkCorrectness(page, "d", expected);
});
@@ -201,11 +195,10 @@ describe("test App end to end", async () => {
comments: "updated comment",
restaurant: "updated restaurant",
tags: ["tag -0", "tag -1", "tag -2", "tag -3", "tag -4", "tag -5"],
rating: "http://localhost:8080/assets/images/5-star.svg"
rating: "http://localhost:8080/assets/images/5-star.svg",
};
await checkCorrectness(shadowRoot, "a", expected);
});
});
describe("test delete 1 review", async () => {
@@ -215,7 +208,7 @@ describe("test App end to end", async () => {
await review_card.click();
await page.waitForNavigation();
page.on("dialog", async dialog => {
page.on("dialog", async (dialog) => {
console.log(dialog.message());
await dialog.accept();
});
@@ -227,4 +220,4 @@ describe("test App end to end", async () => {
await page.close();
await browser.close();
});
});
});