@@ -505,3 +505,62 @@ test.describe('Multiple geometry layers', () => {
505
505
506
506
} )
507
507
} )
508
+
509
+ test . describe ( 'Form edition without creation' , { tag : [ '@readonly' ] , } , ( ) => {
510
+
511
+ test ( 'must allow modification without creation' , async ( { page } ) => {
512
+ const project = new ProjectPage ( page , 'form_edition_without_creation' ) ;
513
+ await project . open ( ) ;
514
+
515
+ await expect ( page . locator ( '#button-edition' ) ) . toBeVisible ( ) ;
516
+ await page . locator ( '#button-edition' ) . click ( ) ;
517
+
518
+ await expect ( page . locator ( '#edition-modification-msg' ) ) . toBeVisible ( ) ;
519
+ await expect ( page . locator ( '#edition-creation' ) ) . not . toBeVisible ( ) ;
520
+
521
+ // Click on a feature then launch its edition form
522
+ let getFeatureInfoPromise = project . waitForGetFeatureInfoRequest ( ) ;
523
+ await project . clickOnMap ( 630 , 325 ) ;
524
+ let getFeatureInfoRequest = await getFeatureInfoPromise ;
525
+ await getFeatureInfoRequest . response ( ) ;
526
+
527
+ const featureToolbar = await project . popupContent . locator ( 'lizmap-feature-toolbar[value^="quartiers_"][value$=".6"]' ) ;
528
+ await expect ( featureToolbar ) . toBeDefined ( ) ;
529
+ await expect ( featureToolbar ) . toBeVisible ( ) ;
530
+ await expect ( await featureToolbar . locator ( 'button.feature-edit' ) ) . toBeVisible ( ) ;
531
+
532
+ let editFeatureRequestPromise = page . waitForRequest (
533
+ request => request . method ( ) === 'GET' &&
534
+ request . url ( ) . includes ( 'editFeature' ) === true &&
535
+ request . url ( ) . includes ( 'layerId=quartiers_' ) === true &&
536
+ request . url ( ) . includes ( 'featureId=6' ) === true
537
+ ) ;
538
+ await featureToolbar . locator ( 'button.feature-edit' ) . click ( ) ;
539
+ let editFeatureRequest = await editFeatureRequestPromise ;
540
+ await editFeatureRequest . response ( ) ;
541
+
542
+ // Only edition form should be visible...
543
+ await expect ( page . locator ( '#edition-modification-msg' ) ) . not . toBeVisible ( ) ;
544
+ await expect ( page . locator ( '#edition-creation' ) ) . not . toBeVisible ( ) ;
545
+ await expect ( page . locator ( '#edition-form-container' ) ) . toBeVisible ( ) ;
546
+
547
+ // ... even after toggling dock visibility
548
+ await project . closeLeftDock ( ) ;
549
+ await expect ( page . locator ( '#edition-form-container' ) ) . not . toBeVisible ( ) ;
550
+ await page . locator ( '#button-edition' ) . click ( ) ;
551
+
552
+ await expect ( page . locator ( '#edition-modification-msg' ) ) . not . toBeVisible ( ) ;
553
+ await expect ( page . locator ( '#edition-creation' ) ) . not . toBeVisible ( ) ;
554
+ await expect ( page . locator ( '#edition-form-container' ) ) . toBeVisible ( ) ;
555
+
556
+ // Cancel form edition...
557
+ page . on ( 'dialog' , dialog => dialog . accept ( ) ) ;
558
+ await page . locator ( '#jforms_view_edition__submit_cancel' ) . click ( ) ;
559
+
560
+ // ...returns back to initial state
561
+ await expect ( page . locator ( '#edition-modification-msg' ) ) . toBeVisible ( ) ;
562
+ await expect ( page . locator ( '#edition-creation' ) ) . not . toBeVisible ( ) ;
563
+ await expect ( page . locator ( '#edition-form-container' ) ) . not . toBeVisible ( ) ;
564
+ } ) ;
565
+
566
+ } ) ;
0 commit comments