minkphp / minkbundle Goto Github PK
View Code? Open in Web Editor NEWMink library integration bundle for Symfony2
License: MIT License
Mink library integration bundle for Symfony2
License: MIT License
The MinkBundle Documentation link in the README.md file gives a 404 error. I can't seem to find the documentation anywhere else on the web, either.
Hi,
I'm trying to run Mink and Selenium with Symfony.
My composer.json:
"behat/symfony2-extension": "*",
"behat/mink-extension" : "*",
"behat/mink-browserkit-driver" : "*",
"behat/mink-selenium-driver": "*",
My behat.yml:
default:
extensions:
Behat\Symfony2Extension\Extension:
mink_driver: true
Behat\MinkExtension\Extension:
default_session: 'symfony2'
javascript_session: selenium
selenium: ~
VIPSoft\DoctrineDataFixturesExtension\Extension:
fixtures: ~
I'm running selenium using:
java -jar selenium-server-standalone-2.28.0.jar
And the error I'm getting is:
Unexpected response from Selenium server : ERROR Server Exception: sessionId should not be null; has this session been started yet?
While I'm trying to run tests.
Thank you for any suggestions!
Today I received this error
Fatal error: Class 'Behat\Mink\PHPUnit\TestCase' not found in /path/to/my/project/vendor/bundles/Behat/MinkBundle/Test/MinkTestCase.php on line 26
So I went looking in the Behat/Mink repo and yes, the class is not there anymore. It was removed in this commit.
But the master here still requires it :/
Hi,
When I do this:
php ./bin/vendors install
I get this:
> Installing/Updating MinkBundle
788e4a170ab037bf810a26d2b25bfdb7b496df66
HEAD is now at 788e4a1 depend on symfony/framework-bundle instead of entire symfony/symfony
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "behat.mink" has a dependency on a non-existent service "test.client".
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "behat.mink" has a dependency on a non-existent service "test.client".
Here is my deps:
[symfony]
git=http://github.com/symfony/symfony.git
version=v2.0.11
[twig]
git=http://github.com/fabpot/Twig.git
version=v1.6.0
[monolog]
git=http://github.com/Seldaek/monolog.git
version=1.0.2
[doctrine-common]
git=http://github.com/doctrine/common.git
version=2.1.4
[doctrine-dbal]
git=http://github.com/doctrine/dbal.git
version=2.1.6
[doctrine]
git=http://github.com/doctrine/doctrine2.git
version=2.1.6
[swiftmailer]
git=http://github.com/swiftmailer/swiftmailer.git
version=v4.1.5
[assetic]
git=http://github.com/kriswallsmith/assetic.git
version=v1.0.2
[twig-extensions]
git=http://github.com/fabpot/Twig-extensions.git
[metadata]
git=http://github.com/schmittjoh/metadata.git
version=1.0.0
[SensioFrameworkExtraBundle]
git=http://github.com/sensio/SensioFrameworkExtraBundle.git
target=/bundles/Sensio/Bundle/FrameworkExtraBundle
version=origin/2.0
[JMSSecurityExtraBundle]
git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git
target=/bundles/JMS/SecurityExtraBundle
version=origin/1.0.x
[SensioDistributionBundle]
git=http://github.com/sensio/SensioDistributionBundle.git
target=/bundles/Sensio/Bundle/DistributionBundle
version=origin/2.0
[SensioGeneratorBundle]
git=http://github.com/sensio/SensioGeneratorBundle.git
target=/bundles/Sensio/Bundle/GeneratorBundle
version=origin/2.0
[AsseticBundle]
git=http://github.com/symfony/AsseticBundle.git
target=/bundles/Symfony/Bundle/AsseticBundle
version=v1.0.1
[gherkin]
git=https://github.com/Behat/Gherkin.git
target=/behat/gherkin
[behat]
git=https://github.com/Behat/Behat.git
target=/behat/behat
[BehatBundle]
git=https://github.com/Behat/BehatBundle.git
target=/bundles/Behat/BehatBundle
[mink]
git=https://github.com/Behat/Mink.git
target=/behat/mink
[MinkBundle]
git=https://github.com/Behat/MinkBundle.git
target=/bundles/Behat/MinkBundle
And config_test.yml:
imports:
- { resource: config_dev.yml }
framework:
test: ~
session:
storage_id: session.storage.filesystem
web_profiler:
toolbar: false
intercept_redirects: false
swiftmailer:
disable_delivery: true
mink:
base_url: http://localhost/app_test.php
Thanks
Currently Mink is a prototype service and I've lost several hours figuring out why the hell I'm getting different sessions whenever I ask Mink to give me the default session.
It turned out that since Mink is a prototype service, I was getting a new instance of Mink each time I asked it from the container.
Since Mink itself is just a fancy factory, it should be a singleton.
There is a new version of behat/mink-browserkit-driver, that is required for Behat/Mink-extension for symfony projects.
behat/mink-browserkit-driver: ~1.1
Hi, I followed this guide.
http://docs.behat.org/cookbook/using_the_profiler_with_minkbundle.html
I enabled the delivery of emails too, and i can confirm that I receive the email in my account running the test.
But what it means that if I had no messages in $collector = $profile->getCollector('swiftmailer')->getMessages(); ?
I implemented the methods you wrote in that guide ...
Thank you for your precious help.
In alternative, are there any guide that explain how to test symfony2 swiftmailer?
The copyright notice references a file named LICENSE which supposedly comes with the source code. However I cannot find it.
Please add it with the appropriate license terms.
Hi,
I have a strange problem, i have the exception :
Fatal error: Class 'Selenium\Client' not found in .../vendor/behat/mink/src/Behat/Mink/Behat/Context/MinkContext.php on line 214
Normal i have not load Selenium
:
php app/console -e=test cont:deb | grep mink
behat.mink prototype Behat\Mink\Mink
behat.mink.goutte prototype Goutte\Client
behat.mink.selector.css container Behat\Mink\Selector\CssSelector
behat.mink.selector.named container Behat\Mink\Selector\NamedSelector
behat.mink.selectors_handler container Behat\Mink\Selector\SelectorsHandler
behat.mink.session.goutte prototype Behat\Mink\Session
behat.mink.session.symfony prototype Behat\Mink\Session
And my config_test.yml :
mink:
base_url: http://myapp.test/app_test.php
default_session: goutte
goutte: ~
And my context :
<?php
namespace AAA\CoreBundle\Features\Context;
use Behat\BehatBundle\Context\BehatContext,
Behat\BehatBundle\Context\MinkContext;
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
use PHPUnit_Framework_ExpectationFailedException as AssertException;
/**
* Feature context.
*/
class FeatureContext extends \Behat\Mink\Behat\Context\MinkContext
{
}
I want to add the switch "--no-sandbox" to the capabilities from selenium2 but was restricted through the configuration tree.
hi there!
i get following error message when accessing the frontend after installing minkbundle:
"ParameterNotFoundException: The service "behat.test_client" has a dependency on a non-existent parameter "test.client.parameters"."
can you help me?
BR Stephan
There seems to be no easy way to configure guzzle parameters in behat.yml
I need a way to set curl.CURLOPT_SSL_VERIFYPEER = false to be able to test https pages on local machine.
hi there!
minkbundle works great for a single testcase step now, but when i have 2 tests (in one webtestcase) i get an error message after the first test is complete. It's in german, here's how i would translate it: "A firefox copy is already running. It's not possible to run more than one firefox copy at the same time"
you know what i might be doing wrong?
BR Stephan
I tried to integrate a mail send test as outlined here: http://docs.behat.org/cookbook/using_the_profiler_with_minkbundle.html
Problem is: as soon as i run the scenario, I get a 404 response
@mink:symfony Scenario: Publish to some channel Given I am on "/" Then show last response
I know that this is probably not directly related to MinkBundle, but I did not know where to post else.
Can you help me?
I currently have this working with the Selenium driver. When I explicitly set the browser_name in the config_test.yml, it works. It seems I can only pass it one browser/selenium location/etc. Is there any way to have this so when I run PHPUnit from the command line, it can test multiple browsers at once (not necessarily in parallel) and potentially multiple Selenium instances? I know it is possible to do this in the PHPUnit-Selenium library by setting multiple browser parameters in a phpunit.xml file:
<selenium>
<browser name="Internet Explorer" browser="*iexplore" host="192.168.56.101" port="4444" />
<browser name="Firefox" browser="*firefox" />
<browser name="Chrome" browser="googlechrome" />
</selenium>
This bundle was written in the early days of Behat and Mink, when @everzet thought that the proper way to make Behat and Symfony work together was to bring Behat and Mink into Symfony through bundles.
This has since be considered as a mistake. BehatBundle has been deprecated years ago already. and Mink is integrated into Behat through MinkExtension. We also have a much better way to use Mink in PHPUnit through phpunit-mink instead of booting a Symfony kernel into your tests to get a Mink instance from it and start using it.
Thus, this bundle suffers from many issues:
Rather than trying to update the bundle to fix all these points (which would require BC breaks for several of them), I suggest deprecating it and suggest people to use the right tool for the job, i.e. phpunit-mink (which also has more features btw).
what do you think @minkphp/core-team @minkphp/minkbundle ?
Hi, I am running a scenario where I am logged in facebook, after successful login I wanted to go to a specific page but its not working..The error is :
Command execution time limit reached: _sahi._navigateTo(mywebsitelink)
I was thinking may be I can open new tab and check my remain part of test case..
Please help..Thanks.
Hi there,
I'm not sure if this belongs here, but I'm having a problem with Mink when trying to extract translations using JMS Translation Bundle in Symfony2.
I get the following exception whenever I run the translation command. i.e. ./app/console translation:extract en --config=app
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@BeforeScenario" in method Behat\Mink\Behat\Context\BaseMinkContext::prepareMinkSessions() was never imported. Did you maybe forget to add a "use" statement for this annotation?
Thanks,
Chris
sorry for bugging you so much these days- looking forward to working on my own and contributing to the project!
i got my test nearly running, but there is some issue with
$session->getPage()->clickLink('event-save-button');
i'm getting the error message
Behat\Mink\Exception\ElementNotFoundException: link with locator: "event-save-button" not found
strange thing. i have tried to get the button by id or value, without success. I even see, that the button is there in the html when i execute following line in my test
print_r($session->getPage()->getContent());
any ideas what i might doing wrong?
another question regarding element-selection:
will there be a way to select elements by css selectors? this would be so great, cause i don't have an ID for each element on my page, and since we develop a multilang app, we can't use values/labels either...
BR Stephan
Is there a way to show output on browser on html files generated but that are placed on a different tmp folder
in other words, can I control where the files are generated, and also can I also add the assets so that they can load?
Thanks
There's is a problem with the current mink dependency definition in composer.json, when using the ZombieJS browser emulator. The definition states that for the current development state of the Mink Bundle, Mink from version 1.3.2 to 1.4.0-dev are required. Without explicitely defining a version for Mink, composer would install the 1.3.4, which is not compatible to the mink bundle, because it tries to invoke Behat/Mink/Driver/Zombie/Connection, which seems to be renamed to NodeJS/Connection in version 1.3.4. So i had to switch to 1.3.3 for Mink manually, to make the zombie driver work for my symfony installation.
Are there any plans to make Mink Bundle work with the newest Mink versions (>1.4)?
The best practices recommend to use the bundle logical name as github repository name to avoid collision for people forking them (forking both FOSUserBundle and SonataUserBundle before the renaming would have lead to have only one repo on your account, but a messed one for instance).
So the repository should be renamed to BehatMinkBundle (without changing anything in it except the url in the doc). This has been done just now by FOS, Liip and FOQ repos, and will probably be done by other ones as we are asking people to follow the best practice. The sooner it is done the better to avoid changing the repo url after the stable release.
Is there a reason app_test.php is removed from the url in the visit($url) method of the SymfonyDriver class?
In the documentation for the MinkBundle I found the following example for the configuration:
mink:
base_url: http://your-virtualhost.local/app_test.php
So I expected I could run the test against app_test.php. But when I run the test, the test is run against
http://your-virtualhost.local/.
Is there a way to avoid the removal of "*.php/" or overwrite the visit($url) method?
The symlink
#Tests/Resources/public/web-fixtures
../../../vendor/behat/mink/tests/Behat/Mink/Driver/web-fixtures
is broken.
(It causes "rsync -L" to fail)
Using this code from the mink site
mink:
base_url: http://your_app.dev/app_test.php
default_session: goutte
goutte: ~
using "And print last response" I can see the url visited is localhost not the one provided in base_url option
My mink and behat bundles are latest, behat is at ffec3e6f2bc4f94a3b3a953fed58d76902b08e59 because the behat bundle isn't compatible with the latest version
HI there. i get following error when i execute phpunit -c app/ in the cli:
ErrorException: Notice: Undefined index: path in /.../app/bootstrap.php.cache line 1386
Stacktrace:
/Library/WebServer/Documents/eventiply/app/bootstrap.php.cache:382 /Library/WebServer/Documents/eventiply/app/bootstrap.php.cache:1386 /Library/WebServer/Documents/eventiply/vendor/symfony/src/Symfony/Component/HttpKernel/Client.php:99 /Library/WebServer/Documents/eventiply/vendor/symfony/src/Symfony/Component/BrowserKit/Client.php:249 /Library/WebServer/Documents/eventiply/vendor/behat/mink/src/Behat/Mink/Driver/GoutteDriver.php:111 /Library/WebServer/Documents/eventiply/vendor/Behat/MinkBundle/Driver/SymfonyDriver.php:31 /Library/WebServer/Documents/eventiply/vendor/behat/mink/src/Behat/Mink/Session.php:118 /Library/WebServer/Documents/eventiply/src/Ajado/EventHubBundle/ClientTests/MinkTest.php:48
I looked up the line which is making trouble (bootstrap.php.cache:1386), maybe it helps:
$uri = $components['path'] . ($queryString ? '?'.$queryString : '');
Can you help me?
BR Stephan
Hey,
I have followed the tutorial explaining how to install mink with composer available here. So, my composer.json looks like:
{
"name": "symfony/framework-standard-edition",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.2",
"symfony/symfony": "2.1.*",
"doctrine/orm": "2.2.0",
"doctrine/doctrine-bundle": "dev-master",
"twig/extensions": "dev-master",
"symfony/assetic-bundle": "dev-master",
"symfony/swiftmailer-bundle": "dev-master",
"symfony/monolog-bundle": "dev-master",
"sensio/distribution-bundle": "dev-master",
"sensio/framework-extra-bundle": "dev-master",
"sensio/generator-bundle": "dev-master",
"jms/security-extra-bundle": "dev-master",
"behat/behat-bundle": "dev-master",
"behat/mink-bundle": "dev-master"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
},
"repositories": {
"behat/mink-deps": {
"type": "composer",
"url": "behat.org"
}
}
}
All works fine excepts the recommend section is not installed. According to the composer documentation, this section is by default installed. Someone can explain me what is wrong ?
Right now, it's not possible to configure Goutte/Guzzle/cURL to ignore SSL errors.
Config:
mink: base_url: http://domain.com/__test.php/ default_session: selenium selenium: ~
Container source near line 334:
protected function getBehat_MinkService() { $a = $this->get('behat.mink.selectors_handler'); $instance = new \Behat\Mink\Mink(); $instance->registerSession('symfony', new \Behat\Mink\Session(new \Behat\MinkBundle\Driver\SymfonyDriver(new \Symfony\Bundle\FrameworkBundle\Client($this->get('kernel'), array(), new \Symfony\Component\BrowserKit\History(), new \Symfony\Component\BrowserKit\CookieJar())), $a)); $instance->registerSession('selenium', new \Behat\Mink\Session(new \Behat\Mink\Driver\SeleniumDriver('*firefox', 'http://guru-dev.com/__test.php/', new \Selenium\Client('127.0.0.1', 4444)), $a)); $instance->setDefaultSessionName('selenium'); return $instance; }
Where I can get \Selenium\Client? I don't see this in the docs.
@stof thanks, yeah we need it tagged
Hi,
Is there any way to define differente browsers to sahi with this bundle? i thought it could be done in config_test.yml but i didn't found anything about it.
What is the best way to do that?
Thanks
I have followed all the procedure for getting sahi working
it finally works but I get 500 error page
Warning: session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /home/cordoval/sites-2/x/vendor/symfony/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php line 87
This problem has been happening on and off and i think it started when I installed mink/behat bundles...
how can I narrow down the problem?
http://www.craftitonline.com/2011/07/symfony2-keep-your-project-guided-with-behat-and-mink/
The latest commit 543f881 causes an exception to be thrown when using the SymfonyDriver:
The given callback ([array] Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelResponse) for event "kernel.response" is not callable.
Backing out this commit to 58d04a9 resolves the issue. This is with Symfony 2.0.11 (deps and deps.lock as per the 2.0.11 release). I'll try and see if I can get a test case for this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.