-
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e: test nullable bool w/ value map
- Loading branch information
1 parent
083f98c
commit 96dd350
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
const url = '/index.php/view/map/?repository=testsrepository&project=form_edition_all_field_type'; | ||
await page.goto(url, { waitUntil: 'networkidle' }); | ||
}); | ||
|
||
test.describe('Edition Form Validation', () => { | ||
|
||
test('Input type number with range and step', async ({ page }) => { | ||
// display form | ||
await page.locator('#button-edition').click(); | ||
await page.locator('a#edition-draw').click(); | ||
|
||
// ensure input attributes match with field config defined in project | ||
await expect(page.locator('#jforms_view_edition input[name="integer_field"]')).toHaveAttribute('type','number') | ||
await expect(page.locator('#jforms_view_edition input[name="integer_field"]')).toHaveAttribute('step','5'); | ||
await expect(page.locator('#jforms_view_edition input[name="integer_field"]')).toHaveAttribute('min','-200'); | ||
await expect(page.locator('#jforms_view_edition input[name="integer_field"]')).toHaveAttribute('max','200'); | ||
|
||
// add data | ||
await page.locator('#jforms_view_edition input[name="integer_field"]').fill('50'); | ||
|
||
// submit form | ||
await page.locator('#jforms_view_edition__submit_submit').click(); | ||
// will close & show message | ||
await expect(page.locator('#edition-form-container')).toBeHidden(); | ||
await expect(page.locator('#lizmap-edition-message')).toBeVisible(); | ||
}) | ||
|
||
test('Boolean nullable w/ value map', async ({ page }) => { | ||
|
||
let editFeatureRequestPromise = page.waitForResponse(response => response.url().includes('editFeature')); | ||
|
||
await page.locator('#button-edition').click(); | ||
await page.locator('#edition-layer').selectOption('many_bool_formats_7aa4cb8a_09ae_4a5b_92e4_189a42ca3a2f'); | ||
await page.locator('#edition-draw').click(); | ||
await page.locator('#jforms_view_edition_liz_future_action').selectOption('edit'); | ||
await page.getByLabel('bool_simple_null_vm').selectOption('t'); | ||
await page.locator('#jforms_view_edition__submit_submit').click(); | ||
|
||
await editFeatureRequestPromise; | ||
|
||
// Wait a bit for the UI to refresh | ||
await page.waitForTimeout(300); | ||
|
||
await expect(page.getByLabel('bool_simple_null_vm')).toHaveValue('t'); | ||
|
||
await page.getByLabel('bool_simple_null_vm').selectOption(''); | ||
await page.locator('#jforms_view_edition__submit_submit').click(); | ||
|
||
await editFeatureRequestPromise; | ||
|
||
// Wait a bit for the UI to refresh | ||
await page.waitForTimeout(300); | ||
|
||
await expect(page.getByLabel('bool_simple_null_vm')).toHaveValue(''); | ||
}) | ||
}) |