Ejemplo n.º 1
0
        public static void ViewModelByRating(int rank)
        {
            Hooks.Driver.Url = ConfigurationManager.AppSettings["Website"] + "overall";
            WaitPageToLoad();

            var tablePage = rank / 5 + (rank % 5 == 0 ? 0 : 1);
            var posInPage = rank % 5 + (rank % 5 == 0 ? 5 : 0);

            var page = new MakerPage(Hooks.Driver, true);

            page.GoToPage(tablePage.ToString());

            var watch = Stopwatch.StartNew();

            try
            {
                while (watch.Elapsed < TimeSpan.FromSeconds(5))
                {
                    if (page.CarTable[posInPage].Rank == rank.ToString())
                    {
                        break;
                    }
                }
            }
            catch (StaleElementReferenceException)
            { }
            if (page.CarTable[posInPage].Rank != rank.ToString())
            {
                throw new ApplicationException($"Model in Rank #{rank} was not found");
            }

            page.CarTable[posInPage].Image.Click();
            WaitPageToLoad();
        }
Ejemplo n.º 2
0
        public void WhenTheMid_PageNumberIsEntered(string method)
        {
            if (page.TotalPages % 2 != 0)
            {
                listPage = (int)Math.Ceiling(page.TotalPages / 2d);
            }
            else
            {
                switch (method)
                {
                case "(round up)":
                    listPage = page.TotalPages / 2 + 1; break;

                case "(round down)":
                    listPage = page.TotalPages / 2; break;

                default:
                    throw new InvalidOperationException($"Invalid method called by SpecFlow step: {method}");
                }
            }
            page.GoToPage(listPage.ToString());
        }
Ejemplo n.º 3
0
        public void WhenTheMidPageIsReachedViaTextbox()
        {
#pragma warning disable CS0618 // Type or member is obsolete
            var scenario = ScenarioContext.Current.ScenarioInfo.Title;
#pragma warning restore CS0618 // Type or member is obsolete

            if (page.TotalPages % 2 != 0)
            {
                tablePage = (int)Math.Ceiling(page.TotalPages / 2d);
            }
            else
            {
                switch (scenario)
                {
                case string x when x.Contains("Backward"):
                    tablePage = page.TotalPages / 2 + 1; break;

                case string x when x.Contains("Forward"):
                    tablePage = page.TotalPages / 2; break;
                }
            }

            page.GoToPage(tablePage.ToString());
        }