Skip to content
This repository has been archived by the owner on Mar 19, 2018. It is now read-only.

cargomedia/webnavigator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UNMAINTAINED

This project is not maintained anymore. If you want to take over contact us at tech@cargomedia.ch.

webnavigator Build Status

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

About

UNMAINTAINED. Simple php-webdriver wrapper for automated acceptance tests

Resources

License

Stars

Watchers

Forks

Packages

No packages published