behat

Mink with Selenium2: follow all redirects

流过昼夜 提交于 2019-12-11 10:45:16
问题 How to force Selenium2 to follow all redirects before doing some asserts? Scenario: Guest member can pay with card When I go to "/test" #test page redirects to "/auth" which then redirects to "/main" Then I should be redirected to "/main" I figured that I could simply wait: /** * @Then /^I should be redirected to "([^"]*)"$/ */ public function assertRedirect($url) { $this->getSession()->wait(10000); $this->assertPageAddress($url); } The problem is that however long I wait, I always end up on

Behat/Mink/Selenium2 element is not visible

旧城冷巷雨未停 提交于 2019-12-11 09:38:36
问题 I'm writing my tests with behat and I'm facing a problem when I try to call fillField on a input inside a bootstrap modal. When I send fillField in this input selenium throws an exception saying: Element is not currently visible and so may not be interacted with I've created a selenium (via selenium IDE) test manually and called type on the same field and it worked fine. $page = $this->getSession()->getPage() $page->fillField("id_item", $value); The $value is a parameter from my test. I've

Behat/Mink doesn't find field by id

…衆ロ難τιáo~ 提交于 2019-12-11 07:46:58
问题 I am trying to fill out a field. Why does Behat not find the field by id? Input Field: <input class="js-text-full text-full form-text required" data-drupal-selector="edit-field-article-nr-supplier-0-value" type="text" id="edit-field-article-nr-supplier-0-value" name="field_article_nr_supplier[0][value]" value="" size="60" maxlength="255" placeholder="" required="required" aria-required="true"> PHP Code: public function fillField($field, $value) { $field = $this->fixStepArgument($field);

Behat run again a scenario programmatically

非 Y 不嫁゛ 提交于 2019-12-11 07:18:54
问题 After a question on stackoverflow Parameters in Behat 3 Ian found a solution for pass to behat parameters. For environment it's ok, but for country parameters I'm a bit confused. I have a feature like this : Scenario Outline: Test if first link works Given I am on website "<country>" Then I visit the url "my-url" Then I click on first link Examples: | country | | US | | IT | This is what I have, and now I want to run something like : env="stg" country="US,IT" php53 bin/behat --suite=mySuite

How to rollback commits in Behat functional tests with Symfony2 and Doctrine?

守給你的承諾、 提交于 2019-12-11 05:46:27
问题 I'm writing functional tests with Behat and Mink in a Symfony2 application. I make use of the data that's already in the database to make the tests instead of adding fixtures (a lot would be needed). Therefore, I can't use a SQLite database only for the test environment as data would not be available. My tests work fine, but data is persisted in the database when tests are run. How can I automatically clean up data that's been persisted with Doctrine after a scenario is run? I can't use a

Behat + Symfony, Custom definitions are not loaded

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 04:38:49
问题 I've installed Behat on my Symfony2 project but my custom definitions are not loaded, did I miss something? behat.yml default: paths: features: features extensions: Behat\Symfony2Extension\Extension: mink_driver: true kernel: env: test debug: true Behat\MinkExtension\Extension: base_url: 'http://myproject.local/app_test.php/' goutte: ~ features/bootstrap/FeatureContext.php <?php use Behat\Behat\Context\ClosuredContextInterface, Behat\Behat\Context\TranslatedContextInterface, Behat\Behat

Javascript redirects on page->open

谁说我不能喝 提交于 2019-12-11 04:14:07
问题 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"

Behat 3: How to get profile name inside FeatureContext

a 夏天 提交于 2019-12-11 03:43:03
问题 I am starting behat with ./bin/behat --suite=SuiteName --profile=profile_name Is it possible to get current behat profile name inside FeatureContext especially inside BeforeSuiteScope /** * @BeforeSuite */ public static function beforeSuite(BeforeSuiteScope $scope) { } 回答1: So I found brute force method, I know probably its not the best way of getting profile name, but it works. $input = new ArgvInput($_SERVER['argv']); $profile = $input->getParameterOption(array('--profile', '-p')) ? :

Dealing with a large string in Gherkin with Scenario Outline

走远了吗. 提交于 2019-12-11 03:32:12
问题 I'm using Behat for BDD and using Scenario Outlines so I can easily do the same test with other data. But I got a problem with large texts. See example below: Scenario Outline: create a thing When I click on "New" Then I should be at "/thing/new" When I fill in "title" with <title> When I fill in "description" with "description" When I click on "save" Then I should be at "/things" Then I should see <title> in the list When I click on <title> Then I should see <title> Then I should see

Mink + PhantomJS: How do I set the user agent?

梦想的初衷 提交于 2019-12-11 03:06:35
问题 I am using phantomjs with mink: default: extensions: Behat\MinkExtension\Extension: goutte: ~ selenium2: browser: phantomjs wd_host: http://localhost:8643/wd/hub capabilities: webStorageEnabled: true But I need to masquerade as the latest chrome. I have tried this: /** * @BeforeStep */ public function masqueradeAsLatestChrome(StepEvent $event) { $this->getSession()->setRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049