Ejemplo n.º 1
0
        public void ThenTheBannerMessageIsDisplayed(string p0)
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());

            Assert.IsTrue(estimateCostsPage.IsRemovedApprenticeshipBannerDisplayed);
            Assert.AreEqual(estimateCostsPage.RemovedApprenticeshipBannerText, "Apprenticeship removed");
        }
Ejemplo n.º 2
0
        public void WhenIHaveCurrentModelledApprenticeships()
        {
            if (WebSite.CurrentUrl.Contains("forecasting/estimations/start"))
            {
                EstimateFundsStartPage fundsStartPage1 = new EstimateFundsStartPage(WebSite.getDriver());
                fundsStartPage1.ClickStartForAccountWithApprenticeships();
            }
            if (!WebSite.CurrentUrl.Contains("apprenticeship/add"))
            {
                EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());
                var isAnyapprenticeshipExist        = estimateCostsPage.IsApprenticeshipsTableVisible();
                while (isAnyapprenticeshipExist)
                {
                    estimateCostsPage.RemoveFirstApprenticeship();
                    isAnyapprenticeshipExist = estimateCostsPage.IsApprenticeshipsTableVisible();
                }
            }
            if (!WebSite.CurrentUrl.Contains("apprenticeship/add"))
            {
                EstimateFundsStartPage fundsStartPage = new EstimateFundsStartPage(WebSite.getDriver());
                fundsStartPage.ClickStartForAccountWithApprenticeships();
            }
            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("10");
            addApprenticeshipPage.StartDateYearInput.EnterTextInThisElement("2019");
            addApprenticeshipPage.ContinueButton.ClickThisElement();
        }
Ejemplo n.º 3
0
        public void ThenTheCompletionCostsOfTheRemovedApprenticeshipsHaveBeenRemovedFromTheCorrectMonth()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());

            EstimateCostsPage.RemainingTransferAllowanceRow[] remainingTransferAllowanceRows = estimateCostsPage.GetRemainingTransferAllowanceTableContent();
            Assert.IsTrue(remainingTransferAllowanceRows[0].CostOfEstimatedApprenticeships.Equals("£0"));
        }
        public void WhenTheModelledApprenticeshipsPageIsDisplayed()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());

            Set(estimateCostsPage);
            Assert.IsTrue(estimateCostsPage.PageHeader.Displayed);
        }
        public void ThenTheApprenticeshipIsAdded()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());
            List <EstimateCostsPage.ApprenticeshipsTableRow> apprenticeshipsTable =
                estimateCostsPage.GetApprenticeshipsTableContent();

            Assert.IsNotEmpty(apprenticeshipsTable);
        }
Ejemplo n.º 6
0
 public void ThenTheErrorMessageIsNotDisplayed(string p0)
 {
     if (p0 == "The total cost cant be higher than the government funding cap for this apprenticeship")
     {
         EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());
         Assert.IsTrue(estimateCostsPage.IsPageLoaded);
     }
 }
Ejemplo n.º 7
0
        public void ThenTheApprenticeshipHasBeenUpdatedCorrectly()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());
            List <EstimateCostsPage.ApprenticeshipsTableRow> apprenticeshipsTable =
                estimateCostsPage.GetApprenticeshipsTableContent();

            Assert.IsTrue(apprenticeshipsTable[0].NumberOfApprentices.Equals("2"));
        }
Ejemplo n.º 8
0
        public void ThenByClickingTheStartButtonIAmTakenToTheEstimatedCostsPage()
        {
            WebSite.NavigateToEstimateFundsStartPage();
            EstimateCostsPage estimatedCostsPage =
                new EstimateCostsPage(WebSite.getDriver());

            Set(estimatedCostsPage);
        }
Ejemplo n.º 9
0
        public void ThenTheDetailsHaveNotBeenUpdated()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());
            List <EstimateCostsPage.ApprenticeshipsTableRow> apprenticeshipsTable =
                estimateCostsPage.GetApprenticeshipsTableContent();

            Assert.IsFalse(apprenticeshipsTable[0].NumberOfApprentices.Equals("2"));
        }
Ejemplo n.º 10
0
 public void WhenTheTab(string p0)
 {
     if (p0 == "Remaining transfer allowance")
     {
         EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());
         estimateCostsPage.SwitchToRemainingTransferAllowanceTab();
     }
 }
Ejemplo n.º 11
0
 public void ThenThePageIsDisplayed(string p0)
 {
     if (p0 == "Estimated cost - Apprenticeships added")
     {
         EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());
         Assert.IsTrue(estimateCostsPage.IsPageLoaded);
     }
 }
Ejemplo n.º 12
0
        public void GivenThatIMOnTheEditApprenticeshipsPage()
        {
            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();
            }

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

            addApprenticeshipPage.SelectApprenticeshipDropdown.SelectDropDown(WebSite.getDriver(), "Actuary, Level: 7 (Standard)");
            addApprenticeshipPage.PageHeader.Click();
            addApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("1");
            addApprenticeshipPage.StartDateMonthInput.EnterTextInThisElement("10");
            addApprenticeshipPage.StartDateYearInput.EnterTextInThisElement("2019");
            addApprenticeshipPage.TotalCostInput.Clear();
            addApprenticeshipPage.TotalCostInput.EnterTextInThisElement("18,000");
            addApprenticeshipPage.ContinueButton.ClickThisElement();

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

            secondEstimateCostsPage.EditApprenticeships();
        }
Ejemplo n.º 13
0
        public void ThenByClickingTheStartButtonIAmTakenToTheAddApprenticeshipPage()
        {
            if (!WebSite.CurrentUrl.Contains("forecasting/estimations/default/apprenticeship/add"))
            {
                EstimateCostsPage page =
                    new EstimateCostsPage(WebSite.getDriver());
                page.AddApprenticeshipsButton.Click();
            }
            AddApprenticeshipsToEstimateCostPage addApprenticeshipPage =
                new AddApprenticeshipsToEstimateCostPage(WebSite.getDriver());

            Assert.IsTrue(addApprenticeshipPage.IsPageVisible());
        }
Ejemplo n.º 14
0
        public void WhenIHaveNoCurrentModelledApprenticeships()
        {
            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();
                }
            }
        }
        public void GivenThatIMOnTheAddApprenticeshipPage()
        {
            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();
            }
        }
        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();
                }
            }
        }
Ejemplo n.º 17
0
        public void ThenTheRemovedApprenticeshipIsNotInTheList()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());

            Assert.IsFalse(estimateCostsPage.IsApprenticeshipsTableVisible());
        }
Ejemplo n.º 18
0
        public void WhenISelectEdit()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());

            estimateCostsPage.EditApprenticeships();
        }
Ejemplo n.º 19
0
        public void WhenISelectRemoveForOneApprenticeship()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());

            estimateCostsPage.ClickRemoveApprenticeshipButton();
        }
Ejemplo n.º 20
0
        public void ThenTheEstimatedCostsIsDisplayed()
        {
            EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());

            Assert.IsTrue(estimateCostsPage.IsPageLoaded);
        }
Ejemplo n.º 21
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();
        }
Ejemplo n.º 22
0
 public void WhenImOnTheEstimatedCostsPage()
 {
     EstimateCostsPage estimateCostsPage = new EstimateCostsPage(WebSite.getDriver());
 }