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): Add tests for Paypal, Adyen and Airwallex (#1290)
Prasunna Soppacd4dbcb3f6ab
diff --git a/crates/router/tests/connectors/adyen_uk_ui.rs b/crates/router/tests/connectors/adyen_uk_ui.rsindex fef4026e84..c07a87643f 100644--- a/crates/router/tests/connectors/adyen_uk_ui.rs+++ b/crates/router/tests/connectors/adyen_uk_ui.rs@@ -11,9 +11,56 @@ impl SeleniumTest for AdyenSeleniumTest {}}-async fn should_make_adyen_gpay_payment(c: WebDriver) -> Result<(), WebDriverError> {+async fn should_make_adyen_3ds_payment_failed(web_driver: WebDriver) -> Result<(), WebDriverError> {let conn = AdyenSeleniumTest {};- conn.make_gpay_payment(c,+ conn.make_redirection_payment(+ web_driver,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/177"))),+ Event::Assert(Assert::IsPresent("Expiry Year")),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::SwitchFrame(By::Name("threeDSIframe"))),+ Event::Assert(Assert::Eq(Selector::Title, "Payment Authentication")),+ Event::Trigger(Trigger::SendKeys(By::ClassName("input-field"), "password")),+ Event::Trigger(Trigger::Click(By::Id("buttonSubmit"))),+ Event::Trigger(Trigger::Sleep(5)),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(Selector::QueryParamStr, "status=failed")),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_adyen_3ds_payment_success(+ web_driver: WebDriver,+) -> Result<(), WebDriverError> {+ let conn = AdyenSeleniumTest {};+ conn.make_redirection_payment(+ web_driver,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/62"))),+ Event::Assert(Assert::IsPresent("Expiry Year")),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::SwitchFrame(By::Name("threeDSIframe"))),+ Event::Assert(Assert::Eq(Selector::Title, "Payment Authentication")),+ Event::Trigger(Trigger::SendKeys(By::ClassName("input-field"), "password")),+ Event::Trigger(Trigger::Click(By::Id("buttonSubmit"))),+ Event::Trigger(Trigger::Sleep(5)),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=processing",+ )),+ ],+ )+ .await?;+ Ok(())+}++async fn should_make_adyen_gpay_payment(web_driver: WebDriver) -> Result<(), WebDriverError> {+ let conn = AdyenSeleniumTest {};+ conn.make_gpay_payment(web_driver,&format!("{CHEKOUT_BASE_URL}/gpay?gatewayname=adyen&gatewaymerchantid=JuspayDEECOM&amount=70.00&country=US¤cy=USD"),vec![Event::Assert(Assert::IsPresent("succeeded")),@@ -21,9 +68,11 @@ async fn should_make_adyen_gpay_payment(c: WebDriver) -> Result<(), WebDriverErrOk(())}-async fn should_make_adyen_gpay_mandate_payment(c: WebDriver) -> Result<(), WebDriverError> {+async fn should_make_adyen_gpay_mandate_payment(+ web_driver: WebDriver,+) -> Result<(), WebDriverError> {let conn = AdyenSeleniumTest {};- conn.make_gpay_payment(c,+ conn.make_gpay_payment(web_driver,&format!("{CHEKOUT_BASE_URL}/gpay?gatewayname=adyen&gatewaymerchantid=JuspayDEECOM&amount=70.00&country=US¤cy=USD&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=7000&mandate_data[mandate_type][multi_use][currency]=USD"),vec![Event::Assert(Assert::IsPresent("succeeded")),@@ -37,10 +86,10 @@ async fn should_make_adyen_gpay_mandate_payment(c: WebDriver) -> Result<(), WebD}async fn should_make_adyen_gpay_zero_dollar_mandate_payment(- c: WebDriver,+ web_driver: WebDriver,) -> Result<(), WebDriverError> {let conn = AdyenSeleniumTest {};- conn.make_gpay_payment(c,+ conn.make_gpay_payment(web_driver,&format!("{CHEKOUT_BASE_URL}/gpay?gatewayname=adyen&gatewaymerchantid=JuspayDEECOM&amount=0.00&country=US¤cy=USD&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=700&mandate_data[mandate_type][multi_use][currency]=USD"),vec![Event::Assert(Assert::IsPresent("succeeded")),@@ -53,9 +102,11 @@ async fn should_make_adyen_gpay_zero_dollar_mandate_payment(Ok(())}-async fn should_make_adyen_klarna_mandate_payment(c: WebDriver) -> Result<(), WebDriverError> {+async fn should_make_adyen_klarna_mandate_payment(+ web_driver: WebDriver,+) -> Result<(), WebDriverError> {let conn = AdyenSeleniumTest {};- conn.make_redirection_payment(c,+ conn.make_redirection_payment(web_driver,vec![Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/klarna-redirect?amount=70.00&country=SE¤cy=SEK&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=700&mandate_data[mandate_type][multi_use][currency]=SEK&return_url={CHEKOUT_BASE_URL}/payments"))),Event::Trigger(Trigger::Click(By::Id("klarna-redirect-btn"))),@@ -105,4 +156,16 @@ fn should_make_adyen_klarna_mandate_payment_test() {tester!(should_make_adyen_klarna_mandate_payment);}+#[test]+#[serial]+fn should_make_adyen_3ds_payment_failed_test() {+ tester!(should_make_adyen_3ds_payment_failed);+}++#[test]+#[serial]+fn should_make_adyen_3ds_payment_success_test() {+ tester!(should_make_adyen_3ds_payment_success);+}+// https://hs-payments-test.netlify.app/paypal-redirect?amount=70.00&country=US¤cy=USD&mandate_data[customer_acceptance][acceptance_type]=offline&mandate_data[customer_acceptance][accepted_at]=1963-05-03T04:07:52.723Z&mandate_data[customer_acceptance][online][ip_address]=127.0.0.1&mandate_data[customer_acceptance][online][user_agent]=amet%20irure%20esse&mandate_data[mandate_type][multi_use][amount]=700&mandate_data[mandate_type][multi_use][currency]=USD&apikey=dev_uFpxA0r6jjbVaxHSY3X0BZLL3erDUzvg3i51abwB1Bknu3fdiPxw475DQgnByn1zdiff --git a/crates/router/tests/connectors/airwallex_ui.rs b/crates/router/tests/connectors/airwallex_ui.rsnew file mode 100644index 0000000000..ef5376b132--- /dev/null+++ b/crates/router/tests/connectors/airwallex_ui.rs@@ -0,0 +1,44 @@+use serial_test::serial;+use thirtyfour::{prelude::*, WebDriver};++use crate::{selenium::*, tester};++struct AirwallexSeleniumTest;++impl SeleniumTest for AirwallexSeleniumTest {+ fn get_connector_name(&self) -> String {+ "airwallex".to_string()+ }+}++async fn should_make_airwallex_3ds_payment(web_driver: WebDriver) -> Result<(), WebDriverError> {+ let conn = AirwallexSeleniumTest {};+ conn.make_redirection_payment(+ web_driver,+ vec![+ Event::Trigger(Trigger::Goto(&format!("{CHEKOUT_BASE_URL}/saved/85"))),+ Event::Assert(Assert::IsPresent("Expiry Year")),+ Event::Trigger(Trigger::Click(By::Id("card-submit-btn"))),+ Event::Trigger(Trigger::Query(By::ClassName("title"))),+ Event::Assert(Assert::Eq(+ Selector::Title,+ "Airwallex - Create 3D Secure Payment",+ )),+ Event::Trigger(Trigger::SendKeys(By::Id("challengeDataEntry"), "1234")),+ Event::Trigger(Trigger::Click(By::Id("submit"))),+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::Contains(+ Selector::QueryParamStr,+ "status=succeeded",+ )),+ ],+ )+ .await?;+ Ok(())+}++#[test]+#[serial]+fn should_make_airwallex_3ds_payment_test() {+ tester!(should_make_airwallex_3ds_payment);+}diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rsindex 2a07092f0d..58dcd13c44 100644--- a/crates/router/tests/connectors/main.rs+++ b/crates/router/tests/connectors/main.rs@@ -9,6 +9,7 @@ mod aci;mod adyen;mod adyen_uk_ui;mod airwallex;+mod airwallex_ui;mod authorizedotnet;mod bambora;mod bambora_ui;@@ -42,6 +43,7 @@ mod opennode;mod payeezy;mod payme;mod paypal;+mod paypal_ui;mod payu;mod payu_ui;mod rapyd;diff --git a/crates/router/tests/connectors/paypal_ui.rs b/crates/router/tests/connectors/paypal_ui.rsnew file mode 100644index 0000000000..b30723c2e7--- /dev/null+++ b/crates/router/tests/connectors/paypal_ui.rs@@ -0,0 +1,37 @@+use serial_test::serial;+use thirtyfour::{prelude::*, WebDriver};++use crate::{selenium::*, tester};++struct PaypalSeleniumTest;++impl SeleniumTest for PaypalSeleniumTest {+ fn get_connector_name(&self) -> String {+ "paypal".to_string()+ }+}++async fn should_make_paypal_paypal_wallet_payment(+ web_driver: WebDriver,+) -> Result<(), WebDriverError> {+ let conn = PaypalSeleniumTest {};+ conn.make_paypal_payment(+ web_driver,+ &format!("{CHEKOUT_BASE_URL}/saved/21"),+ vec![+ Event::Assert(Assert::IsPresent("Google")),+ Event::Assert(Assert::ContainsAny(+ Selector::QueryParamStr,+ vec!["status=succeeded"],+ )),+ ],+ )+ .await?;+ Ok(())+}++#[test]+#[serial]+fn should_make_paypal_paypal_wallet_payment_test() {+ tester!(should_make_paypal_paypal_wallet_payment);+}