|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Copyright © OXID eSales AG. All rights reserved. |
| 5 | + * See LICENSE file for license details. |
| 6 | + */ |
| 7 | + |
| 8 | +declare(strict_types=1); |
| 9 | + |
| 10 | +namespace OxidEsales\SecurityModule\Tests\Codeception\Acceptance; |
| 11 | + |
| 12 | +use OxidEsales\Codeception\Page\Account\UserLogin; |
| 13 | +use OxidEsales\Codeception\Step\Basket; |
| 14 | +use OxidEsales\SecurityModule\Tests\Codeception\Support\AcceptanceTester; |
| 15 | + |
| 16 | +/** |
| 17 | + * @group oe_security_module |
| 18 | + * @group oe_security_module_providers_visibility |
| 19 | + */ |
| 20 | +class ProvidersVisibilityCest extends BaseCest |
| 21 | +{ |
| 22 | + public function _before(AcceptanceTester $I): void |
| 23 | + { |
| 24 | + $this->setProviderState(false); |
| 25 | + } |
| 26 | + |
| 27 | + //todo: add % to link to check all providers individually |
| 28 | + private $providerLink = |
| 29 | + '//div[contains(@class, "sign-in-providers")]' . |
| 30 | + '//div[@class="provider"]' . |
| 31 | + '//a[contains(@href, "cl=oauth&fnc=redirect&provider=")]'; |
| 32 | + |
| 33 | + public function testProvidersVisibilityOnHeaderLogin(AcceptanceTester $I): void |
| 34 | + { |
| 35 | + $homePage = $I->openShop(); |
| 36 | + $homePage->openAccountMenu(); |
| 37 | + $I->dontSeeElement($this->providerLink); |
| 38 | + |
| 39 | + $this->setProviderState(true); |
| 40 | + $homePage = $I->openShop(); |
| 41 | + $homePage->openAccountMenu(); |
| 42 | + $I->assertGreaterOrEquals(1, count($I->grabMultiple($this->providerLink))); |
| 43 | + } |
| 44 | + |
| 45 | + public function testProvidersVisibilityOnMyAccountLogin(AcceptanceTester $I): void |
| 46 | + { |
| 47 | + $userLoginPage = new UserLogin($I); |
| 48 | + $I->amOnPage($userLoginPage->URL); |
| 49 | + $I->dontSeeElement($this->providerLink); |
| 50 | + |
| 51 | + $this->setProviderState(true); |
| 52 | + $userLoginPage = new UserLogin($I); |
| 53 | + $I->amOnPage($userLoginPage->URL); |
| 54 | + $I->assertGreaterOrEquals(1, count($I->grabMultiple($this->providerLink))); |
| 55 | + } |
| 56 | + |
| 57 | + public function testProviderVisibilityOnCheckoutPage(AcceptanceTester $I): void |
| 58 | + { |
| 59 | + $basket = new Basket($I); |
| 60 | + $basket->addProductToBasketAndOpenUserCheckout('1000', 1); |
| 61 | + $I->waitForElementNotVisible($this->providerLink); |
| 62 | + |
| 63 | + $this->setProviderState(true); |
| 64 | + $basket = new Basket($I); |
| 65 | + $basket->addProductToBasketAndOpenUserCheckout('1000', 1); |
| 66 | + $I->waitForElementNotVisible($this->providerLink); |
| 67 | + $I->assertGreaterOrEquals(1, count($I->grabMultiple($this->providerLink))); |
| 68 | + } |
| 69 | + |
| 70 | + public function testProviderVisibilityOnCheckoutWithoutAccount(AcceptanceTester $I): void |
| 71 | + { |
| 72 | + $basket = new Basket($I); |
| 73 | + $basket |
| 74 | + ->addProductToBasketAndOpenUserCheckout('1000', 1) |
| 75 | + ->selectOptionNoRegistration(); |
| 76 | + $I->waitForElementNotVisible($this->providerLink); |
| 77 | + |
| 78 | + $this->setProviderState(true); |
| 79 | + $basket |
| 80 | + ->addProductToBasketAndOpenUserCheckout('1000', 1) |
| 81 | + ->selectOptionNoRegistration(); |
| 82 | + $I->waitForElementNotVisible($this->providerLink); |
| 83 | + $I->assertGreaterOrEquals(1, count($I->grabMultiple($this->providerLink))); |
| 84 | + } |
| 85 | + |
| 86 | + public function testProviderVisibilityOnCheckoutWithNewAccount(AcceptanceTester $I): void |
| 87 | + { |
| 88 | + $basket = new Basket($I); |
| 89 | + $basket |
| 90 | + ->addProductToBasketAndOpenUserCheckout('1000', 1) |
| 91 | + ->selectOptionRegisterNewAccount(); |
| 92 | + $I->waitForElementNotVisible($this->providerLink); |
| 93 | + |
| 94 | + $this->setProviderState(true); |
| 95 | + $basket |
| 96 | + ->addProductToBasketAndOpenUserCheckout('1000', 1) |
| 97 | + ->selectOptionRegisterNewAccount(); |
| 98 | + $I->waitForElementNotVisible($this->providerLink); |
| 99 | + $I->assertGreaterOrEquals(1, count($I->grabMultiple($this->providerLink))); |
| 100 | + } |
| 101 | +} |
0 commit comments