Ejemplo n.º 1
0
        public void Init()
        {
            switch (ConfigManager.Browser)
            {
            case BrowserType.Chrome:
                try
                {
                    KillDriverProcessess();
                    string chromeVersion = UtilManager.ChromeVersion();
                    if (chromeVersion.StartsWith("68") || chromeVersion.StartsWith("69"))
                    {
                        this.driver = new ChromeDriver(ConfigManager.ChromeDriverArchivePath);
                    }
                    else
                    {
                        this.driver = new ChromeDriver(ConfigManager.ChromeDriverPath);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message + ex.StackTrace);
                    throw ex;
                }
                break;

            case BrowserType.Firefox:
                this.driver = new FirefoxDriver();
                break;
            }

            //this.driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(ConfigManager.PageLoadTimeOut);
            //this.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(ConfigManager.ImplicitWaitTime);
            this.WindowMaximize();
        }
Ejemplo n.º 2
0
        protected void BeforeAllTests()
        {
            if (Report == null)
            {
                TestRunNum = DataManager.RandomInt(8);
                var reportsFolder = ConfigManager.ReportsFolder + "\\" + TestRunNum;
                ConfigManager.CreateFolder(reportsFolder);
                var fileName     = this.GetType().ToString() + ".html";
                var htmlReporter = new ExtentHtmlReporter(reportsFolder + "\\" + fileName);
                htmlReporter.Config.DocumentTitle = ConfigManager.ReportTitle;
                htmlReporter.Config.ReportName    = ConfigManager.BuildNum;
                Report = new ExtentReports();
                Report.AttachReporter(htmlReporter);

                //DriverManager.StartLogging(TestRunNum);
                Log.Information("Start of Test Execution...");

                DataRandomToken = TestContext.Parameters.Get("DataRandomToken",
                                                             (ConfigManager.DataRandomToken.Length > 0)
                                                ? ConfigManager.DataRandomToken
                                                : UtilManager.RandomAlphaNumString(4));

                Log.Information("Data Random Token={DataRandomToken}", DataRandomToken);
            }
        }