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): Add tests for Globalpay and Bluesnap (#1281)

chikke srujanc5ff6ed45b6d
diff --git a/crates/router/tests/connectors/bluesnap_ui.rs b/crates/router/tests/connectors/bluesnap_ui.rs
new file mode 100644
index 0000000000..f69d295602
--- /dev/null
+++ b/crates/router/tests/connectors/bluesnap_ui.rs
@@ -0,0 +1,62 @@
+use serial_test::serial;
+use thirtyfour::{prelude::*, WebDriver};
+
+use crate::{selenium::*, tester};
+
+struct BluesnapSeleniumTest;
+
+impl SeleniumTest for BluesnapSeleniumTest {
+ fn get_connector_name(&self) -> String {
+ "bluesnap".to_string()
+ }
+}
+
+async fn should_make_3ds_payment(driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = BluesnapSeleniumTest {};
+ conn.make_redirection_payment(
+ driver,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/10"))),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ Event::Trigger(Trigger::SwitchFrame(By::Id("Cardinal-CCA-IFrame"))),
+ Event::Assert(Assert::IsPresent("Enter your code below")),
+ Event::Trigger(Trigger::SendKeys(By::Name("challengeDataEntry"), "1234")),
+ Event::Trigger(Trigger::Click(By::ClassName("button.primary"))),
+ Event::Trigger(Trigger::Sleep(5)),
+ Event::Assert(Assert::Contains(
+ Selector::QueryParamStr,
+ "status=succeeded",
+ )),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
+async fn should_make_gpay_payment(driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = BluesnapSeleniumTest {};
+ let pub_key = conn
+ .get_configs()
+ .automation_configs
+ .unwrap()
+ .bluesnap_gateway_merchant_id
+ .unwrap();
+ conn.make_gpay_payment(driver,
+ &format!("{CHEKOUT_BASE_URL}/gpay?gatewayname=bluesnap&gatewaymerchantid={pub_key}&amount=11.00&country=US&currency=USD"),
+ vec![
+ Event::Assert(Assert::IsPresent("succeeded")),
+ ]).await?;
+ Ok(())
+}
+
+#[test]
+#[serial]
+fn should_make_3ds_payment_test() {
+ tester!(should_make_3ds_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_gpay_payment_test() {
+ tester!(should_make_gpay_payment);
+}
diff --git a/crates/router/tests/connectors/connector_auth.rs b/crates/router/tests/connectors/connector_auth.rs
index a28bd23744..584129c2aa 100644
--- a/crates/router/tests/connectors/connector_auth.rs
+++ b/crates/router/tests/connectors/connector_auth.rs
@@ -138,5 +138,7 @@ pub struct AutomationConfigs {
pub configs_url: Option<String>,
pub stripe_pub_key: Option<String>,
pub testcases_path: Option<String>,
+ pub bluesnap_gateway_merchant_id: Option<String>,
+ pub globalpay_gateway_merchant_id: Option<String>,
pub run_minimum_steps: Option<bool>,
}
diff --git a/crates/router/tests/connectors/globalpay_ui.rs b/crates/router/tests/connectors/globalpay_ui.rs
new file mode 100644
index 0000000000..36a81792da
--- /dev/null
+++ b/crates/router/tests/connectors/globalpay_ui.rs
@@ -0,0 +1,205 @@
+use serial_test::serial;
+use thirtyfour::{prelude::*, WebDriver};
+
+use crate::{selenium::*, tester};
+
+struct GlobalpaySeleniumTest;
+
+impl SeleniumTest for GlobalpaySeleniumTest {
+ fn get_connector_name(&self) -> String {
+ "globalpay".to_string()
+ }
+}
+
+async fn should_make_gpay_payment(driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = GlobalpaySeleniumTest {};
+ let pub_key = conn
+ .get_configs()
+ .automation_configs
+ .unwrap()
+ .globalpay_gateway_merchant_id
+ .unwrap();
+ conn.make_gpay_payment(driver,
+ &format!("{CHEKOUT_BASE_URL}/gpay?amount=10.00&country=US&currency=USD&gatewayname=globalpayments&gatewaymerchantid={pub_key}"),
+ vec![
+ Event::Assert(Assert::IsPresent("succeeded")),
+ ]).await?;
+ Ok(())
+}
+
+async fn should_make_globalpay_paypal_payment(driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = GlobalpaySeleniumTest {};
+ conn.make_paypal_payment(
+ driver,
+ &format!("{CHEKOUT_BASE_URL}/paypal-redirect?amount=12.00&country=US&currency=EUR"),
+ vec![
+ Event::Assert(Assert::IsPresent("Google")),
+ Event::Assert(Assert::ContainsAny(
+ Selector::QueryParamStr,
+ vec!["status=succeeded"],
+ )),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
+async fn should_make_globalpay_ideal_payment(driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = GlobalpaySeleniumTest {};
+ conn.make_redirection_payment(
+ driver,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/53"))),
+ Event::Assert(Assert::IsPresent("Home")),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ Event::Assert(Assert::IsPresent("Choose your Bank")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Login to your Online Banking Account")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Transaction Authentication")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Payment Successful")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Google")),
+ Event::Assert(Assert::ContainsAny(
+ Selector::QueryParamStr,
+ vec!["status=succeeded", "status=processing"],
+ )),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
+async fn should_make_globalpay_giropay_payment(driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = GlobalpaySeleniumTest {};
+ conn.make_redirection_payment(
+ driver,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/59"))),
+ Event::Assert(Assert::IsPresent("Home")),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ Event::Assert(Assert::IsPresent("Choose your Bank")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Login to your Online Banking Account")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Transaction Authentication")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Payment Successful")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Google")),
+ Event::Assert(Assert::ContainsAny(
+ Selector::QueryParamStr,
+ vec!["status=succeeded", "status=processing"],
+ )),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
+async fn should_make_globalpay_eps_payment(driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = GlobalpaySeleniumTest {};
+ conn.make_redirection_payment(
+ driver,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/50"))),
+ Event::Assert(Assert::IsPresent("Home")),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ Event::Assert(Assert::IsPresent("Choose your Bank")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Login to your Online Banking Account")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Transaction Authentication")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Payment Successful")),
+ Event::Trigger(Trigger::Click(By::Css("button.btn.btn-primary"))),
+ Event::Assert(Assert::IsPresent("Google")),
+ Event::Assert(Assert::ContainsAny(
+ Selector::QueryParamStr,
+ vec!["status=succeeded", "status=processing"],
+ )),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
+async fn should_make_globalpay_sofort_payment(driver: WebDriver) -> Result<(), WebDriverError> {
+ let conn = GlobalpaySeleniumTest {};
+ conn.make_redirection_payment(
+ driver,
+ vec![
+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/63"))),
+ Event::Assert(Assert::IsPresent("Home")),
+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),
+ Event::RunIf(
+ Assert::IsPresent("Wählen"),
+ vec![Event::Trigger(Trigger::Click(By::Css("p.description")))],
+ ),
+ Event::Assert(Assert::IsPresent("Demo Bank")),
+ Event::Trigger(Trigger::SendKeys(
+ By::Id("BackendFormLOGINNAMEUSERID"),
+ "12345",
+ )),
+ Event::Trigger(Trigger::SendKeys(By::Id("BackendFormUSERPIN"), "1234")),
+ Event::Trigger(Trigger::Click(By::Css(
+ "button.button-right.primary.has-indicator",
+ ))),
+ Event::RunIf(
+ Assert::IsPresent("Kontoauswahl"),
+ vec![Event::Trigger(Trigger::Click(By::Css(
+ "button.button-right.primary.has-indicator",
+ )))],
+ ),
+ Event::Assert(Assert::IsPresent("PPRO Payment Services Ltd.")),
+ Event::Trigger(Trigger::SendKeys(By::Id("BackendFormTan"), "12345")),
+ Event::Trigger(Trigger::Click(By::Css(
+ "button.button-right.primary.has-indicator",
+ ))),
+ Event::Assert(Assert::IsPresent("Google")),
+ Event::Assert(Assert::ContainsAny(
+ Selector::QueryParamStr,
+ vec!["status=succeeded", "status=processing"],
+ )),
+ ],
+ )
+ .await?;
+ Ok(())
+}
+
+#[test]
+#[serial]
+fn should_make_gpay_payment_test() {
+ tester!(should_make_gpay_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_globalpay_paypal_payment_test() {
+ tester!(should_make_globalpay_paypal_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_globalpay_ideal_payment_test() {
+ tester!(should_make_globalpay_ideal_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_globalpay_giropay_payment_test() {
+ tester!(should_make_globalpay_giropay_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_globalpay_eps_payment_test() {
+ tester!(should_make_globalpay_eps_payment);
+}
+
+#[test]
+#[serial]
+fn should_make_globalpay_sofort_payment_test() {
+ tester!(should_make_globalpay_sofort_payment);
+}
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 473a0f6d71..d315a027f8 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -14,6 +14,7 @@ mod bambora;
mod bambora_ui;
mod bitpay;
mod bluesnap;
+mod bluesnap_ui;
mod cashtocode;
mod checkout;
mod checkout_ui;
@@ -26,6 +27,7 @@ mod dummyconnector;
mod fiserv;
mod forte;
mod globalpay;
+mod globalpay_ui;
mod iatapay;
mod mollie;
mod mollie_ui;