Skip to content

Commit

Permalink
remove unneded usages, moved helper to proper directory
Browse files Browse the repository at this point in the history
  • Loading branch information
arti0090 committed Dec 3, 2020
1 parent 703ffb8 commit a4db4cb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/Sylius/Behat/Context/Ui/Admin/NotificationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
use Behat\Behat\Context\Context;
use Sylius\Behat\NotificationType;
use Sylius\Behat\Service\NotificationCheckerInterface;
use Sylius\Behat\JavaScriptTestHelper;
use Sylius\Behat\JavaScriptTestHelperInterface;
use Webmozart\Assert\Assert;
use Sylius\Behat\Service\Helper\JavaScriptTestHelperInterface;

final class NotificationContext implements Context
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace Sylius\Behat\Context\Ui\Shop\Checkout;

use Behat\Behat\Context\Context;
use Sylius\Behat\JavaScriptTestHelperInterface;
use Sylius\Behat\Service\Helper\JavaScriptTestHelperInterface;
use Sylius\Behat\Page\Shop\Checkout\AddressPageInterface;
use Sylius\Behat\Page\Shop\Checkout\SelectShippingPageInterface;
use Sylius\Behat\Service\SharedStorageInterface;
Expand Down
4 changes: 3 additions & 1 deletion src/Sylius/Behat/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@

<service id="sylius.behat.shared_storage" class="Sylius\Behat\Service\SharedStorage" public="false"/>

<service id="sylius.behat.java_script_test_helper" class="Sylius\Behat\JavaScriptTestHelper" />
<service id="sylius.behat.java_script_test_helper" class="Sylius\Behat\Service\Helper\JavaScriptTestHelper" >
<argument>100000</argument>
</service>

<service id="sylius.calendar" class="Sylius\Behat\Service\Provider\Calendar">
<argument>%kernel.project_dir%</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@

declare(strict_types=1);

namespace Sylius\Behat;
namespace Sylius\Behat\Service\Helper;

use Behat\Mink\Exception\ElementNotFoundException;

final class JavaScriptTestHelper implements JavaScriptTestHelperInterface
{
private $sleepTime;

public function __construct(int $sleepTime)
{
$this->sleepTime = $sleepTime;
}

public function waitUntilNotificationPopups(int $timeout, callable $assertion): void
{
$start = microtime(true);
Expand All @@ -17,7 +24,7 @@ public function waitUntilNotificationPopups(int $timeout, callable $assertion):
try {
$assertion();
} catch (ElementNotFoundException $exception) {
usleep(100000);
usleep($this->sleepTime);

continue;
}
Expand All @@ -37,7 +44,7 @@ public function waitUntilAssertionPasses(int $timeout, callable $assertion): voi
try {
$assertion();
} catch (\InvalidArgumentException $exception) {
usleep(100000);
usleep($this->sleepTime);

continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Sylius\Behat;
namespace Sylius\Behat\Service\Helper;

interface JavaScriptTestHelperInterface
{
Expand Down

0 comments on commit a4db4cb

Please sign in to comment.