diff --git a/tests/end2end/playwright/edition-form.spec.js b/tests/end2end/playwright/edition-form.spec.js index d8f3c0d81f..78652b7f68 100644 --- a/tests/end2end/playwright/edition-form.spec.js +++ b/tests/end2end/playwright/edition-form.spec.js @@ -562,7 +562,7 @@ test.describe('Text widget in a form', () => { // edit the feature let editFeatureRequestPromise = page.waitForResponse(response => response.url().includes('editFeature')); - await page.locator('.lizmapPopupContent > .lizmapPopupSingleFeature').nth(0).locator("lizmap-feature-toolbar").first().locator(".feature-edit").click(); + await page.locator('.feature-toolbar > button:nth-child(5)').click(); await editFeatureRequestPromise; // the text widgets in the form should be filled as in the popup diff --git a/tests/end2end/playwright/n_to_m_relations.spec.js b/tests/end2end/playwright/n_to_m_relations.spec.js index 33fa76316e..8697921d4c 100644 --- a/tests/end2end/playwright/n_to_m_relations.spec.js +++ b/tests/end2end/playwright/n_to_m_relations.spec.js @@ -26,13 +26,13 @@ test.describe('N to M relations', () => { let birdSpotRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeature') === true); await page.locator('#nav-tab-attribute-summary').click(); await page.locator('#attribute-layer-list button[value="birds_spots"]').click(); - await getFeatureRequestPromise; + await birdSpotRequestPromise; // open birds attribute table panel let birdsRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeature') === true); await page.locator('#nav-tab-attribute-summary').click(); await page.locator('#attribute-layer-list button[value="birds"]').click(); - await getFeatureRequestPromise; + await birdsRequestPromise; //back to natural areas panel await page.locator('#nav-tab-attribute-layer-natural_areas').click(); @@ -71,7 +71,7 @@ test.describe('N to M relations', () => { // click on first row of main table and open "m" layer attribute table let firstChildRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeature') === true); await attrTable.locator("tbody tr").nth(0).click(); - await getFeatureRequestPromise; + await firstChildRequestPromise; let nRelatedAttrTable = page.locator("#attribute-layer-table-natural_areas-birds"); await expect(attrTable).toHaveCount(1); @@ -104,7 +104,7 @@ test.describe('N to M relations', () => { // change main record let secondChildRequestPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeature') === true); await attrTable.locator("tbody tr").nth(1).click(); - await getFeatureRequestPromise; + await secondChildRequestPromise; // inspect new list of birds await expect(nRelatedAttrTable.locator("tbody tr")).toHaveCount(3); @@ -166,7 +166,7 @@ test.describe('N to M relations', () => { // unlink bird spot from second natural area record let unlinkOneToN = page.waitForRequest(request => request.method() === 'POST' && request.url().includes('unlinkChild')); - await oneToNAttrTable.locator("tbody tr").nth(0).locator("td").nth(0).locator("lizmap-feature-toolbar").locator(".feature-toolbar button[data-bs-title='Unlink child']").click(); + await oneToNAttrTable.locator("tbody tr").nth(0).locator("td").nth(0).locator("lizmap-feature-toolbar").locator(".feature-toolbar button.feature-unlink").click(); await unlinkOneToN; // wait for UI to reload properly @@ -206,10 +206,11 @@ test.describe('N to M relations', () => { // fill the form and submit await page.locator("#jforms_view_edition").getByLabel('Name', { exact: true }).fill("Northern pintail"); await page.locator("#jforms_view_edition").getByLabel('Scientific name', { exact: true }).fill("Anas acuta"); + let saveBirdRequestPromise = page.waitForResponse(response => response.url().includes('closeFeature')); + await page.locator('#jforms_view_edition__submit_submit').click({force:true}); - await page.locator('#jforms_view_edition__submit_submit').click(); - - await addBirdsRequestPromise; + await saveBirdRequestPromise; + await page.waitForTimeout(300); await expect(page.locator("#lizmap-edition-message")).toBeVisible(); await expect(page.locator("#lizmap-edition-message ul.jelix-msg").nth(0)).toHaveText("Data has been saved."); @@ -255,7 +256,7 @@ test.describe('N to M relations', () => { // click on last inserted record and check child attribute table let naturalAreaChildPromise = page.waitForRequest(request => request.method() === 'POST' && request.postData()?.includes('GetFeature') === true); await birdsTable.locator("tbody tr").nth(8).click(); - await getFeatureRequestPromise; + await naturalAreaChildPromise; let childNaturalAreasTable = page.locator("#attribute-layer-table-birds-natural_areas"); await expect(childNaturalAreasTable.locator("tbody tr")).toHaveCount(1);