|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | -using System.Text; |
| 1 | +using Aquality.Selenium.Elements; |
| 2 | +using Aquality.Selenium.Elements.Interfaces; |
| 3 | +using OpenQA.Selenium; |
| 4 | +using Aquality.Selenium.Logging; |
4 | 5 |
|
5 | 6 | namespace Aquality.Selenium.Forms |
6 | 7 | { |
| 8 | + /// <summary> |
| 9 | + /// Defines base class for any UI form. |
| 10 | + /// </summary> |
7 | 11 | public abstract class Form |
8 | 12 | { |
| 13 | + /// <summary> |
| 14 | + /// Instance of logger <see cref="Aquality.Selenium.Logging.Logger"> |
| 15 | + /// </summary> |
| 16 | + /// <value>Logger instance.</value> |
| 17 | + protected Logger Logger => Logger.Instance; |
| 18 | + |
| 19 | + /// <summary> |
| 20 | + /// Locator for specified form |
| 21 | + /// </summary> |
| 22 | + protected readonly By Locator; |
| 23 | + |
| 24 | + /// <summary> |
| 25 | + /// Name of specified form |
| 26 | + /// </summary> |
| 27 | + protected readonly string Name; |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Element factory <see cref="Aquality.Selenium.Elements.Interfaces.IElementFactory"> |
| 31 | + /// </summary> |
| 32 | + /// <value>Element factory.</value> |
| 33 | + protected IElementFactory ElementFactory => new ElementFactory(); |
| 34 | + |
| 35 | + private ILabel FormLabel => ElementFactory.GetLabel(Locator, Name); |
| 36 | + |
| 37 | + /// <summary> |
| 38 | + /// Return form state for form locator |
| 39 | + /// </summary> |
| 40 | + /// <value>True - form is opened, |
| 41 | + /// False - form is not opened.</value> |
| 42 | + public bool IsDisplayed => FormLabel.State.WaitForDisplayed(); |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// Constructor with parameters |
| 46 | + /// </summary> |
| 47 | + /// <param name="locator">Unique locator of the form.</param> |
| 48 | + /// <param name="name">Name of the form.</param> |
| 49 | + protected Form(By locator, string name) |
| 50 | + { |
| 51 | + Locator = locator; |
| 52 | + Name = name; |
| 53 | + } |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Scroll form without scrolling entire page |
| 57 | + /// </summary> |
| 58 | + /// <param name="x">horizontal coordinate</param> |
| 59 | + /// <param name="y">vertical coordinate</param> |
| 60 | + public void ScrollBy(int x, int y) |
| 61 | + { |
| 62 | + FormLabel.JsActions.ScrollBy(x, y); |
| 63 | + } |
9 | 64 | } |
10 | 65 | } |
0 commit comments