public IEnumerable <JSTest> RunTests(string jsFilePath, BrowserSetUp browserSetUp)
        {
            var filesBeingTested =
                new List <string> {
                "*.htm", "*.html"
            }.SelectMany(
                filter => Directory.EnumerateFiles(jsFilePath, filter, SearchOption.AllDirectories));

            foreach (string fileBeingTested in filesBeingTested)
            {
                string url     = fileBeingTested;
                var    actions = UITestRunner.InitializeWorkFlowContainer(
                    b => b.ElementsOfType <ListItem>()
                    .Where(x => x.InnerHtml.StartsWith("<strong>"))
                    .ForEach(x => GetJSTestSummary(x, url)));

                var list = new List <Action <Browser> >
                {
                    (b => b.GoTo(url)),
                    (b => b.WaitForComplete()),
                };
                if (actions != null)
                {
                    list.AddRange(actions);
                }

                var notification = new TestRunner(new BrowserProvider(browserSetUp), browserSetUp).PassesTest(list) ??
                                   new Notification();

                Assert.True(notification.Success, notification.ToString());
            }
            return(_jSTests);
        }
Beispiel #2
0
        public void TearDown()
        {
            BrowserSetUp.TearDown();

            //tunnel closes on any data in stdin
            sauceConnectProcess.StandardInput.WriteLine("0");
            sauceConnectProcess.WaitForExit(TimeSpan.FromSeconds(30).Milliseconds);
        }
        public void SetUp()
        {
            WaitResponse("http://localhost:8083/");

            var tunnelIdentifier = $"{Environment.MachineName}-{Guid.NewGuid()}";

            BrowserSetUp.SetUp(tunnelIdentifier);
        }
 public void TearDown()
 {
     BrowserSetUp.TearDown();
     if (TeamCityEnvironment.IsExecutionViaTeamCity)
     {
         KillProcessAndChildren(webServerProcess.Id);
     }
 }
Beispiel #5
0
        public void TestMethod()
        {
            Dictionary <string, string> dict = BrowserSetUp.getFireFoxProfile();

            foreach (var item in dict)
            {
                Console.WriteLine(item.Key + "  " + item.Value);
            }
        }
 public void TearDown()
 {
     BrowserSetUp.TearDown();
     if (TeamCityEnvironment.IsExecutionViaTeamCity)
     {
         KillProcessAndChildren(webServerProcess.Id);
         chromeDriverProcess.CloseMainWindow();
         chromeDriverProcess.WaitForExit(10000);
     }
 }
        public void TearDown()
        {
            BrowserSetUp.TearDown();

            if (TravisEnvironment.IsExecutionViaTravis)
            {
                //tunnel closes on any data in stdin
                sauceConnectProcess.StandardInput.WriteLine("0");
                sauceConnectProcess.WaitForExit(TimeSpan.FromSeconds(30).Milliseconds);
            }
        }
Beispiel #8
0
        public void SetUp()
        {
            WaitResponse("http://localhost:8083/");

            var tunnelIdentifier = Environment.GetEnvironmentVariable("TRAVIS_JOB_NUMBER", EnvironmentVariableTarget.Process) ?? $"{Environment.MachineName}-{Guid.NewGuid()}";

            sauceConnectProcess = CreateSauceConnectProcess(tunnelIdentifier);
            sauceConnectProcess.Start();
            if (sauceConnectProcess.StandardOutput.ReadLine() != "Sauce Connect ready")
            {
                throw new Exception("Unable to start sauce connect");
            }
            BrowserSetUp.SetUp(tunnelIdentifier);
        }
        public void SetUp()
        {
            if (TeamCityEnvironment.IsExecutionViaTeamCity)
            {
                KillWebPackDevServer();

                webServerProcess = CreateWebServerProcess();
                webServerProcess.Start();

                WaitResponse("http://localhost:8083/");
            }

            BrowserSetUp.SetUp();
        }
Beispiel #10
0
        public void SetUpBrowswer()
        {
            if (BrowserSetUp.getBrowserName().ToLower().StartsWith("fire"))
            {
                Dictionary <string, string> dictffprofile = BrowserSetUp.getFireFoxProfile();
                if (dictffprofile.Count != 0)
                {
                    FirefoxOptions ffoptions = new FirefoxOptions();
                    foreach (var item in dictffprofile)
                    {
                        if (item.Value.ToString().Equals("true") || item.Value.ToString().Equals("false"))
                        {
                            Boolean value = item.Value.ToString().Equals("true") ? true : false;
                            ffoptions.SetPreference(item.Key, value);
                        }
                        else
                        {
                            ffoptions.SetPreference(item.Key, item.Value);
                        }
                    }
                    driver = new FirefoxDriver(ffoptions);
                }
                else
                {
                    driver = new FirefoxDriver();
                }
            }
            else if (BrowserSetUp.getBrowserName().ToLower().StartsWith("chrome"))
            {
                ChromeOptions choptions = new ChromeOptions();
                choptions.AddArguments(BrowserSetUp.GetChromeOption());
                driver = new ChromeDriver(choptions);
            }

            driver.Navigate().GoToUrl(BrowserSetUp.getUrlApplication());
            driver.Manage().Window.Maximize();
            driver.Manage().Cookies.DeleteAllCookies();
        }
 public void TearDown()
 {
     BrowserSetUp.TearDown();
 }