Skip to content

Commit 95c7536

Browse files
authored
Merge pull request #5832 from rldhont/backport-5830-to-release_3_8
[Backport release_3_8] Test e2e: move from cypress to playwright Form edition without creation
2 parents 4778fc5 + 39634de commit 95c7536

File tree

2 files changed

+59
-37
lines changed

2 files changed

+59
-37
lines changed

tests/end2end/cypress/integration/form_edition_without_creation-ghaction.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

tests/end2end/playwright/edition-form.spec.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,3 +505,62 @@ test.describe('Multiple geometry layers', () => {
505505

506506
})
507507
})
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

Comments
 (0)