Skip to content

Commit

Permalink
--draft--
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Tkachev committed Sep 17, 2024
1 parent 043bc1c commit 2078c06
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 36 deletions.
2 changes: 1 addition & 1 deletion tests/Codeception/Acceptance/AlipayCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions tests/Codeception/Acceptance/BancontactCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
8 changes: 0 additions & 8 deletions tests/Codeception/Acceptance/BaseCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
28 changes: 14 additions & 14 deletions tests/Codeception/Acceptance/CreditCardCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand All @@ -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']]
Expand Down
2 changes: 1 addition & 1 deletion tests/Codeception/Acceptance/WeChatPayCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2078c06

Please sign in to comment.