mink

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')) ? :

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

The selected node does not have a form ancestor - Mink error

冷暖自知 提交于 2019-12-10 20:51:18
问题 I'm trying to perform tests on my Magento installation using Mink with Goutte driver, and it fails when I'm trying to use click() or press() functions on a button. Code: $page = $this->getSession()->getPage(); $checkout = $page->find('css', '.btn-proceed-checkout'); $checkout->click(); How to get this work? Why does Mink actually need a form to click a button element? Or is that the problem connected with Goutte not being able to fetch JS? 回答1: TL;DR: use different driver or make sure form

unable to run codeception in virtual machine -Mink could not be found and loaded

家住魔仙堡 提交于 2019-12-10 09:27:19
问题 I installed a vm ubuntu guest OS. My app is running from the browser in my host OS at the url http://abc.localhost:8888 I type php codecept.phar run in the guest OS terminal. I get the following error: [Codeception\Exception\Configuration] Mink could not be found and loaded My acceptance.yml says # Codeception Test Suite Configuration # suite for acceptance tests. # perform tests in browser using the Selenium-like tools. # powered by Mink (http://mink.behat.org). # (tip: that's what your

How to assert page/tab/window title in Behat + Mink

会有一股神秘感。 提交于 2019-12-08 03:12:58
问题 I need to assert a page title for my test, which is the tab/window title using Behat+Mink I tried getWindowName() but realized that is not the function I am looking for. 回答1: You should use a regular find by css for the title tag and use getText() to get the title. The css should be: "head title" Your solution is almost ok, you need to watch for possible exception, especially fatal ones that can stop your suite if encountered. For example find() method will return an object or null , if null

How do I interact with a popup window with Mink, Selenium 2, and Behat?

时光怂恿深爱的人放手 提交于 2019-12-07 17:21:02
问题 I am running through an internal site with Behat and for the most part it is going really well. But the problem is that on certain parts of the site we have popup windows that come up to complete an action. In this case we hit a "Withdraw" button and a popup comes up to have you select a reason and save it. In an ideal world, and if I had actually designed this app, the site wouldn't be using any popup windows. But I am the new guy who is supposed to implement automated functional tests (and

How to assert page/tab/window title in Behat + Mink

只谈情不闲聊 提交于 2019-12-07 11:40:29
I need to assert a page title for my test, which is the tab/window title using Behat+Mink I tried getWindowName() but realized that is not the function I am looking for. You should use a regular find by css for the title tag and use getText() to get the title. The css should be: "head title" Your solution is almost ok, you need to watch for possible exception, especially fatal ones that can stop your suite if encountered. For example find() method will return an object or null , if null is returned and you are using getText() on it it will result in a fatal exception and your suite will stop.