Пример #1
0
 public Database(DriverEnum _driver)
 {
     if (_driver == DriverEnum.Undefined)
     {
         MessageBox.Show("Database Driver not set!", "Warning");
         return;
     }
     driver = _driver;
 }
Пример #2
0
        public static byte[] GetScreenshot(DriverEnum driverType, IWebDriver driver)
        {
            switch (driverType)
            {
            case DriverEnum.Firefox:
                var sessionId = ((FirefoxDriver)driver).SessionId.ToString();
                var base64    = GetFirefoxFullscreenScreenshot(sessionId).Result;
                return(Convert.FromBase64String(base64));

            default:
                return(((ITakesScreenshot)driver).GetScreenshot().AsByteArray);
            }
        }
Пример #3
0
        private static void SetupAllureLabel(DriverEnum driverType)
        {
            switch (driverType)
            {
                case DriverEnum.Firefox:
                    AllureLifecycle.Instance.UpdateTestCase(e => e.labels.Add(Label.Suite("Firefox")));
                    break;

                case DriverEnum.Chrome:
                    AllureLifecycle.Instance.UpdateTestCase(e => e.labels.Add(Label.Suite("Chrome")));
                    break;

                case DriverEnum.Edge:
                    AllureLifecycle.Instance.UpdateTestCase(e => e.labels.Add(Label.Suite("Microsoft Edge")));
                    break;

                case DriverEnum.InternetExplorer:
                    AllureLifecycle.Instance.UpdateTestCase(e => e.labels.Add(Label.Suite("Internet Explorer")));
                    break;
            }
        }
Пример #4
0
        public static IWebDriver SetupDriver(DriverEnum driverType)
        {
            IWebDriver driver;

            switch (driverType)
            {
            case DriverEnum.Firefox:
                var firefoxService = FirefoxDriverService.CreateDefaultService(driverDirectory);
                firefoxService.Port = port;
                driver = new FirefoxDriver(firefoxService);
                break;

            case DriverEnum.Chrome:
                var chromeService = ChromeDriverService.CreateDefaultService(driverDirectory);
                chromeService.Port = port;
                driver             = new ChromeDriver(chromeService);
                break;

            case DriverEnum.Edge:
                var edgeService = EdgeDriverService.CreateDefaultService();
                edgeService.Port = port;
                driver           = new EdgeDriver(edgeService);
                break;

            case DriverEnum.InternetExplorer:
                var ieService = InternetExplorerDriverService.CreateDefaultService(driverDirectory);
                ieService.Port = port;
                var ieOptions = new InternetExplorerOptions
                {
                    EnsureCleanSession = true
                };
                driver = new InternetExplorerDriver(ieService, ieOptions);
                break;

            default:
                throw new IndexOutOfRangeException("Driver type not recognised");
            }
            driver.Manage().Window.Maximize();
            return(driver);
        }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StorageConnectionCouchdb" /> class.
 /// </summary>
 /// <param name="driver">driver (required).</param>
 /// <param name="name">name.</param>
 /// <param name="settings">settings (required).</param>
 public StorageConnectionCouchdb(DriverEnum driver = default(DriverEnum), string name = default(string), StorageConnectionCouchdbSettings settings = default(StorageConnectionCouchdbSettings))
 {
     // to ensure "driver" is required (not null)
     if (driver == null)
     {
         throw new InvalidDataException("driver is a required property for StorageConnectionCouchdb and cannot be null");
     }
     else
     {
         this.Driver = driver;
     }
     // to ensure "settings" is required (not null)
     if (settings == null)
     {
         throw new InvalidDataException("settings is a required property for StorageConnectionCouchdb and cannot be null");
     }
     else
     {
         this.Settings = settings;
     }
     this.Name = name;
 }
Пример #6
0
 public TestBase(DriverEnum driverType)
 {
     this.driverType = driverType;
 }
Пример #7
0
 public GoogleTest(DriverEnum driverType) : base(driverType)
 {
 }