-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrige validação de quantidade de parcelas no checkout (#115)
* Remove parcelas do checkout se o parcelamento estiver desabilitado * Insere testes * Insere ID no seletor de parcelas do checkout * Versão 1.8.2
- Loading branch information
1 parent
d8e69bc
commit 3b822e4
Showing
14 changed files
with
297 additions
and
39 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
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
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,20 @@ | ||
version: '3.3' | ||
services: | ||
magento1_db: | ||
image: vindi/mysql_magento1 | ||
container_name: magento1_db | ||
ports: | ||
- "3306" | ||
magento1_web: | ||
image: vindi/apache_magento1 | ||
container_name: magento1_web | ||
depends_on: | ||
- magento1_db | ||
ports: | ||
- "80:80" | ||
links: | ||
- magento1_db:mysql | ||
networks: | ||
default: | ||
external: | ||
name: webproxy |
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 |
---|---|---|
|
@@ -20,7 +20,91 @@ class AcceptanceTester extends \Codeception\Actor | |
{ | ||
use _generated\AcceptanceTesterActions; | ||
|
||
/** | ||
* Define custom actions here | ||
*/ | ||
public function isModuleConfigured() | ||
{ | ||
return getenv('CONFIGURED') == true; | ||
} | ||
|
||
public function goToAdminPanel($I) | ||
{ | ||
$I->amOnPage('/admin'); | ||
|
||
try { | ||
$I->fillField('login[username]', 'admin'); | ||
$I->fillField('login[password]', 'password123'); | ||
$I->click('Login'); | ||
} catch (Exception $e) { } | ||
} | ||
|
||
public function goToVindiSettings($I) | ||
{ | ||
$I->click('System'); | ||
$I->click('Configuration'); | ||
|
||
try { | ||
$I->seeElement('#vindi_subscription_general_api_key'); | ||
} catch (Exception $e) { | ||
$I->click('#vindi_subscription_general-head'); | ||
} | ||
} | ||
|
||
public function setConnectionConfig($I) | ||
{ | ||
$I->goToAdminPanel($I); | ||
$I->goToVindiSettings($I); | ||
$I->fillField('#vindi_subscription_general_api_key', getenv('VINDI_API_KEY')); | ||
$I->selectOption('#vindi_subscription_general_sandbox_mode', 'Sandbox'); | ||
$I->click('Save Config'); | ||
putenv("CONFIGURED=true"); | ||
} | ||
|
||
public function goToCreditCardSettings($I) | ||
{ | ||
$I->click('System'); | ||
$I->click('Configuration'); | ||
$I->click('Payment Methods'); | ||
|
||
try { | ||
$I->seeElement('#payment_vindi_creditcard_active'); | ||
} catch (Exception $e) { | ||
$I->click('#payment_vindi_creditcard-head'); | ||
} | ||
} | ||
|
||
public function setDefaultCreditCard($I, $withInstallments = true, $maxInstallment = 12) | ||
{ | ||
$I->goToAdminPanel($I); | ||
$I->goToCreditCardSettings($I); | ||
$I->selectOption('#payment_vindi_creditcard_active', 'Yes'); | ||
$I->selectOption( | ||
'#payment_vindi_creditcard_enable_installments', $withInstallments ? 'Yes' : 'No' | ||
); | ||
$I->selectOption('#payment_vindi_creditcard_max_installments_number', "{$maxInstallment}x"); | ||
$I->click('Save Config'); | ||
} | ||
|
||
public function addProductToCart($I) | ||
{ | ||
$I->amOnPage('/vindi-product.html'); | ||
$I->click('Add to Cart'); | ||
$I->click('Proceed to Checkout'); | ||
} | ||
|
||
public function loginAsUser($I) | ||
{ | ||
$I->wait(1); | ||
$I->amOnPage('/customer/account/login'); | ||
$I->fillField('login[username]', '[email protected]'); | ||
$I->fillField('login[password]', 'password123'); | ||
$I->click('Login'); | ||
} | ||
|
||
public function skipCheckoutForm($I) | ||
{ | ||
$I->click('#billing:use_for_shipping_yes'); | ||
$I->click('Continue', '#billing-buttons-container'); | ||
$I->wait(1); | ||
$I->click('Continue', '#shipping-method-buttons-container'); | ||
$I->wait(1); | ||
} | ||
} |
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
Empty file.
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,68 @@ | ||
<?php | ||
|
||
class VindiCheckoutWithCreditCardCest | ||
{ | ||
public function _before(AcceptanceTester $I) | ||
{ | ||
// Caso o módulo não tenha sido configurado | ||
if (! $I->isModuleConfigured()) | ||
$I->setConnectionConfig($I); | ||
} | ||
|
||
public function buyAnProductInInstallment(AcceptanceTester $I) | ||
{ | ||
$I->setDefaultCreditCard($I, true); | ||
$I->loginAsUser($I); | ||
$I->addProductToCart($I); | ||
$I->skipCheckoutForm($I); | ||
$I->waitForElement('#dt_method_vindi_creditcard', 30); | ||
$I->selectOption('dl#checkout-payment-method-load', 'Cartão de Crédito'); | ||
$I->waitForElement('#vindi_cc_installments', 30); | ||
$I->selectOption('#vindi_cc_installments', '2'); | ||
|
||
try | ||
{ | ||
$I->fillField('#vindi_creditcard_cc_owner', 'Vindi Magento'); | ||
$I->selectOption('#vindi_creditcard_cc_type', 'mastercard'); | ||
$I->fillField('#vindi_creditcard_cc_number', '5555555555555557'); | ||
$I->selectOption('select#vindi_creditcard_expiration.month', '12'); | ||
$I->selectOption('select#vindi_creditcard_expiration_yr.year', strval(date('Y') + 5)); | ||
$I->fillField('#vindi_creditcard_cc_cid', '123'); | ||
} catch(Exception $e) { } | ||
|
||
$I->click('Continue', '#payment-buttons-container'); | ||
$I->waitForElement('#review-buttons-container', 30); | ||
$I->click('Place Order'); | ||
$I->waitForElement('.main-container.col1-layout', 30); | ||
$I->seeInCurrentUrl('/checkout/onepage/success'); | ||
$I->see('Your order has been received.'); | ||
} | ||
|
||
public function buyAnProductWithoutInstallment(AcceptanceTester $I) | ||
{ | ||
$I->setDefaultCreditCard($I, false); | ||
$I->loginAsUser($I); | ||
$I->addProductToCart($I); | ||
$I->skipCheckoutForm($I); | ||
$I->waitForElement('#dt_method_vindi_creditcard', 30); | ||
$I->selectOption('dl#checkout-payment-method-load', 'Cartão de Crédito'); | ||
$I->dontSeeElement('select.required-entry'); | ||
|
||
try | ||
{ | ||
$I->fillField('#vindi_creditcard_cc_owner', 'Vindi Magento'); | ||
$I->selectOption('#vindi_creditcard_cc_type', 'mastercard'); | ||
$I->fillField('#vindi_creditcard_cc_number', '5555555555555557'); | ||
$I->selectOption('select#vindi_creditcard_expiration.month', '12'); | ||
$I->selectOption('select#vindi_creditcard_expiration_yr.year', strval(date('Y') + 5)); | ||
$I->fillField('#vindi_creditcard_cc_cid', '123'); | ||
} catch(Exception $e) { } | ||
|
||
$I->click('Continue', '#payment-buttons-container'); | ||
$I->waitForElement('#review-buttons-container', 30); | ||
$I->click('Place Order'); | ||
$I->waitForElement('.main-container.col1-layout', 30); | ||
$I->seeInCurrentUrl('/checkout/onepage/success'); | ||
$I->see('Your order has been received.'); | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
class VindiCreditCardSettingsCest | ||
{ | ||
public function _before(AcceptanceTester $I) | ||
{ | ||
// Caso o módulo não tenha sido configurado | ||
if (! $I->isModuleConfigured()) | ||
$I->setConnectionConfig($I); | ||
} | ||
|
||
public function enableCreditCardWithoutInstallments(AcceptanceTester $I) | ||
{ | ||
$I->goToAdminPanel($I); | ||
$I->goToCreditCardSettings($I); | ||
$I->selectOption('#payment_vindi_creditcard_active', 'Yes'); | ||
$I->selectOption('#payment_vindi_creditcard_enable_installments', 'No'); | ||
$I->click('Save Config'); | ||
} | ||
|
||
public function enableCreditCardWithInstallments(AcceptanceTester $I) | ||
{ | ||
$I->goToAdminPanel($I); | ||
$I->goToCreditCardSettings($I); | ||
$I->selectOption('#payment_vindi_creditcard_active', 'Yes'); | ||
$I->selectOption('#payment_vindi_creditcard_enable_installments', 'Yes'); | ||
$I->selectOption('#payment_vindi_creditcard_max_installments_number', '12x'); | ||
$I->click('Save Config'); | ||
} | ||
} |
Oops, something went wrong.