public MobileApplication(AppProperties appProperties) { DeviceName = DefaultDeviceName; this.appProperties = appProperties; appiumServer = new AppiumServer(); appiumServer.StartServer1(); }
public void AppiumServiceShouldNotStartIfLocalExecutionIsFalse() { TestEnvironmentParameters parameters = new TestEnvironmentParameters { RS_LocalExecution = "false", RS_LocalExecutionAsService = "true" }; AppiumServer.Start(parameters); Assert.False(MobileTestContext.ContainsKey(Constants.AppiumServiceKey), "Service should not have started"); }
public void HostNameEmptyThrows() { TestEnvironmentParameters parameters = new TestEnvironmentParameters { RS_LocalExecution = "true", RS_LocalExecutionAsService = "true", RS_ServerHost = "", RS_NodeExePath = Constants.RS_NodeExePath, RS_AppiumJSPath = Constants.RS_AppiumJSPath }; Assert.Throws <ArgumentNullException>(() => AppiumServer.Start(parameters), "Empty Hostname should throw."); }
protected static void Dispose(bool isNotDisposed) { if (isNotDisposed) { if (properties == null) { return; } if (properties.ContainsKey(nameof(MobileDriver))) { properties[nameof(MobileDriver)] = null; } if (properties.ContainsKey(Constants.AppiumServiceKey)) { AppiumServer.Dispose(); properties[Constants.AppiumServiceKey] = null; } properties = null; } }
public void SecondAppiumServiceStartsIfLocalExecutionAndLocalExecutionAsServiceAreTrue() { TestEnvironmentParameters parameters = new TestEnvironmentParameters { RS_LocalExecution = "true", RS_LocalExecutionAsService = "true", RS_ServerHost = "127.0.0.1", RS_NodeExePath = Constants.RS_NodeExePath, RS_AppiumJSPath = Constants.RS_AppiumJSPath, RS_ServerPort = "0000" }; AppiumServer.Start(parameters); Uri serviceUri = parameters.ServerUri; Assert.True(MobileTestContext.ContainsKey(Constants.AppiumServiceKey), "Service should have started"); Assert.NotNull(serviceUri, "Service should not be null."); Assert.AreEqual(serviceUri, $"http://{Constants.RS_ServerHost}:{parameters.RS_ServerPort}{Constants.RS_ServerResource}", "Service Url does not match default Url"); Assert.AreNotEqual(parameters.RS_ServerPort, firstTestPortNumber, "Service should start on different port numbers"); Console.WriteLine(serviceUri.AbsoluteUri); }
public static void BeforeTestRun() { Reporters.Add(new JsonReporter()); Reporters.FinishedReport += (sender, args) => { var reportsPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); try { ScreenshotEmbedder.EmbedScreenshotsForFailedScenarios(args.Reporter.Report.Features, ScenarioScreenshots); } catch (Exception exception) { Console.WriteLine(exception); } args.Reporter.WriteToFile($"{reportsPath}/TestReports.json"); }; AppiumManager.Platform = Settings.GlobalSettings.Platform == "iOS" ? PlatformEnum.IOS : PlatformEnum.Android; AppiumServer.OutputDataReceived += OnOutputDataReceived; AppiumServer.StartServerIfShouldRunLocally(); }
static RequestSender() { var serverConfig = new AppiumServer(); client = new RestClient($"{serverConfig.host}:{serverConfig.port}/wd/hub"); }
public static void AfterTestRun() { AppiumManager.CloseDriver(); AppiumServer.StopLocalService(); AppiumServer.OutputDataReceived -= OnOutputDataReceived; }
public void TestTest() { AppiumServer.Dispose(); }
public App(Settings settings) { server = new AppiumServer(); client = new AppClient(server.Service, settings); desktop = new DesktopClient(server.Service, settings); }