I am moving to codeception 2.0.3 for doing some tests in various web platforms I am developing. I started doing some acceptance testing. Mainly check for pages ok and doing some form completions (sign in, sign up, nothing fancy).
I have been monitoring tests with firefox browser and we are moving now tests to a dedicated server so I switched to phantomjs as my testing browser.
Configuration in acceptance.suite.yml
WebDriver:
url: 'localUrl'
browser: phantomjs
window_size: 'maximize'
capabilities:
phantomjs.cli.args: ['--ignore-ssl-errors=true']
The thing is that with this headless configuration, tests are running very slowly. I mean, the test I wrote is checking that four links are OK (no error or exception message) without any fancy assertions (something which I can check in less than 20 secs) and it is taking more than a minute a half.
Am I missing something in the configuration of the testing stack? I read that phantomjs testing in this way is supossed to be fast and reliable something that can be integrated while developing but I don't seem to get it working right. I have been doing TDD in Smalltalk and maybe I am a little biased with the way that things work in that environment so maybe my expectations are too high but I had hopes that this could be a little more responsive and easy going.
I am using codeception 2.0.3 with phantomjs 1.9.7 on a linux box with php 5.5.
Any suggestion is welcomed. Thanks!!!
I had very slow running tests and started using strict locators. That sped up things a lot.
Instead of writing:
$I->fillField('username, 'john');
which will try and fail many locator types before actually working, specify the locator you are using and write:
$I->fillField(['id' => 'username'], 'john');
or
$I->fillField(['class' => 'username'], 'john');
or
$I->fillField(['css' => 'input .username'], 'john');
Read here: http://codeception.com/docs/04-AcceptanceTests#Click
Could be problem with phantomjs, usually headless with Codeception PhpBrowser goes very fast, try to switch to it.
For in-browser try to use Codeception WebDriver + latest selenium 2 standalone.
Also if you are developing with some framework, you can check if it is present in Codeception modules list. If so you can use it, it runs much faster than PhpBrowser since it does not need any server and works with symfony dom - crawler and browser - kit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With