Exemplo n.º 1
0
        /// <summary>
        /// Creates a new instance of this action tests.
        /// </summary>
        protected ActionTests()
        {
            // setup: web automation
            var configuration = new EngineConfiguration
            {
                ElementSearchingTimeout = 100,
                PageLoadTimeout         = 100
            };
            var authentication = new Authentication
            {
                UserName = "",
                Password = ""
            };

            WebAutomation = new WebAutomation
            {
                Authentication      = authentication,
                EngineConfiguration = configuration
            };

            // setup: web driver
            WebDriver = new MockWebDriver();

            // setup: timer
            Stopwatch = new Stopwatch();
        }
        /// <summary>
        /// Reflect an ActionFactory instance from Gravity.Core.
        /// </summary>
        /// <param name="webDriver"><see cref="IWebDriver"/> implementation to execute actions against.</param>
        /// <param name="webAutomation"><see cref="WebAutomation"/> data transfer object to execute.</param>
        /// <param name="types">Types in which to search for plug-in components.</param>
        /// <returns>Execution interface of this ActionFactory</returns>
        public static ICanExecute GetActionFactory(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
        {
            // setup
            const string AssemblyName = "Gravity.Services.Comet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
            const string ClassName    = "Gravity.Services.Comet.Engine.Core.ActionFactory";

            // get type
            var assembly = Assembly.Load(AssemblyName);
            var type     = assembly.GetType(ClassName);

            // create
            return((ICanExecute)Activator.CreateInstance(type, new object[] { webDriver, webAutomation, types }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new instance of this plug-in.
        /// </summary>
        /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
        /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
        /// <param name="types">Types from which to load plug-ins repositories.</param>
        public TryClick(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
            : base(webDriver, webAutomation, types)
        {
            // initialize exceptions ignore list
            var ignoreList = new[]
            {
                typeof(NoSuchElementException),
                typeof(StaleElementReferenceException),
                typeof(WebDriverException),
                typeof(NullReferenceException)
            };

            // setup waiter
            wait = new WebDriverWait(webDriver, TimeSpan.FromMilliseconds(ElementSearchTimeout));
            wait.IgnoreExceptionTypes(ignoreList);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public Repeat(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
     ActionFactory ??= GravityUtilities.GetActionFactory(webDriver, webAutomation, types);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public ContextClick(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
     actions = new Actions(webDriver);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public RegisterParameter(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public ElementsListener(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public NavigateBack(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public ExecuteScript(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 10
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public Refresh(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 11
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public CloseBrowser(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 12
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public SendKeys(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
     // setup
     this.webAutomation = webAutomation;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public CloseAllChildWindows(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 14
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public SendKeys(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 15
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public SetGeoLocation(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 16
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public SetGeoLocation(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 17
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public Keyboard(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 18
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public Keyboard(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 19
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public CloseAllChildWindows(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 20
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public Click(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
     actions = new Actions(webDriver);
     wait    = new WebDriverWait(webDriver, TimeSpan.FromMilliseconds(PageLoadTimeout));
 }
Exemplo n.º 21
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public Refresh(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 22
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public GetScreenshot(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 23
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public CloseBrowser(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 24
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public GetScreenshot(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 25
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public NavigateBack(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 26
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public TryClick(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }
Exemplo n.º 27
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 /// <param name="types">Types from which to load plug-ins repositories.</param>
 public ExecuteScript(IWebDriver webDriver, WebAutomation webAutomation, IEnumerable <Type> types)
     : base(webDriver, webAutomation, types)
 {
 }
Exemplo n.º 28
0
 /// <summary>
 /// Creates a new instance of this plug-in.
 /// </summary>
 /// <param name="webDriver">WebDriver implementation by which to execute the action.</param>
 /// <param name="webAutomation">This WebAutomation object (the original object sent by the user).</param>
 public RegisterParameter(IWebDriver webDriver, WebAutomation webAutomation)
     : this(webDriver, webAutomation, Utilities.GetTypes())
 {
 }