php - Behat\Laravel can't find submit -


i'am trying test laravel app behat. there homepage fields name, email , "register" button. i'm trying press button in behat-test, have error fatal error: call member function press() on null (behat\testwork\call\exception\fatalthrowableerror)

my html:

<html>      <head>      </head>      <title>registration</title>      <body>          <form action="/thanks" name="register">              <p align="center"><font size="4"><b>please, enter name , e-mail</b></font></p>              <p align="center"><input name="name" type="text" value="name"></p>              <p align="center"><input name="email" type="text" value="e-mail"></p>              <p align="center"><input name="registerbutton" type="submit" value="register"></p>              <p>&nbsp;</p>          </form>      </body>  </html>

my featurecontext function:

/**  * @when press :submit  */  public function ipressthesubmit($submit) {     $element=$this->getsession()->getpage()->findbutton($submit);          $element->click(); } 

scenario:

scenario: register test given on homepage when press "registerbutton" should on "/thanks" 

output:

scenario: register test # features/regpage.feature:4 given on homepage # featurecontext::iamonhomepage() when press "registerbutton" submit # featurecontext::ipressthesubmit() fatal error: call member function press() on null (behat\testwork\call\exception\fatalthrowableerror) should on "/thanks" # featurecontext::assertpageaddress() --- failed scenarios: features/regpage.feature:4 1 scenario (1 failed) 3 steps (1 passed, 1 failed, 1 skipped)

behat.yml: default: extensions: laracasts\behat: # env_path: .env.behat behat\minkextension: default_session: laravel base_url: localhost:8000 laravel: ~

i fixed 2 steps: 1. setting app_key parameters in .env , .env.behat files 2. fixing featurecontent file this:

 /**  * @when press :arg1  */ public function ipressthe($arg1) {     $element=$this->getsession()->getpage()->find('named', array('id_or_name', $arg1));     $element->press(); } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -