Skip to content

Commit 2ac7785

Browse files
committed
5316: test if this works
1 parent 7f8a7cb commit 2ac7785

File tree

2 files changed

+70
-20
lines changed

2 files changed

+70
-20
lines changed

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

Lines changed: 69 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,48 @@ test.describe("Admin form ui tests", () => {
3333
await page.getByLabel("Tilføj nyt slide").first().click(),
3434
]);
3535

36+
await fulfillDataRoute(
37+
page,
38+
"**/templates/01FP2SNGFN0BZQH03KCBXHKYHG",
39+
imageTextTemplate,
40+
);
41+
42+
await fulfillDataRoute(
43+
page,
44+
"**/templates/000YR9PMQC0GMC1TP90V9N07WX",
45+
imageTextTemplate,
46+
);
47+
48+
await fulfillDataRoute(
49+
page,
50+
"**/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
51+
imageTextTemplate,
52+
);
53+
54+
await fulfillDataRoute(
55+
page,
56+
"**/templates/000BGWFMBS15N807E60HP91JCX",
57+
imageTextTemplate,
58+
);
59+
60+
await fulfillDataRoute(
61+
page,
62+
"**/templates/002BAP34VD1EHG0E4J0D2Y00JW",
63+
imageTextTemplate,
64+
);
65+
66+
await fulfillDataRoute(
67+
page,
68+
"**/templates/017BG9P0E0103F0TFS17FM016M",
69+
imageTextTemplate,
70+
);
71+
72+
await fulfillDataRoute(
73+
page,
74+
"**/templates/016MHSNKCH1PQW1VY615JC19Y3",
75+
imageTextTemplate,
76+
);
77+
3678
const header = page.getByText("Opret nyt slide:");
3779
await header.waitFor();
3880
await expect(header).toBeVisible();
@@ -283,31 +325,38 @@ test.describe("Admin slide values depending on other values", () => {
283325
"**/templates/01FP2SNGFN0BZQH03KCBXHKYHG",
284326
imageTextTemplate,
285327
);
286-
await fulfillDataRoute(
287-
page,
328+
329+
await page.route(
288330
"**/templates/000YR9PMQC0GMC1TP90V9N07WX",
289-
imageTextTemplate,
331+
async (route) => {
332+
await route.fulfill(imageTextTemplate);
333+
},
290334
);
335+
291336
await fulfillDataRoute(
292337
page,
293338
"**/templates/01FGC8EXSE1KCC1PTR0NHB0H3R",
294339
imageTextTemplate,
295340
);
341+
296342
await fulfillDataRoute(
297343
page,
298344
"**/templates/000BGWFMBS15N807E60HP91JCX",
299345
imageTextTemplate,
300346
);
347+
301348
await fulfillDataRoute(
302349
page,
303350
"**/templates/002BAP34VD1EHG0E4J0D2Y00JW",
304351
imageTextTemplate,
305352
);
353+
306354
await fulfillDataRoute(
307355
page,
308356
"**/templates/017BG9P0E0103F0TFS17FM016M",
309357
imageTextTemplate,
310358
);
359+
311360
await fulfillDataRoute(
312361
page,
313362
"**/templates/016MHSNKCH1PQW1VY615JC19Y3",
@@ -319,12 +368,18 @@ test.describe("Admin slide values depending on other values", () => {
319368
"**/v2/slides/00015Y0ZVC18N407JD07SM0YCF",
320369
slideJson,
321370
);
371+
322372
await fulfillEmptyRoutes(page, ["**/playlists*", "**/themes*"]);
323373

324374
await Promise.all([
325375
page.waitForURL("**/slide/edit/*"),
326376
await page.locator("#edit_button").first().click({ force: true }),
327377
]);
378+
379+
const title = page.getByText("Rediger slide:");
380+
await title.waitFor();
381+
382+
await expect(title).toBeVisible();
328383
});
329384

330385
test("Should have filled title", async ({ page }) => {
@@ -340,7 +395,7 @@ test.describe("Admin slide values depending on other values", () => {
340395

341396
test("Should pick font size", async ({ page }) => {
342397
await page.route("**/v2/slides", async (route, request) => {
343-
if (request.method() === "POST") {
398+
if (request.method() === "PUT") {
344399
const postData = request.postDataJSON(); // Parses JSON body
345400
expect(postData.content).toMatchObject({
346401
fontSize: "font-size-m",
@@ -366,8 +421,8 @@ test.describe("Admin slide values depending on other values", () => {
366421

367422
test("Should have media contain visible and checkable", async ({ page }) => {
368423
await page.route("**/v2/slides", async (route, request) => {
369-
if (request.method() === "POST") {
370-
const postData = request.postDataJSON(); // Parses JSON body
424+
if (request.method() === "PUT") {
425+
const postData = request.postDataJSON();
371426
expect(postData.content).toMatchObject({
372427
mediaContain: true,
373428
});
@@ -385,8 +440,8 @@ test.describe("Admin slide values depending on other values", () => {
385440

386441
test("Should have duration visible and interactable", async ({ page }) => {
387442
await page.route("**/v2/slides", async (route, request) => {
388-
if (request.method() === "POST") {
389-
const postData = request.postDataJSON(); // Parses JSON body
443+
if (request.method() === "PUT") {
444+
const postData = request.postDataJSON();
390445
expect(postData.content).toMatchObject({
391446
duration: 10000,
392447
});
@@ -403,7 +458,7 @@ test.describe("Admin slide values depending on other values", () => {
403458

404459
test("Should have box align visible and checkable", async ({ page }) => {
405460
await page.route("**/v2/slides", async (route, request) => {
406-
if (request.method() === "POST") {
461+
if (request.method() === "PUT") {
407462
const postData = request.postDataJSON(); // Parses JSON body
408463
expect(postData.content).toMatchObject({
409464
boxAlign: "right",
@@ -422,7 +477,7 @@ test.describe("Admin slide values depending on other values", () => {
422477

423478
test("Should have box margin visible and checkable", async ({ page }) => {
424479
await page.route("**/v2/slides", async (route, request) => {
425-
if (request.method() === "POST") {
480+
if (request.method() === "PUT") {
426481
const postData = request.postDataJSON(); // Parses JSON body
427482
expect(postData.content).toMatchObject({
428483
boxMargin: true,
@@ -443,7 +498,7 @@ test.describe("Admin slide values depending on other values", () => {
443498
page,
444499
}) => {
445500
await page.route("**/v2/slides", async (route, request) => {
446-
if (request.method() === "POST") {
501+
if (request.method() === "PUT") {
447502
const postData = request.postDataJSON(); // Parses JSON body
448503
expect(postData.content).toMatchObject({
449504
separator: true,
@@ -468,7 +523,7 @@ test.describe("Admin slide values depending on other values", () => {
468523

469524
test("Should have halfsize visible and checkable", async ({ page }) => {
470525
await page.route("**/v2/slides", async (route, request) => {
471-
if (request.method() === "POST") {
526+
if (request.method() === "PUT") {
472527
const postData = request.postDataJSON(); // Parses JSON body
473528
expect(postData.content).toMatchObject({
474529
halfSize: true,
@@ -487,7 +542,7 @@ test.describe("Admin slide values depending on other values", () => {
487542

488543
test("Should have shadow visible and checkable", async ({ page }) => {
489544
await page.route("**/v2/slides", async (route, request) => {
490-
if (request.method() === "POST") {
545+
if (request.method() === "PUT") {
491546
const postData = request.postDataJSON(); // Parses JSON body
492547
expect(postData.content).toMatchObject({
493548
shadow: true,
@@ -507,7 +562,7 @@ test.describe("Admin slide values depending on other values", () => {
507562
page,
508563
}) => {
509564
await page.route("**/v2/slides", async (route, request) => {
510-
if (request.method() === "POST") {
565+
if (request.method() === "PUT") {
511566
const postData = request.postDataJSON();
512567
expect(postData.content).toMatchObject({
513568
showLogo: true,

assets/tests/admin/test-helper.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
adminConfigJson,
3-
emptyJson,
4-
slidesJson1,
5-
tokenAdminJson,
6-
} from "./data-fixtures.js";
1+
import { adminConfigJson, emptyJson, tokenAdminJson } from "./data-fixtures.js";
72
import { expect } from "@playwright/test";
83

94
const beforeEachTest = async (page) => {

0 commit comments

Comments
 (0)