Skip to content

Commit 78a5cf7

Browse files
👌 [#305] refactor: don't auto set index in tests for form fields
1 parent f7cbfdf commit 78a5cf7

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

backend/src/openbeheer/utils/gherkin_e2e.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,11 @@ def user_clicks_on_checkbox(self, page: Page, label: str) -> None:
300300
page.get_by_label(label).click()
301301

302302
def user_fills_form_field(
303-
self, page: Page, label: str, value: str, index: int = -1
303+
self, page: Page, label: str, value: str, index: int = 0
304304
) -> None:
305305
"""
306306
Fills the form field with the given value.
307307
If multiple form fields are found, the field at the given index is filled.
308-
If no index is provided: the last field is used to accommodate modal forms.
309308
"""
310309

311310
# Certain form fields may be shown in a modal that needs some time to load
@@ -314,18 +313,16 @@ def user_fills_form_field(
314313

315314
# Try a (custom) select
316315
selects = page.get_by_role("combobox", name=label)
317-
_index = index if index > -1 else selects.count() - 1
318316
if selects.count():
319-
select = selects.nth(_index)
317+
select = selects.nth(index)
320318
select.click()
321319
option = select.get_by_text(value)
322320
option.click()
323321
return
324322

325323
# Fill (native) input
326324
inputs = page.get_by_label(label)
327-
_index = index if index > -1 else inputs.count() - 1
328-
input = inputs.nth(_index)
325+
input = inputs.nth(index)
329326
input.fill(value)
330327

331328
class Then(GherkinScenario):

backend/src/openbeheer/zaaktype/tests/e2e/test_add_resultaattypen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def test_add_resultaattypen(page: Page, runner: GherkinRunner):
6767
page,
6868
"Selectielijstklasse",
6969
"1.1.3 - Ingericht - vernietigen - P10Y - Wijziging inrichting BRP systeem",
70+
1
7071
)
7172
_.when.user_clicks_on_button(page, name="Doorgaan")
7273

0 commit comments

Comments
 (0)