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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
test(connector): [Shift4] Add tests for 3DS and Bank Redirect (#1250)
Sakil Mostak041ecbbcf39b
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rsindex d315a027f8..7c95b66da6 100644--- a/crates/router/tests/connectors/main.rs+++ b/crates/router/tests/connectors/main.rs@@ -46,6 +46,7 @@ mod payu_ui;mod rapyd;mod selenium;mod shift4;+mod shift4_ui;mod stripe;mod stripe_ui;mod trustpay;diff --git a/crates/router/tests/connectors/shift4_ui.rs b/crates/router/tests/connectors/shift4_ui.rsnew file mode 100644index 0000000000..2c39502345--- /dev/null+++ b/crates/router/tests/connectors/shift4_ui.rs@@ -0,0 +1,137 @@+use serial_test::serial;+use thirtyfour::{prelude::*, WebDriver};++use crate::{selenium::*, tester};++struct Shift4SeleniumTest;++impl SeleniumTest for Shift4SeleniumTest {+ fn get_connector_name(&self) -> String {+ "shift4".to_string()+ }+}++async fn should_make_3ds_payment(c: WebDriver) -> Result<(), WebDriverError> {+ let conn = Shift4SeleniumTest {};+ conn.make_redirection_payment(+ c,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/37"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::Click(By::ClassName("btn-success"))),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=succeeded",+ )),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_giropay_payment(c: WebDriver) -> Result<(), WebDriverError> {+ let conn = Shift4SeleniumTest {};+ conn.make_redirection_payment(+ c,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/39"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::Click(By::ClassName("btn-success"))),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=succeeded",+ )),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_ideal_payment(c: WebDriver) -> Result<(), WebDriverError> {+ let conn = Shift4SeleniumTest {};+ conn.make_redirection_payment(+ c,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/42"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::Click(By::ClassName("btn-success"))),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=succeeded",+ )),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_sofort_payment(c: WebDriver) -> Result<(), WebDriverError> {+ let conn = Shift4SeleniumTest {};+ conn.make_redirection_payment(+ c,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/43"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::Click(By::ClassName("btn-success"))),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=succeeded",+ )),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_eps_payment(c: WebDriver) -> Result<(), WebDriverError> {+ let conn = Shift4SeleniumTest {};+ conn.make_redirection_payment(+ c,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/44"))),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::Click(By::ClassName("btn-success"))),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=succeeded",+ )),+ ],+ )+ .await?;+ Ok(())+}++#[test]+#[serial]+fn should_make_3ds_payment_test() {+ tester!(should_make_3ds_payment);+}++#[test]+#[serial]+fn should_make_giropay_payment_test() {+ tester!(should_make_giropay_payment);+}++#[test]+#[serial]+fn should_make_ideal_payment_test() {+ tester!(should_make_ideal_payment);+}++#[test]+#[serial]+fn should_make_sofort_payment_test() {+ tester!(should_make_sofort_payment);+}++#[test]+#[serial]+fn should_make_eps_payment_test() {+ tester!(should_make_eps_payment);+}