Skip to content

Commit bb7976e

Browse files
committed
4565: Fixed remaining tests
1 parent a27704f commit bb7976e

13 files changed

+709
-952
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test.describe("Campaign pages work", () => {
88
});
99

1010
test.beforeEach(async ({ page }) => {
11-
await loginTest({ page });
11+
await loginTest(page);
1212

1313
await fulfillEmptyRoutes(page, ["**/playlists*", "**/screens*", "**/screen-groups*"]);
1414

assets/tests/admin/admin-feed-sources.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test.describe("feed sources", () => {
1313
});
1414

1515
test.beforeEach(async ({ page }) => {
16-
await loginTest({ page });
16+
await loginTest(page);
1717

1818
await fulfillDataRoute(page, "**/feed-sources*", feedSourcesJson);
1919

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ test.describe("Login works", () => {
1818
});
1919

2020
test("Login one tenant works", async ({ page }) => {
21-
await page.goto("/admin/playlists/list");
21+
await page.goto("/admin/playlist/list");
2222

23-
await fulfillEmptyRoutes(page, ['"**/playlists*"']);
23+
await fulfillEmptyRoutes(page, ["**/playlists*"]);
2424

2525
await fulfillDataRoute(page, "**/token", tokenAdminJson);
2626

@@ -29,7 +29,9 @@ test.describe("Login works", () => {
2929
});
3030

3131
test("Login three tenant works", async ({ page }) => {
32-
await page.goto("/admin/group/list");
32+
await page.goto("/admin/playlist/list");
33+
34+
await fulfillEmptyRoutes(page, ["**/playlists*"]);
3335

3436
await fulfillDataRoute(page, "**/token", tokenTenantsJson);
3537

@@ -40,9 +42,12 @@ test.describe("Login works", () => {
4042
});
4143

4244
test("Login with tenant that has role editor", async ({ page }) => {
43-
await page.goto("/admin/playlists/list");
45+
await page.goto("/admin/playlist/list");
46+
47+
await fulfillEmptyRoutes(page, ["**/playlists*"]);
4448

4549
await fulfillDataRoute(page, "**/token", tokenEditorJson);
50+
4651
await page.locator("#login").click();
4752

4853
await expect(page.locator(".name")).toHaveText("John Doe");
@@ -57,6 +62,7 @@ test.describe("Login works", () => {
5762
await page.goto("/admin/shared/list");
5863

5964
await fulfillDataRoute(page, "**/token", tokenEditorJson);
65+
6066
await page.locator("#login").click();
6167

6268
await expect(page.locator("main").locator("div")).toHaveText(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test.describe("media list tests", () => {
88
});
99

1010
test.beforeEach(async ({ page }) => {
11-
await loginTest({ page });
11+
await loginTest(page);
1212

1313
await fulfillDataRoute(page, "**/media*", mediaListJson);
1414

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test.describe("Playlist create tests", () => {
88
});
99

1010
test.beforeEach(async ({ page }) => {
11-
await loginTest({ page });
11+
await loginTest(page);
1212

1313
await fulfillEmptyRoutes(page, ["**/tenants*"]);
1414

@@ -72,7 +72,7 @@ test.describe("Playlist list tests", () => {
7272
});
7373

7474
test.beforeEach(async ({ page }) => {
75-
await loginTest({ page });
75+
await loginTest(page);
7676

7777
await fulfillDataRoute(page, "**/playlists*", playlistListJson);
7878

assets/tests/admin/admin-screen-groups.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.describe("Create group page works", () => {
1515
});
1616

1717
test.beforeEach(async ({ page }) => {
18-
await loginTest({ page });
18+
await loginTest(page);
1919

2020
await fulfillEmptyRoutes(page, ["**/screen-groups*"]);
2121

@@ -74,7 +74,7 @@ test.describe("Groups list works", () => {
7474
});
7575

7676
test.beforeEach(async ({ page }) => {
77-
await loginTest({ page });
77+
await loginTest(page);
7878

7979
await fulfillEmptyRoutes(page, ['**/screens*']);
8080
await fulfillDataRoute(page, "**/screen-groups*", screenGroupsListJson);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test.describe("Screen", () => {
88
});
99

1010
test.beforeEach(async ({ page }) => {
11-
await loginTest({ page });
11+
await loginTest(page);
1212

1313
await fulfillDataRoute(page, "**/screens*", screensListJson);
1414

assets/tests/admin/admin-shared-list.spec.js

Lines changed: 7 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,19 @@
11
import { test, expect } from "@playwright/test";
2-
import { beforeEachTest } from "./test-helper.js";
2+
import { beforeEachTest, fulfillDataRoute, fulfillEmptyRoutes, loginTest } from "./test-helper.js";
3+
import { playlistListJson, screensListJson } from "./data-fixtures.js";
34

45
test.describe("Shared list tests", () => {
56
test.beforeEach(async ({ page }) => {
67
await beforeEachTest(page);
78
});
89

910
test.beforeEach(async ({ page }) => {
10-
await page.goto("/admin/shared/list");
11-
await page.route("**/token", async (route) => {
12-
const json = {
13-
token: "1",
14-
refresh_token: "2",
15-
tenants: [
16-
{
17-
tenantKey: "ABC",
18-
title: "ABC Tenant",
19-
description: "Description",
20-
roles: ["ROLE_ADMIN"],
21-
},
22-
],
23-
user: {
24-
fullname: "John Doe",
25-
email: "johndoe@example.com",
26-
},
27-
};
28-
await route.fulfill({ json });
29-
});
30-
await page.route("**/playlists*", async (route) => {
31-
const json = {
32-
"@context": "/contexts/Playlist",
33-
"@id": "/v2/playlists",
34-
"@type": "hydra:Collection",
35-
"hydra:member": [
36-
{
37-
"@type": "Playlist",
38-
"@id": "/v2/playlists/004ZP1XQ1G1MVZ1T0100YN0MPC",
39-
title: "Et consequatur voluptatibus dolore ut ut.",
40-
description:
41-
"Atque maiores nam in occaecati labore labore inventore quo. Enim nemo totam hic. Ut suscipit id sint sed quia.",
42-
schedules: [],
43-
created: "1975-06-08T13:12:49.000Z",
44-
modified: "2022-01-30T15:42:42.000Z",
45-
modifiedBy: "",
46-
createdBy: "",
47-
slides: "/v2/playlists/004ZP1XQ1G1MVZ1T0100YN0MPC/slides",
48-
campaignScreens: ["/v2/screens/00TH1ZRMZC141K1DMB1H7J03CS"],
49-
campaignScreenGroups: [],
50-
isCampaign: true,
51-
published: {
52-
from: "2022-03-23T21:30:21.000Z",
53-
to: "2022-03-25T12:39:29.000Z",
54-
},
55-
},
56-
{
57-
"@type": "Playlist",
58-
"@id": "/v2/playlists/007TM6JDGF1ECH07J10ZHY0S7P",
59-
title: "Voluptas molestias nemo et.",
60-
description:
61-
"Aperiam quam sunt quia qui. Iusto ut deserunt veritatis nobis dolorem. Aliquid quo vel quia.",
62-
schedules: [],
63-
created: "1978-07-12T17:43:59.000Z",
64-
modified: "2022-01-30T15:42:42.000Z",
65-
modifiedBy: "",
66-
createdBy: "",
67-
slides: "/v2/playlists/007TM6JDGF1ECH07J10ZHY0S7P/slides",
68-
campaignScreens: [],
69-
campaignScreenGroups: [
70-
"/v2/screen-groups/00EQWMS5WA1WJE0WD81VF91DFH",
71-
"/v2/screen-groups/0135RY0QPR1DVF0ZT70YHS1NX3",
72-
"/v2/screen-groups/0135RY0QPR1DVF0ZT70YHS1NX3",
73-
],
74-
isCampaign: false,
75-
published: {
76-
from: "2021-03-21T02:10:37.000Z",
77-
to: "2021-11-08T12:13:31.000Z",
78-
},
79-
},
80-
],
81-
"hydra:totalItems": 2,
82-
};
11+
await loginTest(page);
8312

84-
await route.fulfill({ json });
85-
});
86-
await expect(page).toHaveTitle(/OS2Display Admin/);
87-
await page.getByLabel("Email").fill("johndoe@example.com");
88-
await page.getByLabel("Kodeord").fill("password");
89-
await page.locator("#login").click();
90-
await expect(
91-
page.locator("h1").getByText("Delte spillelister"),
92-
).toBeVisible();
13+
await fulfillDataRoute(page, "**/playlists*", playlistListJson);
14+
15+
await page.getByRole("link", { name: "Delte spillelister", exact: true }).click();
16+
await expect(page.getByRole("heading", { name: "Delte spillelister", exact: true })).toBeVisible();
9317
});
9418

9519
test("It loads shared playlist list", async ({ page }) => {

0 commit comments

Comments
 (0)