File tree Expand file tree Collapse file tree
Desktop.Tests/e2e/Drivers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
2+ using System . IO ;
23using OpenQA . Selenium . Appium ;
4+ using OpenQA . Selenium . Appium . Service ;
35
46namespace Desktop . Tests . e2e . Drivers ;
57
68public abstract class AppiumWindowsDriver : IDisposable
79{
8- private const string DefaultServerUri = "http://127.0.0.1:4723/" ;
10+ private const string AppiumServerLogPath = "AppiumServerLog.txt" ;
11+
12+ private const string AppiumServerIp = "127.0.0.1" ;
13+ private const int AppiumServerPort = 4723 ;
14+
15+ private static readonly string DefaultServerUri =
16+ $ "http://{ AppiumServerIp } :{ AppiumServerPort } /";
917
1018 protected readonly Uri ServerUri = new (
1119 Environment . GetEnvironmentVariable ( "APPIUM_HOST" ) ?? DefaultServerUri ) ;
@@ -17,5 +25,10 @@ public abstract class AppiumWindowsDriver : IDisposable
1725 PlatformName = "Windows"
1826 } ;
1927
28+ protected readonly AppiumLocalService AppiumLocalService = new AppiumServiceBuilder ( )
29+ . WithIPAddress ( AppiumServerIp ) . UsingPort ( AppiumServerPort )
30+ . WithLogFile ( new FileInfo ( AppiumServerLogPath ) )
31+ . Build ( ) ;
32+
2033 public abstract void Dispose ( ) ;
2134}
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ public class MainWindowDriver : AppiumWindowsDriver
1212
1313 public MainWindowDriver ( )
1414 {
15+ AppiumLocalService . Start ( ) ;
16+
1517 Options . App = Path . GetFullPath (
1618 Path . Combine (
1719 Environment . CurrentDirectory ,
You can’t perform that action at this time.
0 commit comments