Mink+Behat: missing session -


i trying follow http://docs.behat.org/cookbook/behat_and_mink.html tutorial

i installed mink+behat using following composer.json:

    "require": {         "behat/behat": "2.4.*@stable",         "behat/mink": "1.4.*@stable",         "behat/mink-extension": "*",         "behat/mink-goutte-driver": "*",         "behat/mink-selenium2-driver": "*"     },     "minimum-stability": "dev",     "config": {         "bin-dir": "bin/"     } } 

i did init created features directory.

bin/behat --init 

i created search.features in features directory:

feature: search   in order see word definition   website user   need able search word    scenario: searching page exist     given on "/wiki/main_page"     when fill in "search" "behavior driven development"     , press "searchbutton"     should see "agile software development"    scenario: searching page not exist     given on "/wiki/main_page"     when fill in "search" "glory driven development"     , press "searchbutton"     should see "search results" 

i updated features/bootstrap/featurecontext.php extend minkcontext.

if run bin/behat -dl see following definitions loaded:

given /^(?:|i )am on (?:|the )homepage$/  when /^(?:|i )go (?:|the )homepage$/ given /^(?:|i )am on "(?p<page>[^"]+)"$/  when /^(?:|i )go "(?p<page>[^"]+)"$/  when /^(?:|i )reload page$/  when /^(?:|i )move backward 1 page$/  when /^(?:|i )move forward 1 page$/  when /^(?:|i )press "(?p<button>(?:[^"]|\\")*)"$/  when /^(?:|i )follow "(?p<link>(?:[^"]|\\")*)"$/  when /^(?:|i )fill in "(?p<field>(?:[^"]|\\")*)" "(?p<value>(?:[^"]|\\")*)"$/  when /^(?:|i )fill in "(?p<field>(?:[^"]|\\")*)" with:$/  when /^(?:|i )fill in "(?p<value>(?:[^"]|\\")*)" "(?p<field>(?:[^"]|\\")*)"$/  when /^(?:|i )fill in following:$/  when /^(?:|i )select "(?p<option>(?:[^"]|\\")*)" "(?p<select>(?:[^"]|\\")*)"$/  when /^(?:|i )additionally select "(?p<option>(?:[^"]|\\")*)" "(?p<select>(?:[^"]|\\")*)"$/  when /^(?:|i )check "(?p<option>(?:[^"]|\\")*)"$/  when /^(?:|i )uncheck "(?p<option>(?:[^"]|\\")*)"$/  when /^(?:|i )attach file "(?p[^"]*)" "(?p<field>(?:[^"]|\\")*)"$/  /^(?:|i )should on "(?p<page>[^"]+)"$/  /^(?:|i )should on (?:|the )homepage$/  /^the (?i)url(?-i) should match (?p<pattern>"([^"]|\\")*")$/  /^the response status code should (?p<code>\d+)$/  /^the response status code should not (?p<code>\d+)$/  /^(?:|i )should see "(?p<text>(?:[^"]|\\")*)"$/  /^(?:|i )should not see "(?p<text>(?:[^"]|\\")*)"$/  /^(?:|i )should see text matching (?p<pattern>"(?:[^"]|\\")*")$/  /^(?:|i )should not see text matching (?p<pattern>"(?:[^"]|\\")*")$/  /^the response should contain "(?p<text>(?:[^"]|\\")*)"$/  /^the response should not contain "(?p<text>(?:[^"]|\\")*)"$/  /^(?:|i )should see "(?p<text>(?:[^"]|\\")*)" in "(?p<element>[^"]*)" element$/  /^(?:|i )should not see "(?p<text>(?:[^"]|\\")*)" in "(?p<element>[^"]*)" element$/  /^the "(?p<element>[^"]*)" element should contain "(?p<value>(?:[^"]|\\")*)"$/  /^the "(?p<element>[^"]*)" element should not contain "(?p<value>(?:[^"]|\\")*)"$/  /^(?:|i )should see an? "(?p<element>[^"]*)" element$/  /^(?:|i )should not see an? "(?p<element>[^"]*)" element$/  /^the "(?p<field>(?:[^"]|\\")*)" field should contain "(?p<value>(?:[^"]|\\")*)"$/  /^the "(?p<field>(?:[^"]|\\")*)" field should not contain "(?p<value>(?:[^"]|\\")*)"$/  /^the "(?p<checkbox>(?:[^"]|\\")*)" checkbox should checked$/  /^the checkbox "(?p<checkbox>(?:[^"]|\\")*)" (?:is|should be) checked$/  /^the "(?p<checkbox>(?:[^"]|\\")*)" checkbox should not checked$/  /^the checkbox "(?p<checkbox>(?:[^"]|\\")*)" should (?:be unchecked|not checked)$/  /^the checkbox "(?p<checkbox>(?:[^"]|\\")*)" (?:unchecked|not checked)$/  /^(?:|i )should see (?p<num>\d+) "(?p<element>[^"]*)" elements?$/  /^print current url$/  /^print last response$/  /^show last response$/ 

but try test search.features , error:

php fatal error:  call member function getsession() on non-object in /home/nishant/behat/vendor/behat/mink-extension/src/behat/minkextension/context/rawminkcontext.php on line 103 

i did google of error be, didnot find more useful telling put behat.yml in right place.

my bin/behat -> ../vendor/behat/behat/bin/behat symlink , have tried putting behat.yml in vendor/behat/behat/behat.yml. content on behat.yml

default:     extensions:         behat\minkextension\extension:             base_url: http://en.wikipedia.org             goutte: ~             selenium2: ~ 

any appreciated!!

if go vendor/behat/behat , create search.feature , run bin/behat error:

  [reflectionexception]   class guzzle\http\client not exist 

ok.. managed fix problem !

added these lines in __construct() method in features/bootstrap/featurecontext.php

$clientoptions = array(); $client = new \behat\mink\driver\goutte\client(); $client->setclient(new \guzzle\http\client('', $clientoptions)); $driver = new \behat\mink\driver\gouttedriver($client); 

also updated composer.json

{     "require": {         "behat/behat": "2.4.*@stable",         "behat/mink": "1.4.*@stable",         "behat/mink-extension": "*",         "behat/mink-goutte-driver": "1.0.*",         "behat/mink-selenium2-driver": "*",         "guzzle/http": "*"     },     "minimum-stability": "dev",     "config": {         "bin-dir": "bin/"     } } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -