Skip to content

Commit a6be090

Browse files
authored
Merge pull request #273 from Kit/tests-fix-checkout-payment-method-selection
Tests: Checkout: Select Payment Method
2 parents b8f92c6 + 48a03a6 commit a6be090

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Configures Dependabot to update packages used in GitHub Actions
2+
# https://docs.github.com/en/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/keeping-your-actions-up-to-date-with-dependabot
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"

tests/EndToEnd.suite.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ modules:
7777
wpRootFolder: '%WORDPRESS_ROOT_DIR%'
7878
dbUrl: '%WORDPRESS_DB_URL%'
7979
domain: '%WORDPRESS_DOMAIN%'
80-
80+
step_decorators:
81+
- \Codeception\Step\TryTo

tests/Support/Helper/WooCommerce.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,13 @@ public function wooCommerceCheckoutWithProduct($I, $productID, $productName, $em
820820
* Card
821821
*/
822822
case 'stripe':
823+
// Select Stripe Payment Method, if a radio button exists, depending on the checkout type.
824+
if ($I->tryToSeeElement('#payment_method_stripe')) {
825+
$I->click('#payment_method_stripe');
826+
} elseif ($I->tryToSeeElement('#radio-control-wc-payment-method-options-stripe')) {
827+
$I->click('#radio-control-wc-payment-method-options-stripe');
828+
}
829+
823830
// Complete Credit Card Details.
824831
$I->switchToIFrame('iframe[title="Secure payment input frame"]'); // Switch to CC Stripe iFrame.
825832
$I->fillField('number', '4242424242424242');
@@ -832,7 +839,12 @@ public function wooCommerceCheckoutWithProduct($I, $productID, $productName, $em
832839
* COD
833840
*/
834841
default:
835-
// COD is selected by default, so no need to click anything.
842+
// Select COD Payment Method, if a radio button exists, depending on the checkout type.
843+
if ($I->tryToSeeElement('#payment_method_cod')) {
844+
$I->click('#payment_method_cod');
845+
} elseif ($I->tryToSeeElement('#radio-control-wc-payment-method-options-cod')) {
846+
$I->click('#radio-control-wc-payment-method-options-cod');
847+
}
836848
break;
837849
}
838850
}

0 commit comments

Comments
 (0)