diff --git a/src/Sylius/Behat/Context/Ui/Admin/DashboardContext.php b/src/Sylius/Behat/Context/Ui/Admin/DashboardContext.php
index fedabec76cb..52b281e79d1 100644
--- a/src/Sylius/Behat/Context/Ui/Admin/DashboardContext.php
+++ b/src/Sylius/Behat/Context/Ui/Admin/DashboardContext.php
@@ -65,14 +65,6 @@ public function iLogOut(): void
$this->dashboardPage->logOut();
}
- /**
- * @When I go back one page in the browser
- */
- public function iGoBackOnePageInTheBrowser(): void
- {
- $this->dashboardPage->goBackInTheBrowser();
- }
-
/**
* @Then I should see :number new orders
*/
diff --git a/src/Sylius/Behat/Context/Ui/BrowserContext.php b/src/Sylius/Behat/Context/Ui/BrowserContext.php
new file mode 100644
index 00000000000..544704d13d5
--- /dev/null
+++ b/src/Sylius/Behat/Context/Ui/BrowserContext.php
@@ -0,0 +1,36 @@
+browserElement = $browserElement;
+ }
+
+ /**
+ * @When I go back one page in the browser
+ */
+ public function iGoBackOnePageInTheBrowser(): void
+ {
+ $this->browserElement->goBack();
+ }
+}
diff --git a/src/Sylius/Behat/Context/Ui/UserContext.php b/src/Sylius/Behat/Context/Ui/UserContext.php
index 252b80fdf02..3da2d86ed92 100644
--- a/src/Sylius/Behat/Context/Ui/UserContext.php
+++ b/src/Sylius/Behat/Context/Ui/UserContext.php
@@ -69,14 +69,6 @@ public function iDeleteAccount($email)
$this->customerShowPage->deleteAccount();
}
- /**
- * @When I go back one page in the browser
- */
- public function iGoBackOnePageInTheBrowser(): void
- {
- $this->homePage->goBackInTheBrowser();
- }
-
/**
* @Then the user account should be deleted
*/
diff --git a/src/Sylius/Behat/Element/BrowserElement.php b/src/Sylius/Behat/Element/BrowserElement.php
new file mode 100644
index 00000000000..3743fa94fc7
--- /dev/null
+++ b/src/Sylius/Behat/Element/BrowserElement.php
@@ -0,0 +1,24 @@
+getDriver()->back();
+ }
+}
diff --git a/src/Sylius/Behat/Element/BrowserElementInterface.php b/src/Sylius/Behat/Element/BrowserElementInterface.php
new file mode 100644
index 00000000000..4f533b13d57
--- /dev/null
+++ b/src/Sylius/Behat/Element/BrowserElementInterface.php
@@ -0,0 +1,19 @@
+getElement('channel_choosing_link', ['%channelName%' => $channelName])->click();
}
- public function goBackInTheBrowser(): void
- {
- $this->getDriver()->back();
- }
-
public function getRouteName(): string
{
return 'sylius_admin_dashboard';
diff --git a/src/Sylius/Behat/Page/Admin/DashboardPageInterface.php b/src/Sylius/Behat/Page/Admin/DashboardPageInterface.php
index 03615799efc..e5220e82709 100644
--- a/src/Sylius/Behat/Page/Admin/DashboardPageInterface.php
+++ b/src/Sylius/Behat/Page/Admin/DashboardPageInterface.php
@@ -36,6 +36,4 @@ public function isSectionWithLabelVisible(string $name): bool;
public function logOut(): void;
public function chooseChannel(string $channelName): void;
-
- public function goBackInTheBrowser(): void;
}
diff --git a/src/Sylius/Behat/Page/Shop/HomePage.php b/src/Sylius/Behat/Page/Shop/HomePage.php
index d87b7c2438f..8d5ecbca5eb 100644
--- a/src/Sylius/Behat/Page/Shop/HomePage.php
+++ b/src/Sylius/Behat/Page/Shop/HomePage.php
@@ -103,11 +103,6 @@ function (NodeElement $element) {
);
}
- public function goBackInTheBrowser(): void
- {
- $this->getDriver()->back();
- }
-
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
diff --git a/src/Sylius/Behat/Page/Shop/HomePageInterface.php b/src/Sylius/Behat/Page/Shop/HomePageInterface.php
index 19bb4ac18aa..948865257b0 100644
--- a/src/Sylius/Behat/Page/Shop/HomePageInterface.php
+++ b/src/Sylius/Behat/Page/Shop/HomePageInterface.php
@@ -38,6 +38,4 @@ public function getAvailableLocales(): array;
public function switchLocale(string $localeCode): void;
public function getLatestProductsNames(): array;
-
- public function goBackInTheBrowser(): void;
}
diff --git a/src/Sylius/Behat/Resources/config/services/contexts/ui.xml b/src/Sylius/Behat/Resources/config/services/contexts/ui.xml
index f5dc1e78188..b98059d3fb3 100644
--- a/src/Sylius/Behat/Resources/config/services/contexts/ui.xml
+++ b/src/Sylius/Behat/Resources/config/services/contexts/ui.xml
@@ -299,6 +299,10 @@
+
+
+
+
diff --git a/src/Sylius/Behat/Resources/config/services/elements.xml b/src/Sylius/Behat/Resources/config/services/elements.xml
index 659d57b131f..36d55417c4e 100644
--- a/src/Sylius/Behat/Resources/config/services/elements.xml
+++ b/src/Sylius/Behat/Resources/config/services/elements.xml
@@ -20,10 +20,13 @@
+
+
+
diff --git a/src/Sylius/Behat/Resources/config/suites/ui/account/customer.yml b/src/Sylius/Behat/Resources/config/suites/ui/account/customer.yml
index e86ba712e35..12b5861363c 100644
--- a/src/Sylius/Behat/Resources/config/suites/ui/account/customer.yml
+++ b/src/Sylius/Behat/Resources/config/suites/ui/account/customer.yml
@@ -33,6 +33,7 @@ default:
- sylius.behat.context.setup.user
- sylius.behat.context.setup.zone
+ - sylius.behat.context.ui.browser
- sylius.behat.context.ui.channel
- sylius.behat.context.ui.email
- sylius.behat.context.ui.shop.account
diff --git a/src/Sylius/Behat/Resources/config/suites/ui/admin/dashboard.yml b/src/Sylius/Behat/Resources/config/suites/ui/admin/dashboard.yml
index 2d2d07bfc20..0a3844c97fc 100644
--- a/src/Sylius/Behat/Resources/config/suites/ui/admin/dashboard.yml
+++ b/src/Sylius/Behat/Resources/config/suites/ui/admin/dashboard.yml
@@ -28,6 +28,7 @@ default:
- sylius.behat.context.ui.admin.dashboard
- sylius.behat.context.ui.admin.login
- sylius.behat.context.ui.admin.notification
+ - sylius.behat.context.ui.browser
filters:
tags: "@admin_dashboard&&@ui"