2017 © Pedro Peláez
 

package mink-page-objects

Implementation of Page Objects Pattern for Mink

image

goez/mink-page-objects

Implementation of Page Objects Pattern for Mink

  • Friday, April 15, 2016
  • by jaceju
  • Repository
  • 0 Watchers
  • 2 Stars
  • 4,172 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 13 Versions
  • 5 % Grown

The README.md

Page Objects Pattern for Mink

Build Status, (*1)

Alpha version, (*2)

Install

$ composer require goez/mink-page-objects --dev

Usage

Creating a page class for Google homepage:, (*3)

use Goez\PageObjects\Page;

class Home extends Page
{
    protected $elements = [
        'SearchForm' => ['css' => 'form'],
    ];

    public function search($keyword)
    {
        return $this->getPart(SearchForm::class)
            ->search($keyword);
    }
}

Create a page class for searched result:, (*4)

use Goez\PageObjects\Page;

class SearchResult extends Page
{
}

Creating an element object for searching form:, (*5)

use Goez\PageObjects\Part;

class SearchForm extends Part
{
    /**
     * @param $keyword
     * @return SearchResult
     * @throws \Behat\Mink\Exception\ElementNotFoundException
     */
    public function search($keyword)
    {
        $this->element->fillField('q', $keyword);
        $this->element->submit();

        return $this->createPage(SearchResult::class);
    }
}

Instantiating a page object and verify keyword searching:, (*6)

use Behat\Mink\Driver\Selenium2Driver;
use Behat\Mink\Session;
use Goez\PageObjects\Context;

class GoogleSearchTest extends PHPUnit_Framework_TestCase
{
    // Install phantomjs first
    // and you can use this trait
    // for starting phantonjs automatically
    use PhantomJSRunner;

    public function testSearchWithKeyword()
    {
        $driver = new Selenium2Driver('phantomjs');

        $session = new Session($driver);
        $session->start();

        $context = new Context($session, [
            'baseUrl' => 'https://www.google.com',
        ]);

        $context->createPage(Home::class)
            ->open()
            ->search('example')
            ->shouldContainText('Example Domain');
    }
}

License

MIT, (*7)

The Versions

15/04 2016

dev-master

9999999-dev

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

17/11 2015

0.3.3

0.3.3.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

10/11 2015

0.3.2

0.3.2.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

09/11 2015

0.3.1

0.3.1.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

06/11 2015

0.3.0

0.3.0.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

05/11 2015

0.2.2

0.2.2.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

04/11 2015

0.2.1

0.2.1.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

03/11 2015

0.2.0

0.2.0.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

02/11 2015

0.1.8

0.1.8.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

02/11 2015

0.1.7

0.1.7.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

30/10 2015

0.1.6

0.1.6.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

30/10 2015

0.1.5

0.1.5.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju

30/10 2015

0.1.4

0.1.4.0

Implementation of Page Objects Pattern for Mink

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jace Ju