cargomedia / webnavigator
This package is abandoned and no longer maintained.
No replacement package was suggested.
0.1.2
2016-02-26 14:49 UTC
Requires
- facebook/webdriver: ~1.1.1
Requires (Dev)
- phpunit/phpunit: ~4.6.10
- tomaszdurka/mocka: ~0.10.0
This package is not auto-updated.
Last update: 2020-01-24 15:48:51 UTC
README
This project is not maintained anymore. If you want to take over contact us at tech@cargomedia.ch.
webnavigator
Wrapper for facebook/php-webdriver for simple automated acceptance tests.
PhantomJS
WebNavigator can connect to the WebDriver server of PhantomJS. Start PhantomJS in a console like this:
phantomjs --webdriver=4444 --ssl-protocol=tlsv1 --ignore-ssl-errors=true
Example
Setting up a WebNavigator instance in a PHPUnit test case and doing some basic tests:
class MyTest extends \PHPUnit_Framework_TestCase { /** @var \WebNavigator\Navigator */ private $_navigator; protected function setUp() { $capabilities = new \DesiredCapabilities([\WebDriverCapabilityType::BROWSER_NAME => 'phantomjs']); $driver = \RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities); $this->_navigator = new \WebNavigator\Navigator($driver, 'https://www.denkmal.org'); } protected function tearDown() { $this->_navigator->quit(); } public function testAddPage() { $this->_navigator->get('/events'); $this->_navigator->click('.addButton a'); $this->_navigator->waitForElement('.Denkmal_Page_Add'); $this->assertContains('Event hinzufügen', $this->_navigator->getText('h1')); $this->assertContains('/add', $this->_navigator->getUrl()); $this->_navigator->takeScreenshot('screenshot.png'); } }
Development
Install dependencies:
composer install
Before running tests make sure you have phantomjs and a web server running:
phantomjs --webdriver=4444 & php -S localhost:1234 -t tests/data/ &
Then run the tests:
php vendor/bin/phpunit