Skip to content

Commit 9d2c007

Browse files
committed
5316: inject slides to logintest
1 parent 203b7cd commit 9d2c007

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

assets/tests/admin/admin-form.spec.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,6 @@ test.describe("Admin slide values depending on other values", () => {
276276
});
277277

278278
test.beforeEach(async ({ page }) => {
279-
await page.goto("/admin/slides/list");
280-
281-
await page.route("**/token", async (route) => {
282-
await route.fulfill({ json: tokenAdminJson });
283-
});
284-
285-
await page.route("**/slides*", async (route) => {
286-
await route.fulfill({ json: slidesJson1 });
287-
});
288-
289279
await fulfillDataRoute(page, "**/templates*", onlyImageTextListJson);
290280

291281
await fulfillDataRoute(
@@ -299,12 +289,8 @@ test.describe("Admin slide values depending on other values", () => {
299289
"**/v2/slides/00015Y0ZVC18N407JD07SM0YCF",
300290
slideJson,
301291
);
302-
303292
await fulfillEmptyRoutes(page, ["**/playlists*", "**/themes*"]);
304-
305-
await page.getByLabel("Email").fill("[email protected]");
306-
await page.getByLabel("Kodeord").fill("password");
307-
await page.locator("#login").click();
293+
await loginTest(page, slidesJson1);
308294

309295
await Promise.all([
310296
page.waitForURL("**/slide/edit/*"),

assets/tests/admin/test-helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ const fulfillDataRoute = async (page, routePattern, data, status) => {
3838
});
3939
};
4040

41-
const loginTest = async (page) => {
41+
const loginTest = async (page, slides = null) => {
4242
await page.goto("/admin/slides/list");
4343

4444
await page.route("**/token", async (route) => {
4545
await route.fulfill({ json: tokenAdminJson });
4646
});
4747

4848
await page.route("**/slides*", async (route) => {
49-
await route.fulfill({ json: emptyJson });
49+
await route.fulfill({ json: slides ?? emptyJson });
5050
});
5151

5252
await expect(page).toHaveTitle(/OS2Display Admin/);

0 commit comments

Comments
 (0)