Write and execute a test for an existing app
in less then a 5 mins!
Published on August 29, 2013
A minor release with one major announcement. In 1.6.6 most bugfixes were included from pull requests. Thanks for everyone who did the contributions.
Also a very tiny new module was included. It’s Sequence which was created to generate unique data for your tests. Sequnces become pretty handy if you don’t do database cleanup before each tests. They guarantee you can get unique names and values for each test.
<?php
$I = new WebGuy\PostSteps($scenario);
$I->wantTo('create a post');
$I->createPost('Post'.sq(1), 'Lorem Ipsum');
$I->see('Post created sucessfully');
$I->see('Post'.sq(1), '#posts');
?>No matter how much times you execute this test, each time you see a new post is created with different name.
redownload your codeception.phar for update:
wget https://codeception.com/codecept.phar -O codecept.pharfor composer version
$ php composer.phar updateIn July a group of Facebook developers set the goal to write the complete new Selenium Webdriver bindings. They decided to do it finally the right way, with the same WebDriver interface it is used in other languages like Java and C#. Ironically, Selenium2 module of Codeception uses the old webdriver bindings from Facebook.They were very hard in use, and had lots of issues. Most common issues were solved in Element34 fork, which was then forked by Instaclick to bring namespaces and PSR-0, which was then used in Mink’s Selenium2Driver, and Mink was used in Codeception.
Pretty tricky, right?
Currently there are 3 WebDriver bindings in PHP.
Ok. Now we have new facebook webdriver bindings. They are in active development and they lack proper documentation. But the good part of it, that even without documentation you will easily learn how to work with them. Any question on StackOverflow with examples in Java or C# will work in PHP just the same way.
In Codeception master we created a new WebDriver module which uses new webdriver bindings.
This module will be included into first 1.7 release, but it won’t be recommended for regular use before the stable version of php-webdriver is released.
To try the new WebDriver you should switch to dev-master in composer.json or use the pre-prelease phar package.
WebDriver module does not implement everyhting the Selenium2 module has. There is no right clicks, drag and drops, and more. But there are few handy improvements:
submitForm action as in PhpBrowser.waitForElement action to wait for element to appear on page.selectOption and checkOption now both work with radio buttons.seeElementInDOM to check the invisible elements.waitForElementChange to wait that element changedwait config prameter (default is 5 secs).maximizeWindow specially for @aditya- :).In all other ways its pretty compatible with Selenium2 module. Try it on your own risk or wait for stable versions.