-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing E2E tests for PBL with channel ID specified
- Loading branch information
Showing
13 changed files
with
156 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
tests/E2E/Admin/PaymentMethod/TestPaymentMethodConnectionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Admin\PaymentMethod; | ||
|
||
use Facebook\WebDriver\WebDriverBy; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\E2ETestCase; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Helper\Account\LoginAdminUserTrait; | ||
|
||
final class TestPaymentMethodConnectionTest extends E2ETestCase | ||
{ | ||
use LoginAdminUserTrait; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->loadFixtures(['admin/payment_methods.yaml']); | ||
|
||
$this->loginAdminUser('[email protected]', 'sylius'); | ||
} | ||
|
||
public function test_it_checks_if_payment_method_connection(): void | ||
{ | ||
$this->client->request('GET', '/admin/payment-methods/new/tpay'); | ||
|
||
$this->client | ||
->findElement(WebDriverBy::id('sylius_payment_method_gatewayConfig_config_client_id')) | ||
->sendKeys(getenv('TPAY_CLIENT_ID')) | ||
; | ||
$this->client | ||
->findElement(WebDriverBy::id('sylius_payment_method_gatewayConfig_config_client_secret')) | ||
->sendKeys(getenv('TPAY_CLIENT_SECRET')) | ||
; | ||
$this->client | ||
->findElement(WebDriverBy::id('sylius_payment_method_gatewayConfig_config_production_mode')) | ||
->sendKeys('No') | ||
; | ||
$this->client->findElement(WebDriverBy::id('test-connection-button'))->click(); | ||
$this->client->waitForElementToContain('#test-connection-message', 'Connection test successful. Channels loaded.'); | ||
$channelSelector = $this->client->findElement(WebDriverBy::id('sylius_payment_method_gatewayConfig_config_tpay_channel_id')); | ||
|
||
$this->assertSame('select', $channelSelector->getTagName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Helper\Account; | ||
|
||
use Symfony\Component\Panther\Client; | ||
|
||
/** | ||
* @property Client $client | ||
*/ | ||
trait LoginAdminUserTrait | ||
{ | ||
protected function loginAdminUser(string $email, string $password): void | ||
{ | ||
$this->client->request('GET', '/admin/login'); | ||
$this->client->submitForm('Login', ['_username' => $email, '_password' => $password]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include: | ||
- ../common/channel.yaml | ||
- ../common/country.yaml | ||
- ../common/payment_method.yaml | ||
- ../common/admin.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Sylius\Component\Core\Model\AdminUser: | ||
admin_user_rich: | ||
plainPassword: sylius | ||
roles: [ROLE_ADMINISTRATION_ACCESS] | ||
enabled: true | ||
email: "rich\\@example.com" | ||
username: rich | ||
localeCode: en |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Shop\Checkout; | ||
|
||
use Facebook\WebDriver\WebDriverBy; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\E2ETestCase; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Helper\Account\LoginShopUserTrait; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Helper\Order\CartTrait; | ||
use Tests\CommerceWeavers\SyliusTpayPlugin\E2E\Helper\Order\TpayTrait; | ||
|
||
final class TpayPayByLinkCheckoutTest extends E2ETestCase | ||
{ | ||
use CartTrait; | ||
use TpayTrait; | ||
use LoginShopUserTrait; | ||
|
||
private const FORM_ID = 'sylius_checkout_complete'; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->loadFixtures(['addressed_cart.yaml']); | ||
|
||
$this->loginShopUser('[email protected]', 'sylius'); | ||
$this->showSelectingShippingMethodStep(); | ||
$this->processWithDefaultShippingMethod(); | ||
} | ||
|
||
public function test_it_completes_the_checkout_using_pay_by_link_channel_selection(): void | ||
{ | ||
$this->processWithPaymentMethod('tpay_pbl'); | ||
$this->client->findElement(WebDriverBy::xpath("//div[@data-bank-id='1']"))->click(); | ||
$this->placeOrder(); | ||
|
||
$this->assertPageTitleContains('Thank you!'); | ||
} | ||
|
||
public function test_it_completes_the_checkout_using_pay_by_link_channel_preselected(): void | ||
{ | ||
$this->processWithPaymentMethod('tpay_pbl_one_channel'); | ||
$this->placeOrder(); | ||
|
||
$this->assertPageTitleContains('Thank you!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters