diff --git a/src/Shopify.php b/src/Shopify.php index ebc93532a5d550db6a370d1154f75ee8088e5135..7fa0902285e241285e83970441f2e66ae752db09 100644 --- a/src/Shopify.php +++ b/src/Shopify.php @@ -11,7 +11,7 @@ use Exception; class Shopify extends WebDriver { - public function loginAsAdmin() + public function loginAsAdmin(): void { $i = $this; $isPl = false; @@ -64,4 +64,22 @@ class Shopify extends WebDriver $i->saveSessionSnapshot('admin'); } + public function amOnPage($page): void + { + parent::amOnPage($page); + $this->loginOnFront(); + } + + public function loginOnFront(): void + { + $i = $this; + try { + $i->seeInCurrentUrl('password'); + $i->fillField('password', $this->config['store_password']); + $i->click('button[type=submit]'); + } catch (Exception $e) { + // do nothing + } + } + }