private void MeasureResponseTimeForAddingApprenticeships(object o)
        {
            string emailString = emailIndex.ToString("D3");

            emailIndex++;
            IWebDriver driver = new ChromeDriver();

            try
            {
                driver.Manage().Window.Maximize();

                Stopwatch timer = new Stopwatch();
                timer.Start();
                driver.Navigate().GoToUrl(siteUrl);
                timer.Stop();
                timeToLoadHomePage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadHomePage = decimal.Round(timeToLoadHomePage, 2);

                timer.Reset();
                timer.Start();
                var homePage = new HomePage(driver);
                homePage.StartButton.ClickThisElement();
                timer.Stop();
                timeToLoadUsedThisServiceBeforePage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadUsedThisServiceBeforePage = decimal.Round(timeToLoadUsedThisServiceBeforePage, 2);

                homePage.UsedServiceBefore.CheckThisRadioButton();

                timer.Reset();
                timer.Start();
                homePage.Continue.ClickThisElement();
                timer.Stop();
                timeToLoadLoginPage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadLoginPage = decimal.Round(timeToLoadLoginPage, 2);

                timer.Reset();
                timer.Start();
                var loginPage = new LoginPage(driver);
                loginPage.LoginAsUser($"perfUser{emailString}@loadtest.local", "Pa55word");
                timer.Stop();
                timeToLoadYourAccountsPage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadYourAccountsPage = decimal.Round(timeToLoadYourAccountsPage, 2);

                timer.Reset();
                timer.Start();
                driver.FindElement(By.CssSelector("[title*='SAINSBURY']")).Click();
                timer.Stop();
                timeToLoadSainsburyPage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadSainsburyPage = decimal.Round(timeToLoadSainsburyPage, 2);

                timer.Reset();
                timer.Start();
                driver.FindElement(By.CssSelector("h2>a[href*='finance']")).Click();
                timer.Stop();
                timeToLoadFinancePage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadFinancePage = decimal.Round(timeToLoadFinancePage, 2);

                timer.Reset();
                timer.Start();
                driver.FindElement(By.CssSelector("h2>a[href*='transfers']")).Click();
                timer.Stop();
                timeToLoadTransfersPage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadTransfersPage = decimal.Round(timeToLoadTransfersPage, 2);

                timer.Reset();
                timer.Start();
                driver.FindElement(By.CssSelector("a[href*='start-transfer']")).Click();
                timeToLoadStartTransfersPage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadStartTransfersPage = decimal.Round(timeToLoadStartTransfersPage, 2);

                timer.Reset();
                timer.Start();
                driver.FindElement(By.CssSelector("a[href*='start-redirect']")).Click();
                timeToLoadAddApprenticeshipsPage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadAddApprenticeshipsPage = decimal.Round(timeToLoadAddApprenticeshipsPage, 2);

                if (!driver.Url.Contains("apprenticeship/add"))
                {
                    var secondEstimateCostsPage        = new EstimateCostsPage(driver);
                    var secondIsAnyapprenticeshipExist = secondEstimateCostsPage.IsApprenticeshipsTableVisible();
                    while (secondIsAnyapprenticeshipExist)
                    {
                        secondEstimateCostsPage.RemoveApprenticeshipButton.ClickThisElement();
                        var removalPage = new RemoveApprenticeshipPage(driver);
                        removalPage.ConfirmRemoval();
                        secondIsAnyapprenticeshipExist = secondEstimateCostsPage.IsApprenticeshipsTableVisible();
                    }

                    driver.FindElement(By.CssSelector("a[href*='apprenticeship/add']")).Click();
                }

                var addApprenticeshipPage = new AddApprenticeshipsToEstimateCostPage(driver);
                addApprenticeshipPage.SelectApprenticeshipDropdown.SelectDropDown(driver,
                                                                                  "Actuary, Level: 7 (Standard)");
                addApprenticeshipPage.PageHeader.ClickThisElement();
                addApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("1");
                addApprenticeshipPage.StartDateMonthInput.EnterTextInThisElement("10");
                addApprenticeshipPage.StartDateYearInput.EnterTextInThisElement("2019");

                timer.Reset();
                timer.Start();
                addApprenticeshipPage.ContinueButton.ClickThisElement();
                timeToLoadEstimateCostsPage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadEstimateCostsPage = decimal.Round(timeToLoadEstimateCostsPage, 2);

                timer.Reset();
                timer.Start();
                driver.FindElement(By.CssSelector("a[href*='EditApprenticeships']")).Click();
                timeToLoadEditApprenticeshipsPage = decimal.Parse($"{timer.Elapsed.TotalSeconds}");
                timeToLoadEditApprenticeshipsPage = decimal.Round(timeToLoadEditApprenticeshipsPage, 2);

                var editApprenticeshipPage = new AddApprenticeshipsToEstimateCostPage(driver);
                editApprenticeshipPage.NumberOfApprenticesInput.Clear();
                editApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("2");
                editApprenticeshipPage.ContinueButton.ClickThisElement();

                driver.FindElement(By.CssSelector("a[href*='apprenticeship/add']")).Click();

                var secondAddApprenticeshipPage = new AddApprenticeshipsToEstimateCostPage(driver);

                secondAddApprenticeshipPage.SelectApprenticeshipDropdown.SelectDropDown(driver,
                                                                                        "Abattoir Worker, Level: 2 (Standard)");
                secondAddApprenticeshipPage.PageHeader.ClickThisElement();
                secondAddApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("3");
                secondAddApprenticeshipPage.StartDateMonthInput.EnterTextInThisElement("11");
                secondAddApprenticeshipPage.StartDateYearInput.EnterTextInThisElement("2020");
                secondAddApprenticeshipPage.ContinueButton.ClickThisElement();

                var estimateCostsPage        = new EstimateCostsPage(driver);
                var isAnyapprenticeshipExist = estimateCostsPage.IsApprenticeshipsTableVisible();
                while (isAnyapprenticeshipExist)
                {
                    estimateCostsPage.RemoveApprenticeshipButton.ClickThisElement();
                    var removalPage = new RemoveApprenticeshipPage(driver);
                    removalPage.ConfirmRemoval();
                    isAnyapprenticeshipExist = estimateCostsPage.IsApprenticeshipsTableVisible();
                }

                timeToLoadHomePages.Add(timeToLoadHomePage);
                timeToLoadUsedThisServiceBeforePages.Add(timeToLoadUsedThisServiceBeforePage);
                timeToLoadLoginPages.Add(timeToLoadLoginPage);
                timeToLoadYourAccountsPages.Add(timeToLoadYourAccountsPage);
                timeToLoadSainsburyPages.Add(timeToLoadSainsburyPage);
                timeToLoadFinancePages.Add(timeToLoadFinancePage);
                timeToLoadTransfersPages.Add(timeToLoadTransfersPage);
                timeToLoadStartTransfersPages.Add(timeToLoadStartTransfersPage);
                timeToLoadAddApprenticeshipsPages.Add(timeToLoadAddApprenticeshipsPage);
                timeToLoadEstimateCostsPages.Add(timeToLoadEstimateCostsPage);
                timeToLoadEditApprenticeshipsPages.Add(timeToLoadEditApprenticeshipsPage);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                errorsCount++;
            }
            finally
            {
                driver.Dispose();
                if (Interlocked.Decrement(ref _numerOfThreadsNotYetCompleted) == 0)
                {
                    _doneEvent.Set();
                }
            }
        }
예제 #2
0
        public void ThenTheRemoveApprenticeshipPageIsDisplayed()
        {
            RemoveApprenticeshipPage removeApprenticeshipPage = new RemoveApprenticeshipPage(WebSite.getDriver());

            Assert.IsTrue(removeApprenticeshipPage.IsPageLoaded);
        }
예제 #3
0
        public void WhenIClickContinue()
        {
            RemoveApprenticeshipPage removeApprenticeshipPage = new RemoveApprenticeshipPage(WebSite.getDriver());

            removeApprenticeshipPage.ClickContinueButton();
        }
예제 #4
0
        public void GivenTheNoRadioButtonIsDefaultedAsSelected()
        {
            RemoveApprenticeshipPage removeApprenticeshipPage = new RemoveApprenticeshipPage(WebSite.getDriver());

            Assert.IsTrue(removeApprenticeshipPage.IsNoRadioButtonSelected);
        }
예제 #5
0
        public void GivenThatIHaveRemovedAnApprenticeship()
        {
            EmployeeLogin    = "******";
            EmployeePassword = "******";

            var loginPage = WebSite.NavigateToLoginPage();

            loginPage.LoginAsUser(EmployeeLogin, EmployeePassword);

            var accountHomepage = WebSite.NavigateToAccountHomePage();
            var financePage     = accountHomepage.OpenFinance();

            financePage.OpenFundingProjection();

            WebSite.NavigateToEstimateFundsStartPage();

            EstimateFundsStartPage page =
                new EstimateFundsStartPage(WebSite.getDriver());

            page.ClickStartForAccountWithoutApprenticeships();
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());

            if (!WebSite.CurrentUrl.Contains("apprenticeship/add"))
            {
                var isAnyapprenticeshipExist = estimateCostsPage.IsApprenticeshipsTableVisible();
                while (isAnyapprenticeshipExist)
                {
                    estimateCostsPage.RemoveFirstApprenticeship();
                    isAnyapprenticeshipExist = estimateCostsPage.IsApprenticeshipsTableVisible();
                }
            }

            if (!WebSite.CurrentUrl.Contains("apprenticeship/add"))
            {
                EstimateCostsPage fundsStartPage = new EstimateCostsPage(WebSite.getDriver());
                fundsStartPage.AddApprenticeshipsButton.Click();
            }

            string month     = DateTime.UtcNow.Month.ToString();
            string nextMonth = (DateTime.UtcNow.Month + 1).ToString();
            string year      = DateTime.UtcNow.Year.ToString();

            AddApprenticeshipsToEstimateCostPage addApprenticeshipPage =
                new AddApprenticeshipsToEstimateCostPage(WebSite.getDriver());

            addApprenticeshipPage.UseTransferAllowance.Click();
            addApprenticeshipPage.SelectApprenticeshipDropdown.SelectDropDown(WebSite.getDriver(), "Actuary, Level: 7 (Standard)");
            addApprenticeshipPage.PageHeader.ClickThisElement();
            addApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("1");
            addApprenticeshipPage.StartDateMonthInput.EnterTextInThisElement(month);
            addApprenticeshipPage.StartDateYearInput.EnterTextInThisElement(year);
            addApprenticeshipPage.ContinueButton.ClickThisElement();

            EstimateCostsPage secondFundsStartPage = new EstimateCostsPage(WebSite.getDriver());

            secondFundsStartPage.AddApprenticeshipsButton.Click();

            addApprenticeshipPage.UseTransferAllowance.Click();
            addApprenticeshipPage.SelectApprenticeshipDropdown.SelectDropDown(WebSite.getDriver(), "Actuary, Level: 7 (Standard)");
            addApprenticeshipPage.PageHeader.ClickThisElement();
            addApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("1");
            addApprenticeshipPage.StartDateMonthInput.EnterTextInThisElement(nextMonth);
            addApprenticeshipPage.StartDateYearInput.EnterTextInThisElement(year);
            addApprenticeshipPage.ContinueButton.ClickThisElement();

            estimateCostsPage.ClickRemoveApprenticeshipButton();

            RemoveApprenticeshipPage removeApprenticeshipPage = new RemoveApprenticeshipPage(WebSite.getDriver());

            removeApprenticeshipPage.ConfirmRemoval();
        }
예제 #6
0
        public void WhenIConfirmRemoveForTheApprenticeship()
        {
            RemoveApprenticeshipPage removeApprenticeshipPage = new RemoveApprenticeshipPage(WebSite.getDriver());

            removeApprenticeshipPage.ConfirmRemoval();
        }