Exemple #1
0
        public SeleniumTestBase()
        {
            var options = new FirefoxOptions();

            if (isHeadless)
            {
                options.AddArgument("headless");
            }
            driver  = new FirefoxDriver(options);
            naviger = new SociatisNaviger(driver, "test2", "abc", "http://soctest.sociatis.net");
        }
        private MethodResult homeTest()
        {
            var options = new FirefoxOptions();

            if (isHeadless)
            {
                options.AddArgument("headless");
            }
            var driver = new FirefoxDriver(options);

            var naviger = new SociatisNaviger(driver, "test2", "abc", "http://soctest.sociatis.net");

            DateTime now = DateTime.Now;

            try
            {
                while (true)
                {
                    naviger.GotoHome();
                    var bodyText = driver.FindElement(By.TagName("body")).Text;
                    Assert.DoesNotContain(("Store update, insert, or delete statement"), bodyText);

                    if ((DateTime.Now - now).Seconds > 25)
                    {
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                lock (ConcurrentHomeTestsResults)
                    ConcurrentHomeTestsResults.AddError(e.Message);
                return(new MethodResult(e.Message));
            }
            finally
            {
                driver.Close();
            }

            return(MethodResult.Success);
        }