FAQ Database Discussion Community


Behat / Mink error Snippets for the following steps not generated

php,bdd,behat,mink
When switching over from Behat to Mink in v3 to use headless browser for testing. It stops generating Snippets for me automatically from my feature files. Following the setup for features/bootstrap/FeatureContext.php from the docs. behat # generates this error at the bottom of the output --- Snippets for the following...

I can't connect to my site

selenium,behat,mink
I've just started playing around with behat, and I was loving it. Then I shut down my computer and went home for the day and when I came back, nothing worked for me anymore!! I've been trying to trouble shoot this for a couple of days, but looks like the...

Behat fails runing after updating dependencies

php,composer-php,behat
Just updated composer on a functioning Behat, and now getting the following messages open running behat. PHP Deprecated: "Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Im using Behat-3 ([email protected]). Any advice will be appreciated :)...

behat formatters in version 3

php,behat,formatter
With v3 behat seems to have changed the formatter options in the config yml. There is no formatter section anymore but only a formatters one. What I want is to get rid of the comments in the default output like # FeatureContext::iSetTheParameterTo() because they are 1. black on black by...

Can behat check that steps are defined before trying to run anything?

php,testing,bdd,behat
I've got a behat scenario that takes a long time to run. If I've written a step incorrectly, I have to wait for the test to hit that step before I find out my mistake when it tells me I've got an undefined step. Is there a way to get...

Testing behaviour of classes with deep nested dependencies

php,testing,tdd,bdd,behat
I am starting using Behat and I was thinking what is the correct way to do something like this: I am testing system behaviour with Behat (the domain, not web) and i want to test behaviour that uses UserService class. UserService takes UserRepository (Interface) as an argument. Should i create...

“Unable to open database file” error when trying to load Doctrine Data Fixtures in Symfony

symfony2,doctrine2,behat
I'm using pdo_mysql for prod, stag and dev environments and pdo_sqlite for test environment. The problem is that loading Doctrine Data Fixtures generates unable to open database file error as shown below. I assigned the permissions to cache folder as defined in symfony website and also tried with 777 but...

Behat 3 with Laravel 5: acceptance test passes but it should not

php,laravel-5,behat,mink
I'm doing my firsts acceptance tests for a Laravel 5 application using Behat 3 and Mink. The application runs under a Homestead VM. The test is straightforward and is located in the features/example.feature file. This is the test: Feature: Sample In order to learn Behat As a programmer I need...

Behat checking multiple pages

php,unit-testing,behat,acceptance-testing
Lets say I have a few page slugs in the database which I would like to check with Behat if the pages are returning header status code 200. This means I want to have one test(feature) which will check multiple pages, however I'm struggling in how to do this. Right...

Spawning interactive CLI command with Expect exits with 0 early, when run as Symfony Process in Behat context

php,bash,symfony2,expect,behat
This is quite an advanced question, perhaps knowledge of Symfony and Behat may not be necessary to understand the problem. So in order to test the input and output of an interactive CLI app bin/albumgrab I've written in PHP using the Symfony Console component, I've set up my Behat feature...

Behat does not recognize a defined step

php,behat,mink
I am having an issue with Behat and Mink. When running I am being prompted to add a #2 to my function declaration. Here is my composer file for version info { "require": { "behat/behat": "2.5.*@stable", "behat/mink": "~1.6", "behat/mink-extension": "~1.0", "behat/mink-goutte-driver": "~1.1", "fabpot/goutte": "~1.0.4", "behat/mink-selenium2-driver": "*" }, "config": { "bin-dir":...

How to fix Class 'Behat\Behat\Output\Printer\ConsoleOutputPrinter' not found

php,plugins,phpstorm,behat
Im trying to use the Behat plugin for PHPStorm (on Behat 3). the problem is once i try to run a feature i will receiving the following Fatal error: Fatal error: Class 'Behat\Behat\Output\Printer\ConsoleOutputPrinter' not found in /private/var/folders/js/27x3tw5n5jx9b14vn_cn12w0748zmg/T/ide-behat.php on line 82 I had a look in the Behat source i can...

PHP, BDD with Behat and Mink (Selenium2 driver): How to close the browser window at the end of the test programatically?

php,selenium-webdriver,bdd,behat,mink
I am trying to learn BDD in PHP with Behat and Mink and I am using Selenium2 driver for the same. My question is once the tests are over, how to programmatically close each browser window/tab that Selenium2 opens? Since closing so many browser windows/tabs each time after each test...

Behat 3 - Behat\Behat\Context\Step\Given not found

php,bdd,behat,mink
I'm testing Behat/Mink for the first time with a simple example. When I launch behat I have this error : PHP Fatal error: Class 'Behat\Behat\Context\Step\Given' not found in /var/www/behat-test/features/bootstrap/FeatureContext.php on line 31 features/bootstrap/FeatureContext.php : <?php require_once './vendor/autoload.php'; use Behat\Behat\Context\Context; use Behat\Behat\Context\SnippetAcceptingContext; use Behat\MinkExtension\Context\MinkContext; use Behat\Behat\Context\Step; class FeatureContext extends MinkContext implements...

Behat/Mink and Select2 combo

php,jquery-select2,behat,mink
I try to create a Behat scenario with web UI using Select2. When I try to change the select value, I've an Behat error because of the base select which is hide by Select2. But I already have an error with the select2 component because mink can not interact with...

Enabling Mink Extension in Behat

bdd,behat,mink
I'm trying to add the Mink extension to Behat. I've installed Behat, Mink and Mink-Extension through composer. However, now I'm having trouble with enabling the extension. Here is my behat.yml: default: extensions: Behat\MinkExtension\Extension: base_url: http://en.wikipedia.org goutte: ~ selenium2: ~ Here is my example test: Feature: New In order to test...

Behat and Symfony data fixtures

php,symfony2,phpunit,fixtures,behat
I'm wondering is it possible to use separate database for the Behat tests? is there any way to drop and truncate database and load data fixtures with it like you can do with PHPUnit?

There is no element matching XPath “//html” (Behat\Mink\Exception\DriverException)

symfony2,xpath,behat,mink,symfony-2.7
I really can't figure out why Mink / Behat cannot find "Login" text. My scenario is simple enough: Scenario: Valid Registration Given I am on "/register/" Then the response status code should be 200 Then print current URL Then show last response Then I should see "Login" And the output...

How to require vendor/autoload.php with behat.yml

composer-php,behat
In my project I have an autoload.php file which is responsible for requiring context classes. This is the file auto-generated by Composer. How can I include that file using behat.yml? In PHPUnit's phpunit.xml.dist I can do this simply with bootstrap attribute like this: <phpunit bootstrap="vendor/autoload.php"> Is there a similar setting...