Danger

This is an outdated documentation please read the new Monofony documentation instead.

How to add a new page object?ΒΆ

Sylius uses a solution inspired by SensioLabs/PageObjectExtension, which provides an infrastructure to create pages that encapsulates all the user interface manipulation in page objects.

To create a new page object it is needed to add a service.

The simplest Symfony-based page looks like:

use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;

class LoginPage extends SymfonyPage
{
    public function getRouteName(): string
    {
        return 'app_frontend_security_login';
    }
}

Note

There are some boilerplates for common pages, which you may use. The available parents are FriendsOfBehat\PageObjectExtension\Page\Page and FriendsOfBehat\PageObjectExtension\Page\SymfonyPage. It is not required for a page to extend any class as pages are POPOs (Plain Old PHP Objects).