Skip to content

Commit

Permalink
Tests - Rewrite snapping test to by in Playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Feb 5, 2025
1 parent fff15ae commit 3cac33d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 23 deletions.
53 changes: 48 additions & 5 deletions tests/end2end/playwright/snap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ import { gotoMap } from './globals';
import {ProjectPage} from "./pages/project";

test.describe('Snap on edition', () => {
test.beforeEach(async ({ page }) => {
const url = '/index.php/view/map/?repository=testsrepository&project=form_edition_multilayer_snap';
await gotoMap(url, page);
});

test('Snap panel functionalities', async ({ page }) => {

const url = '/index.php/view/map/?repository=testsrepository&project=form_edition_multilayer_snap';
await gotoMap(url, page);
let editFeatureRequestPromise = page.waitForResponse(response => response.url().includes('editFeature'));

const project = new ProjectPage(page, 'form_edition_multilayer_snap');
Expand Down Expand Up @@ -219,4 +216,50 @@ test.describe('Snap on edition', () => {
await expect(page.locator("#edition-point-coord-form-group .snap-layers-list .snap-layer").nth(2).locator("label")).toHaveText("Point snap");
await expect(page.locator("#edition-point-coord-form-group .snap-layers-list .snap-layer").nth(2).locator("label")).toHaveClass("snap-disabled");
})

test('Snapping on points, on the map',
{
tag: ['@readonly'],
},async ({ page }) => {
const project = new ProjectPage(page, 'form_edition_snap');
await project.open();

await project.openEditingFormWithLayer('form_edition_snap');
await project.dock.getByText('Digitization').click();

let dftRequest = page.waitForRequest(
request =>
request.method() === 'POST' &&
request.postData() != null &&
request.postData()?.includes('DescribeFeatureType') === true &&
request.postData()?.includes('form_edition_snap_layer') === true
);

await project.dock.getByText('Start').click();

// Either we can enter manually coordinates
await project.dock.locator("#edition-point-coord-x").fill("3.910")
await project.dock.locator("#edition-point-coord-y").fill("43.6161")

// Or we click on the map
// await project.clickOnMapLegacy(600, 250);

await dftRequest;
await page.waitForTimeout(1000);

await project.dock.getByRole('tab', { name: 'Form' }).click();
await project.editingField('id').fill("90");

// What would be the JS API to check for the current drown geometry point,
// which should be different from 3.910 43.6161 because of the snapping

// let gfiPromise = page.waitForRequest(
// request => request.method() === 'POST' &&
// request.postData()?.includes('GetFeatureInfo') === true
// );
// await gfiPromise;

await dftRequest;

});
})
17 changes: 0 additions & 17 deletions tests/qgis-projects/tests/form_edition_snap.md

This file was deleted.

2 changes: 1 addition & 1 deletion tests/qgis-projects/tests/form_edition_snap.qgs.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"snap_vertices": "True",
"snap_segments": "True",
"snap_intersections": "True",
"snap_vertices_tolerance": 20,
"snap_vertices_tolerance": 90,
"snap_segments_tolerance": 10,
"snap_intersections_tolerance": 10,
"provider": "postgres",
Expand Down

0 comments on commit 3cac33d

Please sign in to comment.