From c53300b66167700719b56d0f7a22a09e40a834d8 Mon Sep 17 00:00:00 2001 From: florimondmanca Date: Mon, 18 Sep 2023 17:33:05 +0200 Subject: [PATCH] Fix failing playwright tests --- templates/regulation/_vehicle_set_form.html.twig | 2 +- tests/e2e/pages/regulation_order.page.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/regulation/_vehicle_set_form.html.twig b/templates/regulation/_vehicle_set_form.html.twig index 11a296c6d..a9f1d957f 100644 --- a/templates/regulation/_vehicle_set_form.html.twig +++ b/templates/regulation/_vehicle_set_form.html.twig @@ -18,7 +18,7 @@ {% for option in form.allVehicles %}
-
+
{{ form_widget(option, { attr: { 'data-controller': 'condition', diff --git a/tests/e2e/pages/regulation_order.page.js b/tests/e2e/pages/regulation_order.page.js index 1adc98a1b..a1ff599c0 100644 --- a/tests/e2e/pages/regulation_order.page.js +++ b/tests/e2e/pages/regulation_order.page.js @@ -62,7 +62,7 @@ export class RegulationOrderPage { await this.page.getByLabel('Voie ou ville').fill(address); await this.page.getByLabel('Type de restriction').selectOption({ label: restrictionType }); - await this.page.getByText('Tous les véhicules', { exact: true }).check({ force: true }); + await this.page.getByTestId('allVehicles-0-yes').click(); await this.saveBtn.click(); this.addedLocationTitles.push(expectedTitle); return this.getLocationByTitle(expectedTitle); @@ -96,7 +96,7 @@ export class RegulationOrderPage { const restrictionTypeField = measure.getByRole('combobox', { name: 'Type de restriction' }); expect(await restrictionTypeField.getAttribute('name')).toBe(`location_form[measures][${expectedIndex}][type]`); await restrictionTypeField.selectOption({ label: restrictionType }); - await measure.getByText('Tous les véhicules', { exact: true }).check(); + await this.page.getByTestId(`allVehicles-${expectedIndex}-yes`).click(); // Advanced vehicles options are not shown await expect(measure.getByLabel('Types de véhicules concernés', { exact: true })).not.toBeVisible(); // Restricted @@ -149,7 +149,7 @@ export class RegulationOrderPage { // Define restricted vehicles const restrictedVehiclesFieldset = measure.getByRole('radiogroup', { name: 'Véhicules concernés' }); - await restrictedVehiclesFieldset.getByText('Certains véhicules', { exact: true }).click(); + await restrictedVehiclesFieldset.getByTestId(`allVehicles-${measureIndex}-no`).click(); for (const vehicleType of restrictedVehicleTypes) { await restrictedVehiclesFieldset.getByLabel('Types de véhicules concernés').getByLabel(vehicleType, { exact: true }).click(); }