示例#1
0
 public MobileApplication(AppProperties appProperties)
 {
     DeviceName         = DefaultDeviceName;
     this.appProperties = appProperties;
     appiumServer       = new AppiumServer();
     appiumServer.StartServer1();
 }
示例#2
0
        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");
        }
示例#3
0
        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.");
        }
示例#4
0
 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;
     }
 }
示例#5
0
        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);
        }
示例#6
0
        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");
        }
示例#8
0
 public static void AfterTestRun()
 {
     AppiumManager.CloseDriver();
     AppiumServer.StopLocalService();
     AppiumServer.OutputDataReceived -= OnOutputDataReceived;
 }
示例#9
0
 public void TestTest()
 {
     AppiumServer.Dispose();
 }
示例#10
0
 public App(Settings settings)
 {
     server  = new AppiumServer();
     client  = new AppClient(server.Service, settings);
     desktop = new DesktopClient(server.Service, settings);
 }