@@ -128,9 +128,9 @@ pub trait SeleniumTest {
128
128
Trigger :: Goto ( url) => {
129
129
driver. goto ( url) . await ?;
130
130
let hs_base_url =
131
- env:: var ( "HS_BASE_URL" ) . unwrap_or ( "http://localhost:8080" . to_string ( ) ) ;
131
+ env:: var ( "HS_BASE_URL" ) . unwrap_or ( "http://localhost:8080" . to_string ( ) ) ; //Issue: #924
132
132
let hs_api_key =
133
- env:: var ( "HS_API_KEY" ) . expect ( "Hyperswitch user API key not present" ) ;
133
+ env:: var ( "HS_API_KEY" ) . expect ( "Hyperswitch user API key not present" ) ; //Issue: #924
134
134
driver
135
135
. add_cookie ( new_cookie ( "hs_base_url" , hs_base_url) . clone ( ) )
136
136
. await ?;
@@ -209,7 +209,7 @@ pub trait SeleniumTest {
209
209
F : FnOnce ( WebDriver ) -> Fut + Send ,
210
210
Fut : Future < Output = Result < ( ) , WebDriverError > > + Send ,
211
211
{
212
- let _browser = env:: var ( "HS_TEST_BROWSER" ) . unwrap_or ( "chrome" . to_string ( ) ) ;
212
+ let _browser = env:: var ( "HS_TEST_BROWSER" ) . unwrap_or ( "chrome" . to_string ( ) ) ; //Issue: #924
213
213
Ok ( ( ) )
214
214
}
215
215
async fn make_redirection_payment (
@@ -321,13 +321,13 @@ fn new_cookie(name: &str, value: String) -> Cookie<'_> {
321
321
322
322
#[ macro_export]
323
323
macro_rules! tester_inner {
324
- ( $f : ident, $connector : expr) => { {
324
+ ( $execute : ident, $webdriver : expr) => { {
325
325
use std:: {
326
326
sync:: { Arc , Mutex } ,
327
327
thread,
328
328
} ;
329
329
330
- let c = $connector ;
330
+ let driver = $webdriver ;
331
331
332
332
// we'll need the session_id from the thread
333
333
// NOTE: even if it panics, so can't just return it
@@ -336,20 +336,22 @@ macro_rules! tester_inner {
336
336
// run test in its own thread to catch panics
337
337
let sid = session_id. clone( ) ;
338
338
let res = thread:: spawn( move || {
339
- let rt = tokio:: runtime:: Builder :: new_current_thread( )
339
+ let runtime = tokio:: runtime:: Builder :: new_current_thread( )
340
340
. enable_all( )
341
341
. build( )
342
342
. unwrap( ) ;
343
- let c = rt. block_on( c) . expect( "failed to construct test WebDriver" ) ;
344
- * sid. lock( ) . unwrap( ) = rt. block_on( c. session_id( ) ) . ok( ) ;
343
+ let driver = runtime
344
+ . block_on( driver)
345
+ . expect( "failed to construct test WebDriver" ) ;
346
+ * sid. lock( ) . unwrap( ) = runtime. block_on( driver. session_id( ) ) . ok( ) ;
345
347
// make sure we close, even if an assertion fails
346
- let client = c . clone( ) ;
347
- let x = rt . block_on( async move {
348
- let r = tokio:: spawn( $f ( c ) ) . await ;
348
+ let client = driver . clone( ) ;
349
+ let x = runtime . block_on( async move {
350
+ let r = tokio:: spawn( $execute ( driver ) ) . await ;
349
351
let _ = client. quit( ) . await ;
350
352
r
351
353
} ) ;
352
- drop( rt ) ;
354
+ drop( runtime ) ;
353
355
x. expect( "test panicked" )
354
356
} )
355
357
. join( ) ;
@@ -395,6 +397,7 @@ pub fn make_capabilities(s: &str) -> Capabilities {
395
397
}
396
398
fn get_chrome_profile_path ( ) -> Result < String , WebDriverError > {
397
399
env:: var ( "CHROME_PROFILE_PATH" ) . map_or_else (
400
+ //Issue: #924
398
401
|_| -> Result < String , WebDriverError > {
399
402
let exe = env:: current_exe ( ) ?;
400
403
let dir = exe. parent ( ) . expect ( "Executable must be in some directory" ) ;
@@ -414,6 +417,7 @@ fn get_chrome_profile_path() -> Result<String, WebDriverError> {
414
417
}
415
418
fn get_firefox_profile_path ( ) -> Result < String , WebDriverError > {
416
419
env:: var ( "FIREFOX_PROFILE_PATH" ) . map_or_else (
420
+ //Issue: #924
417
421
|_| -> Result < String , WebDriverError > {
418
422
let exe = env:: current_exe ( ) ?;
419
423
let dir = exe. parent ( ) . expect ( "Executable must be in some directory" ) ;
@@ -461,5 +465,5 @@ pub fn handle_test_error(
461
465
}
462
466
463
467
pub fn get_env ( name : & str ) -> String {
464
- env:: var ( name) . unwrap_or_else ( |_| panic ! ( "{name} not present" ) )
468
+ env:: var ( name) . unwrap_or_else ( |_| panic ! ( "{name} not present" ) ) //Issue: #924
465
469
}
0 commit comments