63 lines
2.2 KiB
JavaScript
63 lines
2.2 KiB
JavaScript
const { chromium } = require(
|
|
require.resolve("playwright", {
|
|
paths: [require("path").resolve(__dirname, "../../../../job-tracker-ui")],
|
|
}),
|
|
);
|
|
const assert = require("assert");
|
|
const fs = require("fs");
|
|
(async () => {
|
|
const b = await chromium.launch();
|
|
const p = await b.newPage();
|
|
let checks = [];
|
|
for (const c of "ABCDE") {
|
|
await p.goto(
|
|
`${process.env.JOBJAKT_GALLERY_URL || "http://127.0.0.1:4327"}/?concept=${c}&screen=discover`,
|
|
);
|
|
await p.selectOption("#country", "Norway");
|
|
assert.equal(await p.locator("#jobResults .row").count(), 2);
|
|
await p.fill("#search", "Electrician");
|
|
assert.equal(await p.locator("#jobResults .row").count(), 1);
|
|
await p.selectOption("#screen", "detail");
|
|
await p.locator("[data-action=save]").click();
|
|
assert(await p.locator(".toast").isVisible());
|
|
await p.locator("[data-action=apply]").click();
|
|
await p.locator("[data-action=follow]").click();
|
|
assert(
|
|
(await p.locator("main").innerText()).includes(
|
|
"Follow up with Fjord Community Health",
|
|
),
|
|
);
|
|
await p.selectOption("#screen", "cv");
|
|
await p.fill("#summary", "Edited prototype document summary");
|
|
assert.equal(
|
|
await p.locator("#summaryPreview").innerText(),
|
|
"Edited prototype document summary",
|
|
);
|
|
await p.selectOption("#screen", "profile");
|
|
assert.notEqual(
|
|
await p.locator("#summary").inputValue(),
|
|
"Edited prototype document summary",
|
|
);
|
|
await p.selectOption("#screen", "letter");
|
|
await p.fill("#letter", "Synthetic review letter");
|
|
assert.equal(
|
|
await p.locator("#letterPreview").innerText(),
|
|
"Synthetic review letter",
|
|
);
|
|
await p.selectOption("#lang", "nb");
|
|
assert.equal(await p.locator("html").getAttribute("lang"), "nb-NO");
|
|
await p.locator("[data-action=theme]").click();
|
|
assert((await p.locator("body").getAttribute("class")).includes("dark"));
|
|
checks.push({ concept: c, checks: 8, status: "PASS" });
|
|
}
|
|
fs.writeFileSync(
|
|
__dirname + "/interactions.json",
|
|
JSON.stringify(checks, null, 2),
|
|
);
|
|
console.log(JSON.stringify(checks));
|
|
await b.close();
|
|
})().catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|