use of WebDriver gives error
Closed this issue · 17 comments
I used always the webdriver and launched a server with phantomjs
with the command:
phantomjs --webdriver=4444
in my general tests i works, but when I try to use it with webception it fails with this error:
- Failed to perform search and be redirected to yhs in �BloompyCept.php�
#1 /home/tzookb/work/webception/vendor/symfony/eventdispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
#2 /home/tzookb/work/webception/vendor/symfony/eventdispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53
��FAILURES!
���Tests: 1, Assertions: 0, Errors: 1.
I updated the codeception from 1.8 to 2.0
and it worked, I would suggest to update the composer.lock so the app could use the new codeception version
How can I update codeception inside Webception? I'm triying everything but it breaks the web :/
Go to the composer.json and simply update conception from 1.8 to 2.0 and than perform composer update
I've done that, but now the tests won't work (AbstractGuy.php don't exist anymore). I'm trying to fix it...
EDIT: I changed the WebGuy Actor to the AcceptanceTester Actor, and now it works!
yes because in 2.0 there is no more "AbstractGuy" there is "AcceptanceTester"
please check for the new classes for your :
$I = new AcceptanceTester($scenarion);
//in your code it probably is
$I = new AbstractGuy($scenarion);
//or something similiar... please check codeception for the new classes to use
//sorry I dont remember them...
Yep, I've edited it. But still throws me an error:
Codeception PHP Testing Framework v2.0.1
Powered by PHPUnit 4.1.3 by Sebastian Bergmann.
Acceptance Tests (1)
Error
Time: 5.28 seconds, Memory: 8.50Mb
There was 1 error:
1) Failed to do nothing and pass! in TheTestThatPassesCept (/var/www/html/codeception/webception/App/Tests/acceptance/TheTestThatPassesCept.php)
#1 /var/www/html/codeception/webception/vendor/symfony/eventdispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
#2 /var/www/html/codeception/webception/vendor/symfony/eventdispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
My acceptance.suite is:
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
- WebHelper
- REST
config:
REST:
url: 'http://webception/'
timeout: 90
WebDriver:
url: 'http://www.bebedeparis.com/es'
browser: firefox
How did you fix that?
lets start that from scratch....
open a new test folder, and with terminal perform
//codeception is globally on my compuer, you should call it however you have it...
//maybe /projectFolder/vendor/bin/codecept i think....
$ codeception init
the init simply create a full folder with all the necessary stuff for the tests, than if that works so copy your tests from old folder and merge them to the new one
It throws me an error: "Command init is not defined".
But I mean, webception works great when using PhpBrowser, only fails when using WebDriver.
I simply edited the acceptance.suite from a clean installation (well, clean installation and post-upgrade to 2.0). I didn't created any test yet.
ahhhh so ok....
if you are using webdriver instead of phpbrowser.... you should have a webdriver....
you could use selenium or I use phantomjs
read more about it in codeception docs of
http://codeception.com/docs/04-AcceptanceTests#Selenium-WebDriver
and you can see my small ref blog I have for myself
http://tzookb.wordpress.com/2014/06/27/php-testing-browser-with-codeception/
Yup, but I have Selenium + Firefox headless server running, I mean, using the client of codeception (php codecept.phar run) works like a charm, but it won't when using Webception, so I will try phantomjs...
What's your config?
no configs.... simpy run the server with
phantomjs --webdriver=4444
and than run it....
phantomjs --webdriver=4444 running, testing the "The Test That Passes", but it still throws me an error:
This is my acceptance config, is like yours?
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
- WebHelper
- REST
config:
REST:
url: 'http://webception/'
timeout: 90
WebDriver:
url: 'http://localhost/'
browser: phantomjs
The error is:
Codeception PHP Testing Framework v2.0.1
Powered by PHPUnit 4.1.3 by Sebastian Bergmann.
Acceptance Tests (1)
ERROR
Time: 188 ms, Memory: 8.50Mb
There was 1 error:
1) Failed to do nothing and pass! in TheTestThatPassesCept (/var/www/html/codeception/webception/App/Tests/acceptance/TheTestThatPassesCept.php)
#1 /var/www/html/codeception/webception/vendor/symfony/eventdispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
#2 /var/www/html/codeception/webception/vendor/symfony/eventdispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
EDIT: Doing the php codecept.phar run
works.
in my config the borwser is firefox, but I dont think that is the problem.
I had your errors but when I upgraded to version 2 they stopped.
So I cant really help, as I did the same and it solved my errors.
and Im sorry it is not
codecept.phar init
it is
codecept bootstrap
use bootstrap for opening a new tests project and than start working on it
Okay, I'll try to "reinstall" webception and start from scratch. Thanks a lot for helping me!
Still won't work, can you send me a zip with you Webception working (without any acceptance test)? I really need it :/
Sent it to your mail
Received, downloaded, tested and working! Yay! :D Really thanks! (even it goes a bit slowly, but at least works!). Thanks again! ;)
EDIT: I tried to add REST module, but if I do, WebDriver won't work, so that was the problem too!