Skip to content

Commit

Permalink
Merge pull request #5053 from rldhont/tests-e2e-getFeature-filter_by_…
Browse files Browse the repository at this point in the history
…user

[Tests] e2e Filter layer data by user - WFS GetFeature
  • Loading branch information
rldhont authored Dec 2, 2024
2 parents 4e7a4e5 + b6b4495 commit dda5088
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions tests/end2end/playwright/filter-layer-by-user.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ test.describe('Filter layer data by user - not connected', () => {

});

test('WFS GetFeature', async ({ page }) => {

let getFeature = await page.evaluate(async () => {
return await fetch("/index.php/lizmap/service?repository=testsrepository&project=filter_layer_by_user&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0&OUTPUTFORMAT=GeoJSON&TYPENAME=blue_filter_layer_by_user")
.then(r => r.ok ? r.json() : Promise.reject(r))
})

// check features
expect(getFeature.features).toHaveLength(0)
});

test('Popup with map click', async ({ page }) => {
let getFeatureInfoRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeatureInfo') === true);

Expand Down Expand Up @@ -177,6 +188,28 @@ test.describe('Filter layer data by user - user in group a', () => {

});

test('WFS GetFeature', async ({ page }) => {

let getFeature = await page.evaluate(async () => {
return await fetch("/index.php/lizmap/service?repository=testsrepository&project=filter_layer_by_user&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0&OUTPUTFORMAT=GeoJSON&TYPENAME=blue_filter_layer_by_user")
.then(r => r.ok ? r.json() : Promise.reject(r))
})

// check features
expect(getFeature.features).toHaveLength(1)
// check a specific feature
let feature = getFeature.features[0]
expect(feature.id).not.toBeUndefined()

getFeature = await page.evaluate(async () => {
return await fetch("/index.php/lizmap/service?repository=testsrepository&project=filter_layer_by_user&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0&OUTPUTFORMAT=GeoJSON&TYPENAME=blue_filter_layer_by_user&EXP_Filter=%22gid%22%20=%203")
.then(r => r.ok ? r.json() : Promise.reject(r))
})

// check features
expect(getFeature.features).toHaveLength(0)
});

test('Popup with map click', async ({ page }) => {
let getFeatureInfoRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeatureInfo') === true);

Expand Down Expand Up @@ -319,6 +352,32 @@ test.describe('Filter layer data by user - admin', () => {

});

test('WFS GetFeature', async ({ page }) => {

let getFeature = await page.evaluate(async () => {
return await fetch("/index.php/lizmap/service?repository=testsrepository&project=filter_layer_by_user&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0&OUTPUTFORMAT=GeoJSON&TYPENAME=blue_filter_layer_by_user")
.then(r => r.ok ? r.json() : Promise.reject(r))
})

// check features
expect(getFeature.features).toHaveLength(3)
// check a specific feature
let feature = getFeature.features[0]
expect(feature.id).not.toBeUndefined()

getFeature = await page.evaluate(async () => {
return await fetch("/index.php/lizmap/service?repository=testsrepository&project=filter_layer_by_user&SERVICE=WFS&REQUEST=GetFeature&VERSION=1.0.0&OUTPUTFORMAT=GeoJSON&TYPENAME=blue_filter_layer_by_user&EXP_Filter=%22gid%22%20=%203")
.then(r => r.ok ? r.json() : Promise.reject(r))
})

// check features
expect(getFeature.features).toHaveLength(1)
// check a specific feature
feature = getFeature.features[0]
expect(feature.id).not.toBeUndefined()

});

test('Popup with map click', async ({ page }) => {
let getFeatureInfoRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeatureInfo') === true);

Expand Down

0 comments on commit dda5088

Please sign in to comment.