Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

test(connector): [stripe] Add ui test for affirm (#1694)

chikke srujan8c5703df5450
diff --git a/crates/router/tests/connectors/selenium.rs b/crates/router/tests/connectors/selenium.rs
index b49575a94b..f4408a6736 100644
--- a/crates/router/tests/connectors/selenium.rs
+++ b/crates/router/tests/connectors/selenium.rs
@@ -425,6 +425,55 @@ pub trait SeleniumTest {
self.complete_actions(&web_driver, default_actions).await?;
self.complete_actions(&web_driver, actions).await
}
+ async fn make_affirm_payment(
+ &self,
+ driver: WebDriver,
+ url: &str,
+ actions: Vec<Event<'_>>,
+ ) -> Result<(), WebDriverError> {
+ self.complete_actions(
+ &driver,
+ vec![
+ Event::Trigger(Trigger::Goto(url)),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ ],
+ )
+ .await?;
+ let mut affirm_actions = vec![
+ Event::RunIf(
+ Assert::IsPresent("Big purchase? No problem."),
+ vec![
+ Event::Trigger(Trigger::SendKeys(
+ By::Css("input.focusable-form-field.pro11TnYcue.pro284gg8sY"),
+ "(833) 549-5574", // any test phone number accepted by affirm
+ )),
+ Event::Trigger(Trigger::Click(By::Css(
+ "button.sc-aXZVg.gCRVeN.pro35Wfly4z.pro300N0DVx.profBy8oj9g",
+ ))),
+ Event::Trigger(Trigger::SendKeys(
+ By::Css("input.focusable-form-field.pro3g2JlS3A.pro284gg8sY"),
+ "1234",
+ )),
+ ],
+ ),
+ Event::Trigger(Trigger::Click(By::Css(
+ "button.sc-aXZVg.fiBhTR.sc-gEkIjz.lfdPCG.pro35Wfly4z.pro4JEtdJCo.profBy8oj9g",
+ ))),
+ Event::Trigger(Trigger::Click(By::Css(
+ "div.proXxAyyoTg.pro1jhMLxqa.pro3Q3lI-I9",
+ ))),
+ Event::Trigger(Trigger::Click(By::Css(
+ "button.sc-aXZVg.gCRVeN.pro35Wfly4z.pro300N0DVx.pro3JiyGdDb.pro1Ss7c7oj",
+ ))),
+ Event::Trigger(Trigger::Click(By::Css("div.pro1O60NO1I.pro2uav9pZk"))),
+ Event::Trigger(Trigger::Click(By::Css("div.pro1O60NO1I.pro1xh5zNal"))),
+ Event::Trigger(Trigger::Click(By::Css(
+ "button.sc-aXZVg.gCRVeN.pro35Wfly4z.pro300N0DVx.profBy8oj9g",
+ ))),
+ ];
+ affirm_actions.extend(actions);
+ self.complete_actions(&driver, affirm_actions).await
+ }
async fn make_paypal_payment(
&self,
web_driver: WebDriver,
diff --git a/crates/router/tests/connectors/stripe_ui.rs b/crates/router/tests/connectors/stripe_ui.rs
index 81087ae5ee..f8a1cdc6b7 100644
--- a/crates/router/tests/connectors/stripe_ui.rs
+++ b/crates/router/tests/connectors/stripe_ui.rs
@@ -380,6 +380,19 @@ async fn should_make_stripe_sepa_bank_debit_payment(c: WebDriver) -> Result<(),
Ok(())
}
+async fn should_make_stripe_affirm_paylater_payment(
+ driver: WebDriver,
+) -> Result<(), WebDriverError> {
+ let conn = StripeSeleniumTest {};
+ conn.make_affirm_payment(
+ driver,
+ &format!("{CHEKOUT_BASE_URL}/saved/110"),
+ vec![Event::Assert(Assert::IsPresent("succeeded"))],
+ )
+ .await?;
+ Ok(())
+}
+
#[test]
#[serial]
fn should_make_3ds_payment_test() {
@@ -483,3 +496,9 @@ fn should_make_stripe_ach_bank_debit_payment_test() {
fn should_make_stripe_sepa_bank_debit_payment_test() {
tester!(should_make_stripe_sepa_bank_debit_payment);
}
+
+#[test]
+#[serial]
+fn should_make_stripe_affirm_paylater_payment_test() {
+ tester!(should_make_stripe_affirm_paylater_payment);
+}