@@ -38,25 +38,25 @@ public TestDriver(IJavaScriptExecutor javascriptExecutor)
3838 /// <inheritdoc cref="ITestDriver"/>
3939 public void LoadTestData ( string data )
4040 {
41- this . ExecuteAsyncScriptWithExceptionOnReject ( $ "loadTestData(`{ data } `)") ;
41+ this . ExecuteDriverFunctionAsync ( $ "loadTestData(`{ data } `)") ;
4242 }
4343
4444 /// <inheritdoc cref="ITestDriver"/>
4545 public void DeleteTestData ( )
4646 {
47- this . ExecuteAsyncScriptWithExceptionOnReject ( "deleteTestData()" ) ;
47+ this . ExecuteDriverFunctionAsync ( "deleteTestData()" ) ;
4848 }
4949
5050 /// <inheritdoc cref="ITestDriver"/>
5151 public void OpenTestRecord ( string recordAlias )
5252 {
53- this . ExecuteAsyncScriptWithExceptionOnReject ( $ "openTestRecord('{ recordAlias } ')") ;
53+ this . ExecuteDriverFunctionAsync ( $ "openTestRecord('{ recordAlias } ')") ;
5454 }
5555
5656 /// <inheritdoc/>
5757 public EntityReference GetTestRecordReference ( string recordAlias )
5858 {
59- var obj = ( Dictionary < string , object > ) this . javascriptExecutor . ExecuteScript ( $ "{ TestDriverReference } . getRecordReference('{ recordAlias } '); ") ;
59+ var obj = ( Dictionary < string , object > ) this . ExecuteDriverFunction ( $ "getRecordReference('{ recordAlias } ')") ;
6060
6161 return new EntityReference ( ( string ) obj [ "entityType" ] , Guid . Parse ( ( string ) obj [ "id" ] ) ) ;
6262 }
@@ -66,7 +66,12 @@ private static string GetExecuteScriptForAsyncFunction(string functionCall)
6666 return $ "{ TestDriverReference } .{ functionCall } .then(arguments[arguments.length - 1]).catch(e => {{ arguments[arguments.length - 1](`{ ErrorPrefix } : ${{ e.message }}`); }});";
6767 }
6868
69- private object ExecuteAsyncScriptWithExceptionOnReject ( string functionCall )
69+ private object ExecuteDriverFunction ( string functionCall )
70+ {
71+ return this . javascriptExecutor . ExecuteScript ( $ "return { TestDriverReference } .{ functionCall } ;") ;
72+ }
73+
74+ private object ExecuteDriverFunctionAsync ( string functionCall )
7075 {
7176 var result = this . javascriptExecutor . ExecuteAsyncScript ( GetExecuteScriptForAsyncFunction ( functionCall ) ) ;
7277
0 commit comments