behat

Behat 3 - how to retrieve custom extension in context

十年热恋 提交于 2019-12-06 09:27:59
I need to add and later from context retrieve extra options/configuration from behat.yml file. Behat is not allowing me to add some random parameters into behat.yml file, so I created new custom extension. This extension is allowing me to pass specific config values extensions: App\Behat\DevToolsExtension: api_url: "https://api.example.com" So now behat is not complaining about new configuration in behat.yml file. Now I'm stuck. How can I retrieve this configuration from my extension in runtime? I'm setting existing parameters in my extension within public function load(ContainerBuilder

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

China☆狼群 提交于 2019-12-06 07:47:04
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 31 My 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-extension": " " }, "minimum-stability": "dev", "config": { "bin-dir": "bin/" } } And

BDD and Behat special characters

血红的双手。 提交于 2019-12-06 06:33:31
问题 There is a similar question @ Gherkin in Behat and input validations scenarios However is not the same. My problem is that I need to had to scenario outlines examples or to arrays Given I have a problem with data | in | this | array | | how | can | I | | add | special | characters | Most of special characters are ok, but wat about quotes and pipes? special characters example: \|!"#$%&/()=?«»'{}[]'`^~*+ºª-_.:,;<>@ł€¶ŧ←↓→øþĸħŋđðßæ|«»¢“”nµ Thanks 回答1: I know that a year has passed since this was

Element must be user-editable in order to clear it (Behat)

人走茶凉 提交于 2019-12-06 05:19:40
I am automating a website using the Behat framework, working in PHPStorm, have the latest chromedriver and selenium jar up and running: I cant seem to interact with standard Date fields across the site e.g: input type="date" ng-show="options.editEnabled" Feature file: Then I select a start date of "01012014" public function startDate ($date) { $this->getElement('startDate')->setValue($date); } Returns an error of invalid element state: Element must be user-editable in order to clear it. I have used the same across dozens of other websites using the same code with no problems, does anyone have

Behat context per feature

泄露秘密 提交于 2019-12-06 04:17:52
问题 I am wondering if there is a way to use different context classes for different features. I would like to have one feature use MinkExtensions for browser testing and another one using and HTTP client like Guzzle for API testing - both would have similar steps with different implementation. 回答1: It should be possible in Behat 3. See http://everzet.com/tagged/Behat Feature: "Multi-contextual runs with support for per-tag, per-directory and per-role context classes. This “importance of the role”

for each element with behat or codeception

爱⌒轻易说出口 提交于 2019-12-06 03:17:42
问题 I want to test a website which has a dynamic menustructure. I want to loop through all menuitems and run the same series of test on every page. We're talking about 100+ pages that change reguraly. I would like to do this with either behat or codeception. Does anybody have an idea about how to do this? 回答1: When using Behat with Mink, you can grab your menu items with findAll() and then iterate over it: /** * @When /^I run my test series for all menu items$/ */ public function

Step definitions in external files in Behat

爱⌒轻易说出口 提交于 2019-12-05 21:59:39
问题 Behat by default looks for the step definitions in file named FeatureContext (all steps in one file). Having a lot of steps, it's hard to maintain such a big file. I'd like to have one definition file per feature file. How can I have step definitions in external files? e.g. homepage.feature HomepageContext extends FeatureContext 回答1: Use class inheritance and separate contexts. # /features/contexts/ AbstractContext extends BehatContext {} FeaturenameContext extends AbstractContext {} Then in

Behat “Unrecognized options”

匆匆过客 提交于 2019-12-05 18:36:46
问题 I'm trying to run Behat (first time for me) and it worked. But i have a configuration problem. I tried to change the paths of features and bootstrap like so: #behat.yml default: paths: features: app/tests/features bootstrap: %behat.paths.features%/bootstrap Now i'm getting an exception: [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException] Unrecognized options "paths" under "testwork" What did i do wrong? 回答1: Behat 3 is out by now. You configure paths as follows:

Filling in hidden inputs with Behat

廉价感情. 提交于 2019-12-05 10:42:09
I am writing Behat tests and I need to change the value of a hidden input field <input type="hidden" id="input_id" ..... /> I need to change the value of this input field, but I keep getting Form field with id|name|label|value "input_id" not found I have been using the step $steps->And('I fill in "1" for "input_id"', $world); Is there something special which needs to be done to modify hidden input fields? Despite the fact that user can't fill hidden fields, there are some situations when this is desirable to be able to fill hidden field for testing (as usually rules have exceptions). You can

Laravel 5 testing in memory

非 Y 不嫁゛ 提交于 2019-12-05 09:50:43
I am writing tests via behat for my large Laravel 5 project. I have a testing copy of my MySQL database in MySQL and a seeder for that database that shares some of the seeders of other environments. All of that works as expected. However, I tried switching to using a sqlite in-memory database because it would speed up my automated tests dramatically and because I'm running "artsian migrate:refresh ---seeder=TestDatabaseSeeder at the start of every behat scenario. The problem I'm having is that some of my seed data causes sqlite to throw a very non-descript syntax error but MySQL is completely