mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
test(connector): Add tests for Globalpay and Bluesnap (#1281)
Signed-off-by: chikke srujan <121822803+srujanchikke@users.noreply.github.com> Co-authored-by: AkshayaFoiger <akshaya.shankar@juspay.in> Co-authored-by: Jagan Elavarasan <jaganelavarasan@gmail.com> Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
62
crates/router/tests/connectors/bluesnap_ui.rs
Normal file
62
crates/router/tests/connectors/bluesnap_ui.rs
Normal file
@ -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¤cy=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);
|
||||
}
|
||||
@ -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>,
|
||||
}
|
||||
|
||||
205
crates/router/tests/connectors/globalpay_ui.rs
Normal file
205
crates/router/tests/connectors/globalpay_ui.rs
Normal file
@ -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¤cy=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¤cy=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);
|
||||
}
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user