Behat 2.4 upgrade issues, or Unrecognized options "extensions" under "behat" - error when attempting to activate sahi extension via behat.yml

Fairly new to this Behat stuff, and I've run into a roadblock I can't seem to get around. I've been staring at the docs, googling like it's my job, and doing my best to refrain from tossing my computer off the fire escape.I'm working with a fairly complex project, and I'm not the one who set it up. So I'm a little lost in some areas.Currently, I'm trying to use the Sahi driver, because selenium isn't cutting it for some dynamic forms I need to test. I can run the tests fine with the default selenium driver, but the tests fail because it doesn't...Read more

browserstack - Unrecognized options "suites" under "behat"

I am using behat 2.4(stable), and I am trying to pass parameters into class's, that extends BehatContext class, constructor.However I get 'Unrecognized options "suites" under "behat"', with the following set up.I am using the following behat.yml file:default: suites: default: contexts: exampleContext: browser: http://localhost:8080 browser_version: /var/tmp paths: features: %behat.paths.base%/../../ bootstrap: %behat.paths.base%/../../ extensions: Behat\MinkExtension\Extension: # base_url is...Read more

Is it possible to override step definitions in a behat context?

Is it possible to have have a subcontext class extend another subcontext and override functions?At present I have class TestContext extends BehatContext { /** * @Given /^a testScenarioExists$/ */ public function aTestscenarioexists() { echo "I am a generic test scenario\n"; }}andclass SpecialTestContext extends TestContext { /** * @Given /^a testScenarioExists$/ */ public function aTestscenarioexists() { echo "I am a special test scenario\n"; }}In feature context I tell it us the SpecialTestContext...Read more

Mink+Behat: missing session

I was just trying to follow the http://docs.behat.org/cookbook/behat_and_mink.html tutorialI installed Mink+Behat using the 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 the init that created the features directory.bin/behat --initI created a search.features in the features...Read more

Behat : Cant activate the mink extension in feature context

I try to create a context with Behat but I have always this error :"Mink instance has not been set on Mink context class. Have you enabled the Mink Extension? (RuntimeException)"I tried a lot of things to activate it, I change my behat.yml, I add to composerbut nothing changing.I tried all the solutions i saw on the web, now i'm lost...This is the behat.yml default: extensions: Behat\MinkExtension: goutte: ~ selenium2: ~ sessions: goutte: goutte: ~ selenium2: ...Read more

behat - Guzzle HTTP client: Extract plain text or HTML from the response

Does anyone know how to extract html response from Guzzle HTTP client? If you look at the example below, we can get xml and json response easily but I don't know how to get plain text or HTML response string.Documentation didn't have an option for plain text or HTML unlike json() and xml().$client = new Client($base_url);$request = $client->createRequest($method, $uri, null, $this->requestPayload);$response = $client->send($request);$xml = $response->xml(); // For XML response$json = $response->json(); // For JSON response$html =...Read more

Installing behat on a Symfony 2.0 project using deps - what versions?

I have a legacy Symfony 2.0 project (version 2.0.11 to be precise) to which I'd like to add behat tests. As it's Symfony 2.0, it uses the deps vendor system rather than composer. I'm not in a position to upgrade the Symfony version or switch to composer at the moment.I attempted to install behat using the following deps settings:[Mink] target=/Behat/Mink git=git://github.com/Behat/Mink.git version=v1.3.3[MinkBundle] target=/Behat/MinkBundle git=git://github.com/Behat/MinkBundle.git[BehatBundle] target=/Behat/BehatBundle g...Read more

Is it ok to test repository with behat?

I want to test functionality of adding user.I wrote the following scenario:Feature: Add users In order to have users As an admin I need to be able to add users to database Rules: - User has a name Scenario: Adding user with name 'Jonas' Given There is no user 'Jonas' When I add the user with name 'Jonas' Then I should have user 'Jonas' in a systemAnd the following test:<?phpuse AppBundle\Repository\UserRepository;use Behat\Behat\Tester\Exception\PendingException;use Behat\Behat\Context\Context;use Behat\Behat\Context\SnippetAc...Read more

Behat with symfony flex

I want to use behat with symfony flexWhen i inject service in behat context file inside constructor, the autowire dont works.I need to explicitly configure service to public to use that service in behat.Is there another way to inject service in behat context file without making it public?Here i am getting below errorThe "App\DataConsumer" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead. behat.yml default: ...Read more

autoloader - Additional directories with behat

I'm putting together automated testing with behat - and encountered an issue I can't seem to find a solution to.My behat.yml has all the usual stuff; I got directories for features and boostrap - and it all works.Now, I have a separate directory, which contains additional classes that I need during the test execution. While I can, of course, use lots of require, I'm sure there's a better way to add a directory to the autoloader - yet I can't figure out how.For example, I have the following directory structure:test/ features/ bootstrap/ ...Read more

behat - Javascript redirects on page->open

Using behat/mink, I'm testing the "remember me" functionality. Functionally, when the user visits the main page, javascript/ajax code verifies if the user is "remembered". If yes, then the javascripts redirects to another page. My LoginPage is defined with $path = '/login.html' - after the redirect, I will end up on /main.html.In my context, I use $loginPage->open() - however this throws exception Expected to be on "https://example.com/login.html" but found "https://example.com/main.html" instead. Naturally, this aborts the execution and ...Read more

When running `bin/behat` I get a "Class not found" error

When I run bin/behat I get this error. PHP Fatal error: Class 'Symfony\Component\Console\Application' not found in /vendor/behat/behat/src/Behat/Behat/Console/BehatApplication.php on line 31My composer.json file contains this: { "require": { "drupal/drupal-extension": "", "behat/behat": "2.4.@stable", "behat/mink": "1.4@stable", "behat/mink-goutte-driver": "", "behat/mink-selenium-driver": "", "behat/mink-selenium2-driver": "", "behat/mink-sahi-driver": "", "behat/mink-zombie-driver": "", "behat/mink-e...Read more