Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Select Git revision
  • 06bbd3ba31554f2ece301838a3ade74a2b20e177
  • stable default
  • feat-fchv-bus
  • fix-h2-ice-bus
  • powertrains-multiple-axles
  • amdm3/develop
  • issue-1039
  • amdm3/main
  • test/nuget_publish
  • IEPC-experiments
  • amdm2/main
  • amdm2/develop
  • aptngearbox-not-auto
  • playground
  • official/main
  • official/develop
  • issue-templates
  • pdf-reports
  • HEV-timeruns-dev
  • timerun-empower-hybrids
  • timerun-pwheel-hybrids
  • Release/v5.0.3
  • Release/v5.0.1
  • Release/5.0.0-RC
  • Nuget/v0.11.4-DEV
  • Release/v0.11.4-DEV
  • Release/4.3.4-DEV
  • Release/4.3.3
  • Release/4.3.2-RC
  • Release/v4.3.0-DEV
  • Release/4.2.7
  • XMLConverterTool/4.2.6.0
  • Release/4.2.6-RC
  • Release/v4.2.5
  • Release/v4.2.3
  • Release/v4.2.2.3539-RC
  • Release/v4.2.1.3469
  • Release/v0.11.2.3456-DEV
  • Release/v4.2.0.3448-RC
  • Release/v4.1.3.3415
  • Release/v4.1.1.3413
41 results

VECTO3GUI2020Session.cs

Blame
  • Forked from VECTO / VECTO Sim
    1654 commits behind the upstream repository.
    user avatar
    Michael KRISPER authored
    Replaced Every Process.Start with a file by the ProcessStartInfo with UseShellExecute true. (The simple version didn't work under .net5.0)
    602fa750
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    VECTO3GUI2020Session.cs 2.48 KiB
    using System;
    using System.Diagnostics;
    using NUnit.Framework;
    using OpenQA.Selenium;
    using OpenQA.Selenium.Appium.Windows;
    using System.Reflection;
    using VECTO3GUI2020.Properties;
    
    namespace Vecto3GUI2020Test.UI
    {
        [TestFixture]
        public class VECTO3GUI2020Session
        {
            protected const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723";
            private const string NotepadAppId = @"C:\Windows\System32\notepad.exe";
    
    		private static Process winappDriverProcess;
    
            internal static WindowsDriver<WindowsElement> session;
    		internal static DesktopSession desktopSession;
    
    		public WindowsDriver<WindowsElement> DesktopSessionElement
    		{
    			get { return session; }
    		}
    
    		public static void Setup(TestContext context)
            {
                // Launch a new instance of VECTO application
                if (session == null) {
    				winappDriverProcess = Process.Start(@"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe");
    				// Create a new session to launch Notepad application
    
    
    				var appiumOptions = new OpenQA.Selenium.Appium.AppiumOptions();
    				appiumOptions.AddAdditionalCapability("app", @"C:\Users\Harry\source\repos\vecto-dev\VECTO3GUI2020\bin\Debug\VECTO3GUI2020.exe");
    				appiumOptions.AddAdditionalCapability("deviceName", "WindowsPC");
                    session = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), appiumOptions);
    				session.ActivateApp(Assembly.GetExecutingAssembly().Location);
    
    				// Use the session to control the app
    				Assert.IsNotNull(session);
                    Assert.IsNotNull(session.SessionId);
    
    
    				// Set implicit timeout to 1.5 seconds to make element search to retry every 500 ms for at most three times
                    session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
    			}
    
    			desktopSession = new DesktopSession();
    		}
    
            
            public static void TearDown()
    		{
    			// Close the application and delete the session
                if (session != null)
                {
                    session.CloseApp();
    				winappDriverProcess.Kill();
    				
    				session = null;
                }
            }
    
    		public void TestInitialize()
            {
                // Select all text and delete to clear the edit box
    		}
    
            protected static string SanitizeBackslashes(string input) => input.Replace("\\", Keys.Alt + Keys.NumberPad9 + Keys.NumberPad2 + Keys.Alt);
    
        }
    
    	public static class SessionExtensions{
    
    		public static void DoubleCLick(this WindowsElement element)
    		{
    			element.Click();
    			element.Click();
    		}
    	}
    }