public void WhenIViewTheRemainingTransferAllowanceTab()
        {
            var estimateCostsPage = Get <EstimateCostsPage>();

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

                WebSite.ClickOnElement("a[href*='apprenticeship/add']");
            }

            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("2018");
            addApprenticeshipPage.ContinueButton.ClickThisElement();
            estimateCostsPage.SwitchToRemainingTransferAllowanceTab();
        }
Example #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();
        }
 public void WhenISelect(string p0)
 {
     if (p0 == "Check if I can fund these")
     {
         AddApprenticeshipsToEstimateCostPage addApprenticeshipPage =
             new AddApprenticeshipsToEstimateCostPage(WebSite.getDriver());
         addApprenticeshipPage.ContinueButton.ClickThisElement();
     }
 }
Example #4
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();
        }
        public void WhenIDoNotSelectAnApprenticeship()
        {
            AddApprenticeshipsToEstimateCostPage addApprenticeshipPage =
                new AddApprenticeshipsToEstimateCostPage(WebSite.getDriver());

            addApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("1");
            addApprenticeshipPage.StartDateMonthInput.EnterTextInThisElement("10");
            addApprenticeshipPage.StartDateYearInput.EnterTextInThisElement("2019");
            addApprenticeshipPage.TotalCostInput.Clear();
            addApprenticeshipPage.TotalCostInput.EnterTextInThisElement("£27,000");
            addApprenticeshipPage.ContinueButton.ClickThisElement();
        }
        public void WhenIDoNotEnterATotalCost()
        {
            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();
        }
Example #7
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());
        }
        public void WhenIChooseAFrameworkApprenticeship()
        {
            AddApprenticeshipsToEstimateCostPage addApprenticeshipPage =
                new AddApprenticeshipsToEstimateCostPage(WebSite.getDriver());

            addApprenticeshipPage.SelectApprenticeshipDropdown.SelectDropDown(WebSite.getDriver(), "Accounting: Accounting, Level: 4");
            addApprenticeshipPage.PageHeader.Click();
            addApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("1");
            addApprenticeshipPage.StartDateMonthInput.EnterTextInThisElement("10");
            addApprenticeshipPage.StartDateYearInput.EnterTextInThisElement("2019");
            addApprenticeshipPage.TotalCostInput.Clear();
            addApprenticeshipPage.TotalCostInput.EnterTextInThisElement("5,000");
        }
        public void WhenIEnterAStartDateBeforeTheCurrentMonth()
        {
            AddApprenticeshipsToEstimateCostPage addApprenticeshipPage =
                new AddApprenticeshipsToEstimateCostPage(WebSite.getDriver());

            addApprenticeshipPage.SelectApprenticeshipDropdown.SelectDropDown(WebSite.getDriver(), "Actuary, Level: 7 (Standard)");
            addApprenticeshipPage.PageHeader.Click();
            addApprenticeshipPage.NumberOfApprenticesInput.EnterTextInThisElement("1");
            string month = (DateTime.Now.Month - 1).ToString();
            string year  = (DateTime.Now.Year - 1).ToString();

            addApprenticeshipPage.StartDateMonthInput.EnterTextInThisElement(month);
            addApprenticeshipPage.StartDateYearInput.EnterTextInThisElement(year);
            addApprenticeshipPage.TotalCostInput.Clear();
            addApprenticeshipPage.TotalCostInput.EnterTextInThisElement("18,000");
        }
        public void ThenTheErrorIsDisplayedInLineAndAtTheTopOfThePage(string p0)
        {
            AddApprenticeshipsToEstimateCostPage addApprenticeshipPage =
                new AddApprenticeshipsToEstimateCostPage(WebSite.getDriver());

            if (p0 == "You must choose 1 apprenticeship")
            {
                Assert.IsTrue(addApprenticeshipPage.IsErrorBoxDisplayed);
                Assert.IsTrue(addApprenticeshipPage.IsYouMustChooseOneApprenticeshipErrorDisplayed);
            }

            if (p0 == "Make sure you have at least 1 or more apprentices")
            {
                Assert.IsTrue(addApprenticeshipPage.IsErrorBoxDisplayed);
                Assert.IsTrue(addApprenticeshipPage.IsMakeSureYouHaveAtLeastOneOrMoreApprenticesErrorDisplayed);
            }

            if (p0 == "The start month was not entered")
            {
                Assert.IsTrue(addApprenticeshipPage.IsErrorBoxDisplayed);
                Assert.IsTrue(addApprenticeshipPage.IsTheStartMonthWasNotEnteredErrorDisplayed);
            }

            if (p0 == "The start year was not entered")
            {
                Assert.IsTrue(addApprenticeshipPage.IsErrorBoxDisplayed);
                Assert.IsTrue(addApprenticeshipPage.IsTheStartYearWasNotEnteredErrorDisplayed);
            }

            if (p0 == "The total training cost was not entered")
            {
                Assert.IsTrue(addApprenticeshipPage.IsErrorBoxDisplayed);
                Assert.IsTrue(addApprenticeshipPage.IsYouMustEnterAnumberThatIsAboveZeroErrorDisplayed);
            }

            if (p0 == "The start date must be within the next 4 years")
            {
                Assert.IsTrue(addApprenticeshipPage.IsErrorBoxDisplayed);
                Assert.IsTrue(addApprenticeshipPage.IsTheStartDateCannotBeInThePastErrorDisplayed);
            }
        }
        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();
                }
            }
        }
Example #12
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();
        }