Beispiel #1
0
        /// <summary>
        /// Instantiates a ScenarioRunner with the passed in arguments
        /// </summary>
        /// <param name="args"></param>
        public ScenarioRunner(Arguments args)
        {
            _e3RefreshDelaySeconds = 12;
            _iterations            = args.Iterations;
            _browserProfilePath    = args.BrowserProfilePath;
            _usingTraceController  = args.UsingTraceController;
            _etlPath         = args.EtlPath;
            _maxAttempts     = args.MaxAttempts;
            _overrideTimeout = args.OverrideTimeout;
            _scenarios       = args.Scenarios.ToList();
            _browsers        = args.Browsers.ToList();
            _scenarioName    = args.ScenarioName;
            _measureSets     = GetMeasureSetInfo(args.SelectedMeasureSets.ToList());
            _logins          = new CredentialManager(args.CredentialPath);
            _timer           = new ResponsivenessTimer();

            if (args.MeasureResponsiveness)
            {
                _useTimer = true;
            }
            else
            {
                _useTimer = false;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Instantiates a ScenarioRunner with the passed in arguments
        /// </summary>
        /// <param name="args"></param>
        public ScenarioRunner(Arguments args)
        {
            _e3RefreshDelaySeconds = 12;
            _iterations            = args.Iterations;
            _browserProfilePath    = args.BrowserProfilePath;
            _usingTraceController  = args.UsingTraceController;
            _etlPath = args.EtlPath;
            _extensionsStagingPath = "";
            _maxAttempts           = args.MaxAttempts;
            _overrideTimeout       = args.OverrideTimeout;
            _scenarios             = args.Scenarios.ToList();
            _browsers               = args.Browsers.ToList();
            _workloadName           = args.ScenarioName;
            _measureSets            = GetMeasureSetInfo(args.SelectedMeasureSets.ToList());
            _logins                 = new CredentialManager(args.CredentialPath);
            _timer                  = new ResponsivenessTimer();
            _captureBaseline        = args.CaptureBaseline;
            _baselineCaptureSeconds = args.BaselineCaptureSeconds;
            _clearBrowserCache      = args.ClearBrowserCache;
            _executeWarmupRun       = args.DoWarmupRun;
            _hostName               = args.Host;
            _port = args.Port;
            _enableVerboseLogging  = args.EnableVerboseWebDriverLogging;
            _disableWpr            = args.DisableWpr;
            _enableScenarioTracing = args.EnableScenarioTracing;
            _enableBrowserTracing  = args.EnableBrowserTracing;
            _windowMode            = args.WindowMode;
            _broArgs                  = args.BroArgs;
            _infiniteLoop             = args.InfiniteLoop;
            _pauseAfterBrowserStart   = args.PauseAfterBrowserStart;
            _pauseBetweenScenariosRun = 3;

            if (!string.IsNullOrEmpty(args.ExtensionsPath))
            {
                _extensionsPaths = GetExtensionPaths(args.ExtensionsPath);
            }
            else
            {
                _extensionsPaths = null;
            }

            if (args.MeasureResponsiveness)
            {
                _useTimer = true;
            }
            else
            {
                _useTimer = false;
            }
        }
        /// <summary>
        /// Instantiates a ScenarioRunner with the passed in arguments
        /// </summary>
        /// <param name="args"></param>
        public ScenarioRunner(Arguments args)
        {
            _e3RefreshDelaySeconds = 12;
            _iterations            = args.Iterations;
            _browserProfilePath    = args.BrowserProfilePath;
            _usingTraceController  = args.UsingTraceController;
            _etlPath = args.EtlPath;
            _extensionsStagingPath = "";
            _maxAttempts           = args.MaxAttempts;
            _overrideTimeout       = args.OverrideTimeout;
            _scenarios             = args.Scenarios.ToList();
            _browsers               = args.Browsers.ToList();
            _scenarioName           = args.ScenarioName;
            _measureSets            = GetMeasureSetInfo(args.SelectedMeasureSets.ToList());
            _logins                 = new CredentialManager(args.CredentialPath);
            _timer                  = new ResponsivenessTimer();
            _captureBaseline        = args.CaptureBaseline;
            _baselineCaptureSeconds = args.BaselineCaptureSeconds;

            if (!string.IsNullOrEmpty(args.ExtensionsPath))
            {
                _extensionsPaths = GetExtensionPaths(args.ExtensionsPath);
            }
            else
            {
                _extensionsPaths = null;
            }

            if (args.MeasureResponsiveness)
            {
                _useTimer = true;
            }
            else
            {
                _useTimer = false;
            }
        }
 public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
 {
     driver.NavigateToUrl("https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/#identifier");
     driver.Wait(2);
     LogIn(driver, credentialManager);
     BrowseEmails(driver, 5);
 }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Navigate
            driver.NavigateToUrl("https://www.ixbt.com");
            driver.Wait(5);

            driver.ScrollPageSmoothDown(3); // Takes seconds Ntimes * 2
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Go to Newsela
            driver.Navigate().GoToUrl("http://www.newsela.com");
            driver.WaitForPageLoad();
            driver.Wait(5);

            // Navigate to the library
            driver.ClickElement(driver.FindElement(By.XPath("//*[@href='/articles/#/rule/latest-library']")));
            driver.WaitForPageLoad();
            driver.Wait(5);

            // Search for "Chinese New Year"
            driver.TypeIntoField(driver.FindElementById("inset-search").FindElement(By.TagName("input")), "chinese new year" + Keys.Enter);
            driver.WaitForPageLoad();
            driver.Wait(2);

            // Go to the article
            driver.ClickElement(driver.FindElementByXPath("//*[@href='/articles/lib-history-chinese-new-year/id/25129/']"));
            driver.WaitForPageLoad();
            driver.Wait(2);

            // Sadly, we can't scroll far since we're not logged in
            driver.ScrollPage(1);
        }
Beispiel #7
0
 public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
 {
 }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Start local web server
            Task <string> webSrvTask = WebSrv.StartWebSrv(DefaultDuration, GetWebRootPath());

            for (var i = 1; i < 5; i++)
            {
                for (var n = 1; n < 6; n++)
                {
                    driver.CreateNewTab();
                    driver.Wait(1);
                    driver.NavigateToUrl($"http://site{n}.local:8080/index.html");
                    driver.Wait(9);
                }
            }

            Logger.LogWriteLine(webSrvTask.Result);
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to local static resource
            var indexHtml = GetStaticResourceUrl();

            driver.NavigateToUrl(indexHtml);

            for (var i = 0; i < 4; i++)
            {
                driver.Wait(1);

                driver.CreateNewTab();
                driver.Wait(1);

                driver.NavigateToUrl(indexHtml);
            }
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to the Instagram page for the NY public library
            driver.NavigateToUrl("https://www.instagram.com/nypl/");
            driver.Wait(5);

            driver.ScrollPage(2);

            // Start the infinite scrolling list by clicking on "load more"
            driver.ClickElement(driver.FindElement(By.XPath("//*[contains(text(), 'Load more')]")));
            driver.Wait(3);

            // Then scroll through it
            driver.ScrollPage(8);

            timer.ExtractPageLoadTime("Instagram account");
        }
Beispiel #11
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Navigate to the Surface Pro 4 review on TechRadar.
            driver.NavigateToUrl("http://www.techradar.com/us/reviews/pc-mac/tablets/microsoft-surface-pro-4-1290285/review");

            driver.Wait(5);

            // Scroll down multiple times
            driver.ScrollPage(10);
        }
Beispiel #12
0
 public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
 {
     // This scenario simply does nothing but sit and wait on the current page (blank page) for five minutes.
     driver.Wait(11, "BeforeIdleMeasurement"); // assuming a 10s E3 interval. Waiting to ensure any E3 events that might contain energy for launching the scenario have already fired.
     ScenarioEventSourceProvider.EventLog.MeasurementRegionStart("Idle");
     driver.Wait(300, "Idle");
     ScenarioEventSourceProvider.EventLog.MeasurementRegionStop("Idle");
     driver.Wait(11, "AfterIdleMeasurement");
 }
Beispiel #13
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            driver.NavigateToUrl("http://www.google.com");
            driver.Wait(5);

            // Search for "Seattle" and hit enter
            driver.TypeIntoField(driver.FindElementByXPath("//*[@id=\"lst-ib\"]"), "Seattle" + Keys.Enter);

            // Simply yield control back to the main thread and look at results
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to the homepage for Twitter
            driver.NavigateToUrl("https://www.twitter.com");
            driver.Wait(5);

            ScenarioEventSourceProvider.EventLog.ScenarioActionStart("Scroll down page");
            // Scroll through the infinite list
            driver.ScrollPage(16);
            ScenarioEventSourceProvider.EventLog.ScenarioActionStop("Scroll down page");
        }
Beispiel #15
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to the homepage for Tumblr
            driver.Navigate().GoToUrl("https://www.tumblr.com/explore/trending");
            driver.WaitForPageLoad();
            driver.Wait(10);

            // Try changing content with content controls
            //     At the time of writing, this is interesting because it doesn't require an actual page load

            driver.ClickElement(driver.FindElementByClassName("l-header-container").FindElement(By.XPath("//*[@data-text='Staff picks']")));
            driver.Wait(10);
            driver.ClickElement(driver.FindElementByClassName("l-header-container").FindElement(By.XPath("//*[@data-text='Trending']")));
            driver.Wait(5);

            // Scroll through the infinite list
            driver.ScrollPage(10);
        }
Beispiel #16
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            UserInfo credentials = credentialManager.GetCredentials("office.com");

            // Navigate
            driver.NavigateToUrl("https://outlook.live.com/owa/?nlp=1");
            driver.Wait(5);

            // Log in
            driver.TypeIntoField(driver.FindElementById("i0116"), credentials.Username + Keys.Enter);
            driver.Wait(1);

            driver.TypeIntoField(driver.FindElementById("i0118"), credentials.Password + Keys.Enter);
            driver.Wait(10);

            // Go to office
            driver.ClickElement(driver.FindElementByClassName("o365cs-nav-button"));
            driver.ClickElement(driver.FindElementById("O365_AppTile_ShellPowerPointOnline"));
            driver.Wait(8);

            // That opens up a new tab, so we have to give Webdriver focus in the new tab
            driver.SwitchTo().Window(driver.WindowHandles[driver.WindowHandles.Count - 1]);
            driver.Wait(1);

            // Open up a  doc
            driver.ClickElement(driver.FindElementById("mruitem_0"));
            driver.Wait(6);

            // This next section is in an iframe, so we have to switch to the iframe to access content in it
            driver.SwitchTo().Frame(driver.FindElement(By.Id("sdx_ow_iframe")));

            // Edit the document
            driver.ClickElement(driver.FindElementById("PptUpperToolbar.LeftButtonDock.FlyoutPptEdit-Medium20"));
            driver.Wait(1);
            driver.ClickElement(driver.FindElementById("PptUpperToolbar.LeftButtonDock.FlyoutPptEdit.EditInWebApp-Menu32"));
            driver.Wait(6);
            driver.ScrollPage(2);
        }
Beispiel #17
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            UserInfo credentials = credentialManager.GetCredentials("pinterest.com");

            // Nagivate to the Pintrest explore page
            driver.Navigate().GoToUrl("https://www.pinterest.com/");
            driver.Wait(5);

            // Log in
            driver.TypeIntoField(driver.FindElement(By.Name("id")), credentials.Username);
            driver.Wait(2);
            driver.TypeIntoField(driver.FindElement(By.Name("password")), credentials.Password + Keys.Enter);
            driver.Wait(8);

            // Scroll
            driver.ScrollPage(10);
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to static resource with content of http://ya.ru
            var staticYaRu = GetStaticResourceUrl();

            driver.NavigateToUrl(staticYaRu);

            for (var i = 0; i < 4; i++)
            {
                driver.Wait(1);

                driver.CreateNewTab();
                driver.Wait(1);

                driver.NavigateToUrl(staticYaRu);
            }
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Start local web server
            Task <string> webSrvTask = WebSrv.StartWebSrv(DefaultDuration, GetWebRootPath());

            // Nagivate to static resource
            var staticUrl = GetStaticResourceUrl();

            driver.NavigateToUrl(staticUrl);

            WebSrv.StopWebSrv(Name);
        }
Beispiel #20
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Go to Scholastic
            driver.NavigateToUrl("http://www.scholastic.com");
            driver.Wait(5);

            // The dropdown nav does not play well with webdriver, so navigate to Harry Potter directly
            driver.NavigateToUrl("http://harrypotter.scholastic.com/?esp=CORPHP/ib/////NAV/Kids/QLinks/STACKSHarryPotter////");
            driver.Wait(10);

            // Go to the first book
            driver.ClickElement(driver.FindElementById("home_nonflash").FindElement(By.XPath("//*[@href='/sorcerers_stone/']")));
            driver.WaitForPageLoad();
            driver.Wait(5);

            // Then scroll down
            driver.ScrollPage(2);
        }
Beispiel #21
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            driver.Navigate().GoToUrl("http://www.google.com");
            driver.WaitForPageLoad();
            driver.Wait(5);

            // Search for "prime factorization" and hit enter
            driver.TypeIntoField(driver.FindElementByXPath("//*[@title='Search']"), "prime factorization" + Keys.Enter);
            driver.Wait(5);

            // Click on the Prime Factorization box that comes up
            driver.ClickElement(driver.FindElementByXPath("//*[contains(text(), 'Prime Factorization - Math is Fun')]"));

            // Read through it
            for (int i = 0; i < 3; i++)
            {
                driver.Wait(2);
                driver.ScrollPage(1);
            }
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Start local web server
            Task <string> webSrvTask = WebSrv.StartWebSrv(DefaultDuration, GetWebRootPath());

            // Nagivate to static resource
            var staticUrl = GetStaticResourceUrl();

            driver.NavigateToUrl(staticUrl + "?redirectTo=https://ya.ru/");
            driver.Wait(10);

            driver.CreateNewTab();
            driver.Wait(1);
            driver.NavigateToUrl(staticUrl + "?redirectTo=https://google.ru/");
            driver.Wait(14);

            driver.CreateNewTab();
            driver.Wait(1);
            driver.NavigateToUrl(staticUrl + "?redirectTo=https://amazon.com/");
            driver.Wait(14);

            driver.CreateNewTab();
            driver.Wait(1);
            driver.NavigateToUrl(staticUrl + "?redirectTo=https://youtube.com/");
            driver.Wait(14);

            WebSrv.StopWebSrv(Name);
        }
Beispiel #23
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            driver.NavigateToUrl("https://www.youtube.com/watch?v=ZSn3Tvc7jQU&vq=hd1080");

            // Toggle Theater Mode after YouTube finishes loading a video.
            driver.Wait(5);
            driver.ExecuteScript("document.querySelector('#movie_player').clientWidth < 1000 ? document.querySelector('button.ytp-size-button').click() : console.log('already wide');");
            playVideo(driver);
        }
Beispiel #24
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Navigate
            driver.NavigateToUrl("http://habrahabr.ru");
            driver.Wait(5);
            for (var n = 0; n < 2; n++)
            {
                driver.ScrollPageSmoothDown(7);

                driver.ScrollPageSmoothUp(7);
            }
        }
Beispiel #25
0
 public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
 {
     driver.NavigateToUrl("http://www.google.com");
 }
Beispiel #26
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Nagivate to the homepage for Twitter
            driver.Navigate().GoToUrl("https://www.twitter.com");
            driver.WaitForPageLoad();
            driver.Wait(5);

            // Scroll through the infinite list
            driver.ScrollPage(16);
        }
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            var sber = "https://tls12-ecdhe-rsa-aes128-sha.xsstest.ru/youtube/";

            driver.NavigateToUrl(sber);
            driver.Wait(1);
        }
Beispiel #28
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            // Get the relevant username and password
            UserInfo credentials = credentialManager.GetCredentials("powerbi.com");

            // Navigate and log in
            driver.Navigate().GoToUrl("http://app.powerbi.com");
            driver.Wait(5);

            driver.ClickElement(driver.FindElement(By.XPath("//*[@data-event-property='signin']")));
            driver.Wait(5);

            driver.TypeIntoField(driver.FindElementById("cred_userid_inputtext"), credentials.Username);
            driver.Wait(1);

            driver.TypeIntoField(driver.FindElementById("cred_password_inputtext"), credentials.Password);
            driver.Wait(1);
            driver.Keyboard.SendKeys(Keys.Enter);
            driver.Wait(5);

            // Click into Gross Margin %
            driver.ClickElement(driver.FindElement(By.XPath("//*[@data-id='2423882']")).FindElement(By.ClassName("inFocusTileBtn")));
            driver.Wait(10);

            // Back to dashboard
            driver.ClickElement(driver.FindElement(By.XPath("//*[contains(text(), 'Exit Focus mode')]")).FindElement(By.XPath("..")));
            driver.Wait(3);

            // Click into Total Revenue
            driver.ClickElement(driver.FindElement(By.XPath("//*[@data-id='2423887']")).FindElement(By.ClassName("inFocusTileBtn")));
            driver.Wait(10);

            // Back to dashboard
            driver.ClickElement(driver.FindElement(By.XPath("//*[contains(text(), 'Exit Focus mode')]")).FindElement(By.XPath("..")));
        }
 public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
 {
     driver.Navigate().GoToUrl("http://bleacherreport.com/articles/2657513-tim-duncan-declined-olympic-invitation-from-president-obama?utm_source=cnn.com&utm_medium=referral&utm_campaign=editorial");
 }
Beispiel #30
0
        public override void Run(RemoteWebDriver driver, string browser, CredentialManager credentialManager, ResponsivenessTimer timer)
        {
            var benchmarkUrl = "http://browserbench.org/Speedometer/";

            driver.NavigateToUrl(benchmarkUrl);

            StartBenchmark(driver);
            driver.Wait(DefaultDuration - 5);
            SaveBenchmarkResult(driver);
        }