mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Fix docs with page object extension usage
This commit is contained in:
parent
67d1927d17
commit
5221eec29f
2 changed files with 8 additions and 8 deletions
|
|
@ -122,7 +122,7 @@ Usage example of ``->getElement('your_element')`` and ``->getDefinedElements`` m
|
|||
class CreatePage extends SymfonyPage implements CreatePageInterface
|
||||
{
|
||||
// This method returns a simple associative array, where the key is the name of your element and the value is its locator.
|
||||
protected function getDefinedElements()
|
||||
protected function getDefinedElements(): array
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
'provinces' => '#sylius_country_provinces',
|
||||
|
|
@ -131,7 +131,7 @@ Usage example of ``->getElement('your_element')`` and ``->getDefinedElements`` m
|
|||
|
||||
// By default it will assume that your locator is css.
|
||||
// Example with xpath.
|
||||
protected function getDefinedElements()
|
||||
protected function getDefinedElements(): array
|
||||
{
|
||||
return array_merge(parent::getDefinedElements(), [
|
||||
'provinces' => ['xpath' => '//*[contains(@class, "provinces")]'] // Now your value is an array where key is your locator type.
|
||||
|
|
@ -223,7 +223,7 @@ And the country "France" should appear in the store".
|
|||
return $this->getElement('sidebar')->getText();
|
||||
}
|
||||
|
||||
protected function getDefinedElements()
|
||||
protected function getDefinedElements(): array
|
||||
{
|
||||
return ['sidebar' => ['css' => '.sidebar']]
|
||||
}
|
||||
|
|
@ -242,7 +242,7 @@ And the country "France" should appear in the store".
|
|||
return $this->getElement('sidebar')->getText();
|
||||
}
|
||||
|
||||
protected function getDefinedElements()
|
||||
protected function getDefinedElements(): array
|
||||
{
|
||||
return ['sidebar' => ['css' => '.sidebar']]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ To create a new page object it is needed to add a service in Behat container in
|
|||
|
||||
.. note::
|
||||
|
||||
There are some boilerplates for common pages, which you may use. The available parents are ``sylius.behat.page`` (``Sylius\Behat\Page\Page``)
|
||||
and ``sylius.behat.symfony_page`` (``Sylius\Behat\Page\SymfonyPage``). It is not required for a page to extend any class as
|
||||
There are some boilerplates for common pages, which you may use. The available parents are ``sylius.behat.page`` (``FriendsOfBehat\PageObjectExtension\Page\Page``)
|
||||
and ``sylius.behat.symfony_page`` (``FriendsOfBehat\PageObjectExtension\Page\SymfonyPage``). It is not required for a page to extend any class as
|
||||
pages are POPOs (Plain Old PHP Objects).
|
||||
|
||||
Then you will need to add that service as a regular argument in context service.
|
||||
|
|
@ -22,11 +22,11 @@ The simplest Symfony-based page looks like:
|
|||
|
||||
.. code-block:: php
|
||||
|
||||
use Sylius\Behat\Page\SymfonyPage;
|
||||
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
|
||||
|
||||
class LoginPage extends SymfonyPage
|
||||
{
|
||||
public function getRouteName()
|
||||
public function getRouteName(): string
|
||||
{
|
||||
return 'sylius_user_security_login';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue