php - PHPunit: Form Ancestor Not Found -
i have simple form:
<!--new form--> <form method="post" action="http://192.168.114.139/family/search_results" accept-charset="utf-8" id="admin-form"><input name="_token" type="hidden" value="7v2ihbtkimrvyojj8vuv0dddrqyszo18z6gpwkp2"> <input class="gui-input" id="search_term" placeholder="" name="search_term" type="text"> <div class="panel-footer text-right"> <input class="button btn-primary" name="submit" id="search" type="submit" value="search"> <button class="button btn-danger" type="reset">reset</button> </div> </form>
i want test form using laravel's laracasts\integrated package. have following test method written:
/** @test */ public function it_can_search() { $this->login() ->visit('/identification/search_family/') ->see('search families') ->submitform('search',['search_term' => 'tests']) ->seepageis('/identification/search_family/'); }
when run test, following error:
there 1 error:
1) exampletest::it_can_seach logicexception: selected node not have form ancestor. /var/www/html/srs/vendor/symfony/dom-crawler/form.php:400 /var/www/html/srs/vendor/symfony/dom-crawler/link.php:55 /var/www/html/srs/vendor/symfony/dom-crawler/form.php:49 /var/www/html/srs/vendor/symfony/dom-crawler/crawler.php:770 /var/www/html/srs/vendor/laracasts/integrated/src/extensions/integrationtrait.php:397 /var/www/html/srs/vendor/laracasts/integrated/src/extensions/integrationtrait.php:380 /var/www/html/srs/vendor/laracasts/integrated/src/extensions/traits/laraveltestcase.php:47 /var/www/html/srs/tests/exampletest.php:23 failures! tests: 2, assertions: 8, errors: 1.
i know error means dom-crawler can't find form associated input, don't understand why... thank you!
Comments
Post a Comment