From 2078c0685416a16327e4221b096ee3e1932c9271 Mon Sep 17 00:00:00 2001 From: Daniil Tkachev Date: Tue, 17 Sep 2024 17:10:52 +0200 Subject: [PATCH] --draft-- --- tests/Codeception/Acceptance/AlipayCest.php | 2 +- .../Codeception/Acceptance/BancontactCest.php | 24 ++++++++-------- tests/Codeception/Acceptance/BaseCest.php | 8 ------ .../Codeception/Acceptance/CreditCardCest.php | 28 +++++++++---------- .../Codeception/Acceptance/WeChatPayCest.php | 2 +- 5 files changed, 28 insertions(+), 36 deletions(-) diff --git a/tests/Codeception/Acceptance/AlipayCest.php b/tests/Codeception/Acceptance/AlipayCest.php index bfb5d6dd..acfa566b 100644 --- a/tests/Codeception/Acceptance/AlipayCest.php +++ b/tests/Codeception/Acceptance/AlipayCest.php @@ -49,7 +49,7 @@ private function checkAlipayPayment(int $methodNumber) { $price = str_replace(',', '.', $this->getPrice()); $alipayClientData = Fixtures::get('alipay_client'); - $alipayPage = new LocalPaymentMethodsSimulatorPage($this->getAcceptance()); + $alipayPage = new LocalPaymentMethodsSimulatorPage($this->I); $alipayPage->login($alipayClientData['username'], $alipayClientData['password'], $price); $alipayPage->choosePaymentMethod($methodNumber); diff --git a/tests/Codeception/Acceptance/BancontactCest.php b/tests/Codeception/Acceptance/BancontactCest.php index 4e4f0810..ecc6324d 100644 --- a/tests/Codeception/Acceptance/BancontactCest.php +++ b/tests/Codeception/Acceptance/BancontactCest.php @@ -75,18 +75,18 @@ private function submitBancontactPayment(string $name) $price = str_replace(',', '.', $this->getPrice()); $fixtures = Fixtures::get($name); - $this->getAcceptance()->waitForText($price); - $this->getAcceptance()->waitForElement($this->cardNumberInput); - $this->getAcceptance()->fillField($this->cardNumberInput, $fixtures['cardnumber']); - $this->getAcceptance()->selectOption($this->monthExpiredSelect, 12); - $this->getAcceptance()->selectOption($this->yearExpiredSelect, date('Y')); - $this->getAcceptance()->fillField($this->cvvCodeInput, $fixtures['CVC']); - $this->getAcceptance()->click($this->continueButton); - - $this->getAcceptance()->waitForPageLoad(); - $this->getAcceptance()->waitForText($price); - $this->getAcceptance()->waitForElement($this->continueButton, 30); - $this->getAcceptance()->click($this->continueButton); + $this->I->waitForText($price); + $this->I->waitForElement($this->cardNumberInput); + $this->I->fillField($this->cardNumberInput, $fixtures['cardnumber']); + $this->I->selectOption($this->monthExpiredSelect, 12); + $this->I->selectOption($this->yearExpiredSelect, date('Y')); + $this->I->fillField($this->cvvCodeInput, $fixtures['CVC']); + $this->I->click($this->continueButton); + + $this->I->waitForPageLoad(); + $this->I->waitForText($price); + $this->I->waitForElement($this->continueButton, 30); + $this->I->click($this->continueButton); } /** diff --git a/tests/Codeception/Acceptance/BaseCest.php b/tests/Codeception/Acceptance/BaseCest.php index e55b6790..c4680e67 100644 --- a/tests/Codeception/Acceptance/BaseCest.php +++ b/tests/Codeception/Acceptance/BaseCest.php @@ -271,14 +271,6 @@ protected function submitOrder(): void $this->I->waitForPageLoad(30); } - /** - * @return AcceptanceTester - */ - protected function getAcceptance(): AcceptanceTester - { - return $this->I; - } - /** * @return string price of order */ diff --git a/tests/Codeception/Acceptance/CreditCardCest.php b/tests/Codeception/Acceptance/CreditCardCest.php index cdb39675..7369b008 100644 --- a/tests/Codeception/Acceptance/CreditCardCest.php +++ b/tests/Codeception/Acceptance/CreditCardCest.php @@ -50,17 +50,17 @@ private function submitCreditCardPayment(string $name) $this->choosePayment($this->cardPaymentLabel); $fixtures = Fixtures::get($name); - $this->getAcceptance()->waitForPageLoad(); - $this->getAcceptance()->waitForElement($this->cardNumberIframe); - $this->getAcceptance()->switchToIFrame($this->cardNumberIframe); - $this->getAcceptance()->fillField($this->cardNumberInput, $fixtures['cardnumber']); - $this->getAcceptance()->switchToNextTab(1); - $this->getAcceptance()->switchToIFrame($this->expireDateIframe); - $this->getAcceptance()->fillField($this->expireDateInput, '12/' . date('y')); - $this->getAcceptance()->switchToNextTab(1); - $this->getAcceptance()->switchToIFrame($this->CVCIframe); - $this->getAcceptance()->fillField($this->CVCInput, $fixtures['CVC']); - $this->getAcceptance()->switchToFrame(null); + $this->I->waitForPageLoad(); + $this->I->waitForElement($this->cardNumberIframe); + $this->I->switchToIFrame($this->cardNumberIframe); + $this->I->fillField($this->cardNumberInput, $fixtures['cardnumber']); + $this->I->switchToNextTab(1); + $this->I->switchToIFrame($this->expireDateIframe); + $this->I->fillField($this->expireDateInput, '12/' . date('y')); + $this->I->switchToNextTab(1); + $this->I->switchToIFrame($this->CVCIframe); + $this->I->fillField($this->CVCInput, $fixtures['CVC']); + $this->I->switchToFrame(null); $this->submitOrder(); } @@ -70,8 +70,8 @@ private function submitCreditCardPayment(string $name) */ private function checkCreditCardPayment() { - $this->getAcceptance()->waitForText($this->toCompleteAuthentication, 60); - $this->getAcceptance()->click($this->toCompleteAuthentication); + $this->I->waitForText($this->toCompleteAuthentication, 60); + $this->I->click($this->toCompleteAuthentication); $this->checkSuccessfulPayment(); } @@ -84,7 +84,7 @@ private function checkCreditCardPayment() private function updateArticleStockAndFlag($stock, $flag) { $article = Fixtures::get('product'); - $this->getAcceptance()->updateInDatabase( + $this->I->updateInDatabase( 'oxarticles', ['OXSTOCK' => $stock, 'OXSTOCKFLAG' => $flag], ['OXID' => $article['id']] diff --git a/tests/Codeception/Acceptance/WeChatPayCest.php b/tests/Codeception/Acceptance/WeChatPayCest.php index 8b2f9277..f7954b57 100644 --- a/tests/Codeception/Acceptance/WeChatPayCest.php +++ b/tests/Codeception/Acceptance/WeChatPayCest.php @@ -47,7 +47,7 @@ private function checkWechatpayPayment(int $methodNumber) { $price = str_replace(',', '.', $this->getPrice()); $wechatpayClientData = Fixtures::get('wechatpay_client'); - $WechatpayPage = new LocalPaymentMethodsSimulatorPage($this->getAcceptance()); + $WechatpayPage = new LocalPaymentMethodsSimulatorPage($this->I); $WechatpayPage->login($wechatpayClientData['username'], $wechatpayClientData['password'], $price); $WechatpayPage->choosePaymentMethod($methodNumber);