Quality assurance utilities for functional tests.
Library implements Page Object Pattern, used in variety of testing frameworks (e.g. Selenium browser automation framework).
Required dependencies:
- behat/mink - for browser interaction
- mindplay/annotations - for annotation handling
No internal dependencies.
Implementation of Page Object pattern as done in Selenium Java library.
Name | Description |
---|---|
\aik099\QATools\PageObject\Page |
Abstract class for creating dedicated classes for each of the website pages, that needs to be tested (descendant of DocumentElement). |
\aik099\QATools\PageObject\Element\WebElement |
Class for interacting with one element on page (descendant of NodeElement). |
\aik099\QATools\PageObject\Element\ElementContainer |
Abstract class for creating dedicated classes, that will encapsulate associated elements on a page. |
Name | Description |
---|---|
@find-by |
Tells how to find element on a page. |
@page-url |
Sets default url, associated with a Page. |
- create subclass from
\aik099\QATools\PageObject\Page
class - add class properties, that have
\aik099\QATools\PageObject\Element\WebElement
or\aik099\QATools\PageObject\Element\ElementContainer
in their@var
annotation - create public method(-s), that would use properties defined before
Depends on aik099\QATools\PageObject
.
This library solves major problem with PageObject implementation, that original library had - each element had all methods and even ones, that have no effect on element itself. For example a setValue
method existed for a H1 tag.
Name | Description |
---|---|
\aik099\QATools\HtmlElements\TypifiedPage |
Abstract class for creating dedicated classes for each of website pages, that needs to be tested. |
\aik099\QATools\HtmlElements\TypifiedElement |
Base class for all other elements in this library, that wraps around WebElement and only exposes methods, that are common for all elements. |
\aik099\QATools\HtmlElements\ElementContainer |
Abstract class for creating dedicated classes, that will encapsulate associated elements on a page (typified version of \aik099\QATools\PageObject\ElementContainer ). |
\aik099\QATools\HtmlElements\LabeledElement |
Element, that has associated LABEL element on a page (e.g. radio button or a checkbox). |
\aik099\QATools\HtmlElements\Button |
Button. |
\aik099\QATools\HtmlElements\Checkbox |
Checkbox. |
\aik099\QATools\HtmlElements\Form |
Form. |
\aik099\QATools\HtmlElements\Link |
Link. |
\aik099\QATools\HtmlElements\RadioGroup |
Group of radio buttons. |
\aik099\QATools\HtmlElements\Select |
Dropdown. |
\aik099\QATools\HtmlElements\TextBlock |
Div or span. |
\aik099\QATools\HtmlElements\TextInput |
Text box or text area. |
\aik099\QATools\HtmlElements\FileInput |
Single file upload. |
Name | Description |
---|---|
@name |
Sets optional element name to be used instead of ClassName in error messages (e.g. when element was not found on a page). |
- create subclass from
\aik099\QATools\HtmlElements\TypifiedPage
class - add class properties, that have
\aik099\QATools\PageObject\Element\WebElement
or any other element class described above in their@var
annotation - create public method, that would use properties defined before
Depends on aik099\QATools\PageObject
.
According to BEM methodology (http://bem.info/) the following restrictions apply:
- there can't be nested blocks
- each element must be placed within a block
But single HTML node (or it's element) can be within different blocks at same time.
Name | Description |
---|---|
\aik099\QATools\BEM\Element\Element |
Represents a single element on a page, that must be placed within a Block. |
\aik099\QATools\BEM\Element\Block |
Abstract class for creating dedicated classes, that will encapsulate associated elements on a page. |
Name | Description |
---|---|
@bem |
Unified annotation for both Block and Element. |
- create a subclass from
\aik099\QATools\BEM\Element\Block
class to for each block on a page - add class properties, that have
\aik099\QATools\BEM\Element\Element
in their@var
annotation for each individual element in each block (or alternatively use$this->getElements
method in theBlock
class) - create subclass from
\aik099\QATools\BEM\BEMPage
class - add class property with previously created block subclass name in it's
@var
annotation for each individual block
- Define the dependencies in your
composer.json
:
{
"require": {
"aik099/qa-tools": "dev-master"
}
}
- Install/update your vendors:
$ curl http://getcomposer.org/installer | php
$ php composer.phar install