From ade4d2f1784ed92ba057d62d5de6ec13fb4d964b Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Mon, 3 Feb 2025 10:54:59 +0100 Subject: [PATCH] Tests - Add move point tests about editing value relation --- .../playwright/editing-value-relation.spec.js | 57 +++++++++++++++++++ .../form_edition_value_relation_field.md | 30 ---------- 2 files changed, 57 insertions(+), 30 deletions(-) create mode 100644 tests/end2end/playwright/editing-value-relation.spec.js delete mode 100644 tests/qgis-projects/tests/form_edition_value_relation_field.md diff --git a/tests/end2end/playwright/editing-value-relation.spec.js b/tests/end2end/playwright/editing-value-relation.spec.js new file mode 100644 index 0000000000..a66cd17b63 --- /dev/null +++ b/tests/end2end/playwright/editing-value-relation.spec.js @@ -0,0 +1,57 @@ +// @ts-check +import { test, expect } from '@playwright/test'; +import {ProjectPage} from "./pages/project"; + +test.describe('Value relation widget', + { + tag: ['@readonly'], + },() => { + + test('Move geom and update select with a QGIS expression', async ({ page }) => { + const project = new ProjectPage(page, 'form_edition_value_relation_field'); + await project.open(); + await project.openEditingFormWithLayer('point'); + + const select = await page.locator("#jforms_view_edition_code_with_geom_exp"); + + await project.clickOnMapLegacy(650, 200); + + await select.selectOption({value: ''}); + + await project.mapOl2.dragTo(project.mapOl2, { + sourcePosition: { x: 650, y: 200 }, + targetPosition: { x: 500, y: 200 }, + }); + + await select.selectOption({value: 'A2'}); + + await project.mapOl2.dragTo(project.mapOl2, { + sourcePosition: { x: 500, y: 200 }, + targetPosition: { x: 350, y: 200 }, + }); + + await select.selectOption({value: 'A1'}); + + await project.mapOl2.dragTo(project.mapOl2, { + sourcePosition: { x: 350, y: 200 }, + targetPosition: { x: 350, y: 500 }, + }); + + await select.selectOption({value: 'B1'}); + + await project.mapOl2.dragTo(project.mapOl2, { + sourcePosition: { x: 350, y: 500 }, + targetPosition: { x: 500, y: 500 }, + }); + + await select.selectOption({value: 'B2'}); + + await project.mapOl2.dragTo(project.mapOl2, { + sourcePosition: { x: 500, y: 500 }, + targetPosition: { x: 650, y: 200 }, + }); + + await select.selectOption({value: ''}); + + }) +}) diff --git a/tests/qgis-projects/tests/form_edition_value_relation_field.md b/tests/qgis-projects/tests/form_edition_value_relation_field.md deleted file mode 100644 index e93cbe1d03..0000000000 --- a/tests/qgis-projects/tests/form_edition_value_relation_field.md +++ /dev/null @@ -1,30 +0,0 @@ -# Test value relation widget - -**Project : form_edition_value_relation_field** - -## Procedure - -### Check the field available values filtered by geometry - -Partially covered by Cypress (the move part is not covered) - -* [ ] Click on add a `point` in the *Edition* panel -* [ ] Click on the map to draw the point within **Zone A1** -* [ ] Check that the *Geom expression* available values has **2** options : - * [ ] **Zone A1** - * [ ] an empty value -* [ ] Move the point on the map within **Zone A2** -* [ ] Check that the *Geom expression* available values has **2** options : - * [ ] **Zone A2** - * [ ] an empty value -* [ ] Move the point on the map within **Zone B1** -* [ ] Check that the *Geom expression* available values has **2** options : - * [ ] **Zone B1** - * [ ] an empty value -* [ ] Move the point on the map within **Zone B2** -* [ ] Check that the *Geom expression* available values has **2** options - * [ ] **Zone B2** - * [ ] an empty value -* [ ] Move the point **outside Zones** -* [ ] Check that the *Geom expression* available values has **1** option : - * [ ] an empty value