Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Behat] Improve dashboard page extensibility #10713

Merged
merged 1 commit into from
Sep 27, 2019

Conversation

loic425
Copy link
Member

@loic425 loic425 commented Sep 27, 2019

Q A
Branch? 1.4
Bug fix? yes (for BDD)
New feature? no
BC breaks? no BC breaks promise on Behat
Deprecations? no
Related tickets
License MIT

When adding grids on admin dashboard, if you extends Sylius\Behat\Page\Admin\DasboardPage, You have no access to tableAccessor to add some tests on your custom grids.

For information, my current workaround:

<?php

declare(strict_types=1);

namespace App\Tests\Behat\Page\Admin;

use Behat\Mink\Session;
use Sylius\Behat\Page\Admin\DashboardPage as BaseDashboardPage;
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
use Symfony\Component\Routing\RouterInterface;

class DashboardPage extends BaseDashboardPage
{
    /** @var TableAccessorInterface */
    private $tableAccessor;

    public function __construct(
        Session $session,
        $minkParameters,
        RouterInterface $router,
        TableAccessorInterface $tableAccessor
    ) {
        parent::__construct($session, $minkParameters, $router, $tableAccessor);

        $this->tableAccessor = $tableAccessor;
    }

    public function getNumberOfProductsToReviewInTheList(): int
    {
        return $this->tableAccessor->countTableBodyRows($this->getElement('products_to_review_list'));
    }
}

@loic425 loic425 requested a review from a team as a code owner September 27, 2019 07:55
@lchrusciel lchrusciel added the DX Issues and PRs aimed at improving Developer eXperience. label Sep 27, 2019
@lchrusciel lchrusciel changed the base branch from master to 1.4 September 27, 2019 13:48
@lchrusciel lchrusciel merged commit 7e7e0fd into Sylius:1.4 Sep 27, 2019
@lchrusciel
Copy link
Member

Thanks, Loïc! 🥇

@loic425 loic425 deleted the fix/improve-dashboard-page branch September 27, 2019 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Issues and PRs aimed at improving Developer eXperience.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants