@@ -10,7 +10,6 @@ import {
10
10
onlyImageTextListJson ,
11
11
slideJson ,
12
12
slidesJson1 ,
13
- tokenAdminJson ,
14
13
} from "./data-fixtures.js" ;
15
14
16
15
test . describe ( "Admin form ui tests" , ( ) => {
@@ -276,17 +275,49 @@ test.describe("Admin slide values depending on other values", () => {
276
275
} ) ;
277
276
278
277
test . beforeEach ( async ( { page } ) => {
279
- await page . goto ( "/admin/slides/list" ) ;
278
+ await fulfillDataRoute (
279
+ page ,
280
+ "**/templates?itemsPerPage*" ,
281
+ onlyImageTextListJson ,
282
+ ) ;
280
283
281
- await page . route ( "**/token" , async ( route ) => {
282
- await route . fulfill ( { json : tokenAdminJson } ) ;
283
- } ) ;
284
+ await page . route (
285
+ "**/templates/000YR9PMQC0GMC1TP90V9N07WX" ,
286
+ async ( route ) => {
287
+ await route . fulfill ( imageTextTemplate ) ;
288
+ } ,
289
+ ) ;
284
290
285
- await page . route ( "**/slides*" , async ( route ) => {
286
- await route . fulfill ( { json : slidesJson1 } ) ;
287
- } ) ;
291
+ await fulfillDataRoute (
292
+ page ,
293
+ "**/templates/01FGC8EXSE1KCC1PTR0NHB0H3R" ,
294
+ imageTextTemplate ,
295
+ ) ;
288
296
289
- await fulfillDataRoute ( page , "**/templates*" , onlyImageTextListJson ) ;
297
+ await fulfillDataRoute (
298
+ page ,
299
+ "**/templates/002BAP34VD1EHG0E4J0D2Y00JW" ,
300
+ imageTextTemplate ,
301
+ ) ;
302
+
303
+ await fulfillDataRoute (
304
+ page ,
305
+ "**/templates/017BG9P0E0103F0TFS17FM016M" ,
306
+ imageTextTemplate ,
307
+ ) ;
308
+
309
+ await fulfillDataRoute (
310
+ page ,
311
+ "**/templates/016MHSNKCH1PQW1VY615JC19Y3" ,
312
+ imageTextTemplate ,
313
+ ) ;
314
+ await fulfillDataRoute (
315
+ page ,
316
+ "**/templates/000BGWFMBS15N807E60HP91JCX" ,
317
+ imageTextTemplate ,
318
+ ) ;
319
+
320
+ await loginTest ( page , slidesJson1 ) ;
290
321
291
322
await fulfillDataRoute (
292
323
page ,
@@ -299,17 +330,16 @@ test.describe("Admin slide values depending on other values", () => {
299
330
"**/v2/slides/00015Y0ZVC18N407JD07SM0YCF" ,
300
331
slideJson ,
301
332
) ;
302
-
303
333
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 ( ) ;
308
-
309
334
await Promise . all ( [
310
335
page . waitForURL ( "**/slide/edit/*" ) ,
311
336
await page . locator ( "#edit_button" ) . first ( ) . click ( { force : true } ) ,
312
337
] ) ;
338
+
339
+ const title = page . getByText ( "Rediger slide:" ) ;
340
+ await title . waitFor ( ) ;
341
+
342
+ await expect ( title ) . toBeVisible ( ) ;
313
343
} ) ;
314
344
315
345
test ( "Should have filled title" , async ( { page } ) => {
@@ -325,7 +355,7 @@ test.describe("Admin slide values depending on other values", () => {
325
355
326
356
test ( "Should pick font size" , async ( { page } ) => {
327
357
await page . route ( "**/v2/slides" , async ( route , request ) => {
328
- if ( request . method ( ) === "POST " ) {
358
+ if ( request . method ( ) === "PUT " ) {
329
359
const postData = request . postDataJSON ( ) ; // Parses JSON body
330
360
expect ( postData . content ) . toMatchObject ( {
331
361
fontSize : "font-size-m" ,
@@ -351,8 +381,8 @@ test.describe("Admin slide values depending on other values", () => {
351
381
352
382
test ( "Should have media contain visible and checkable" , async ( { page } ) => {
353
383
await page . route ( "**/v2/slides" , async ( route , request ) => {
354
- if ( request . method ( ) === "POST " ) {
355
- const postData = request . postDataJSON ( ) ; // Parses JSON body
384
+ if ( request . method ( ) === "PUT " ) {
385
+ const postData = request . postDataJSON ( ) ;
356
386
expect ( postData . content ) . toMatchObject ( {
357
387
mediaContain : true ,
358
388
} ) ;
@@ -370,8 +400,8 @@ test.describe("Admin slide values depending on other values", () => {
370
400
371
401
test ( "Should have duration visible and interactable" , async ( { page } ) => {
372
402
await page . route ( "**/v2/slides" , async ( route , request ) => {
373
- if ( request . method ( ) === "POST " ) {
374
- const postData = request . postDataJSON ( ) ; // Parses JSON body
403
+ if ( request . method ( ) === "PUT " ) {
404
+ const postData = request . postDataJSON ( ) ;
375
405
expect ( postData . content ) . toMatchObject ( {
376
406
duration : 10000 ,
377
407
} ) ;
@@ -388,7 +418,7 @@ test.describe("Admin slide values depending on other values", () => {
388
418
389
419
test ( "Should have box align visible and checkable" , async ( { page } ) => {
390
420
await page . route ( "**/v2/slides" , async ( route , request ) => {
391
- if ( request . method ( ) === "POST " ) {
421
+ if ( request . method ( ) === "PUT " ) {
392
422
const postData = request . postDataJSON ( ) ; // Parses JSON body
393
423
expect ( postData . content ) . toMatchObject ( {
394
424
boxAlign : "right" ,
@@ -407,7 +437,7 @@ test.describe("Admin slide values depending on other values", () => {
407
437
408
438
test ( "Should have box margin visible and checkable" , async ( { page } ) => {
409
439
await page . route ( "**/v2/slides" , async ( route , request ) => {
410
- if ( request . method ( ) === "POST " ) {
440
+ if ( request . method ( ) === "PUT " ) {
411
441
const postData = request . postDataJSON ( ) ; // Parses JSON body
412
442
expect ( postData . content ) . toMatchObject ( {
413
443
boxMargin : true ,
@@ -428,7 +458,7 @@ test.describe("Admin slide values depending on other values", () => {
428
458
page,
429
459
} ) => {
430
460
await page . route ( "**/v2/slides" , async ( route , request ) => {
431
- if ( request . method ( ) === "POST " ) {
461
+ if ( request . method ( ) === "PUT " ) {
432
462
const postData = request . postDataJSON ( ) ; // Parses JSON body
433
463
expect ( postData . content ) . toMatchObject ( {
434
464
separator : true ,
@@ -453,7 +483,7 @@ test.describe("Admin slide values depending on other values", () => {
453
483
454
484
test ( "Should have halfsize visible and checkable" , async ( { page } ) => {
455
485
await page . route ( "**/v2/slides" , async ( route , request ) => {
456
- if ( request . method ( ) === "POST " ) {
486
+ if ( request . method ( ) === "PUT " ) {
457
487
const postData = request . postDataJSON ( ) ; // Parses JSON body
458
488
expect ( postData . content ) . toMatchObject ( {
459
489
halfSize : true ,
@@ -472,7 +502,7 @@ test.describe("Admin slide values depending on other values", () => {
472
502
473
503
test ( "Should have shadow visible and checkable" , async ( { page } ) => {
474
504
await page . route ( "**/v2/slides" , async ( route , request ) => {
475
- if ( request . method ( ) === "POST " ) {
505
+ if ( request . method ( ) === "PUT " ) {
476
506
const postData = request . postDataJSON ( ) ; // Parses JSON body
477
507
expect ( postData . content ) . toMatchObject ( {
478
508
shadow : true ,
@@ -492,7 +522,7 @@ test.describe("Admin slide values depending on other values", () => {
492
522
page,
493
523
} ) => {
494
524
await page . route ( "**/v2/slides" , async ( route , request ) => {
495
- if ( request . method ( ) === "POST " ) {
525
+ if ( request . method ( ) === "PUT " ) {
496
526
const postData = request . postDataJSON ( ) ;
497
527
expect ( postData . content ) . toMatchObject ( {
498
528
showLogo : true ,
0 commit comments