From ac0bb8b0854a5426b5395c3cbbc107c31ad15623 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola <grola@seostudio.pl> Date: Fri, 18 Aug 2023 13:40:42 +0200 Subject: [PATCH] feature(init): init --- src/Shopify.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Shopify.php b/src/Shopify.php index ebc9353..7fa0902 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 + } + } + } -- GitLab