Exemple #1
0
 public static void Setup(TestContext context)
 {
     if (session == null)
     {
         var appiumOptions = new OpenQA.Selenium.Appium.AppiumOptions();
         appiumOptions.AddAdditionalCapability("app", WpfAppId);
         appiumOptions.AddAdditionalCapability("deviceName", "WindowsPC");
         session = new OpenQA.Selenium.Appium.Windows.WindowsDriver <OpenQA.Selenium.Appium.Windows.WindowsElement>(new Uri(WindowsApplicationDriverUrl), appiumOptions);
     }
 }
Exemple #2
0
        public void TestMethod1()
        {
            System.Diagnostics.Debug.WriteLine($"Specifying the text that will be returned by the PingServiceMock to validate that the WpfClient calls this Mock and not another service.");
            PingServiceMock.PingReturn = "Pong From Mock";

            System.Diagnostics.Debug.WriteLine($"TestMethod1: Setting up Appium");
            var options     = new OpenQA.Selenium.Appium.AppiumOptions();
            var exeLocation = System.IO.Path.GetFullPath(@"..\..\..\..\WpfApp1\bin\Debug\netcoreapp3.0\WpfApp1.exe");

            options.AddAdditionalCapability("app", exeLocation);

            var wpfSession = new OpenQA.Selenium.Appium.Windows.WindowsDriver <OpenQA.Selenium.Appium.Windows.WindowsElement>(
                new System.Uri("http://127.0.0.1:4723"),
                options,
                new System.TimeSpan(1, 0, 0));

            var pingButton = wpfSession.FindElementByAccessibilityId("PingButton");

            pingButton.Click();

            var pingLabel = wpfSession.FindElementByAccessibilityId("PingLabel");

            Assert.AreEqual("Pong From Mock", pingLabel.Text);
        }