Codeception / Codeception/lib-innerbrowser

InnerBrowser fillField throws exception if input does not have a name attribute

Offen
#24 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
87
Forks
20
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

This issue comes from the problem reported in Codeception/Codeception#1221. You will get an exception with the text `InvalidArgumentException: Malformed field path ""` if you call `fillField` for a form field without a name attribute or an empty name attribute.

This comes from the fact that the call to `matchFormField` at https://github.com/Codeception/Codeception/blob/2.1/src/Codeception/Lib/InnerBrowser.php#L789 uses the value of the name attribute to access the fields in a `\Symfony\Component\DomCrawler\Form` object.

However, this `Form` object will not store form fields that do not have a value for their name attribute, see this line of code: https://github.com/symfony/dom-crawler/blob/master/Form.php#L452.

I don't see an easy workaround for this problem, but maybe someone else does, maybe @Naktibalda or @DavertMik? I am not really familiar with this part of the Codeception codebase :)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginnen Sie in src/Codeception/Lib/InnerBrowser.php ungefähr bei Zeile 789 und untersuchen Sie anschließend Symfony DomCrawler Form.php ungefähr bei Zeile 452 sowie den Aufruf von matchFormField. Reproduzieren Sie fillField mit einem Formularfeld, dessen Name fehlt oder leer ist, und betrachten Sie das Problem als erledigt, sobald es nicht mehr "Malformed field path" auslöst.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php, symfony
Bereich
testing
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.