Esempio n. 1
0
        public void ThenIShouldBeOnACertainPage(AcademicDashboardType dashboardType, string pageName)
        {
            var page = container.ResolvePageObject(dashboardType, pageName);

            Assert.That(page.IsCurrent());
        }
Esempio n. 2
0
 public void GivenIAmOnTheSomethingPage(AcademicDashboardType academicDashboardType, string pageName)
 {
     var page = container.ResolvePageObject(academicDashboardType, pageName);
     page.Visit();
 }
Esempio n. 3
0
 public void GivenIAmOnThePageOfTheAcademicDashboard(string subPageName, AcademicDashboardType academicDashboardType)
 {
     // Perform direct navigation to the Overview page, then use links to get to sub-types
     // TODO: Reconsider location of this method (something other than PageBase?)
     PageBase.VisitAcademicDashboardSection(academicDashboardType, subPageName);
 }
Esempio n. 4
0
        /// <summary>
        /// Navigates to the specified Academic Dashboard page.
        /// </summary>
        /// <param name="academicDashboardType">The academic dashboard type (e.g. LEA, School, Student).</param>
        /// <param name="linkText">The text of the link for the desired Academic Dashboard subpage.</param>
        /// <param name="schoolType">The type of school Id to be used for navigation.</param>
        /// <param name="forceNavigation">Indicates whether to force browser navigation, even if the target page is 
        /// already the current page (useful for scenarios where we want to explicitly force the browser to make a 
        /// request from server).
        /// </param>
        public static void VisitAcademicDashboardSection(AcademicDashboardType academicDashboardType, string linkText, SchoolType schoolType = SchoolType.Unspecified, bool forceNavigation = false)
        {
            // TODO: revisit this navigation
            // TODO: consider adding page to context for use by MetricSteps?
            PageBase page = null;

            switch (academicDashboardType)
            {
                case AcademicDashboardType.LocalEducationAgency:
                    page = Container.Resolve<LEA_OverviewPage>();
                    break;
                case AcademicDashboardType.School:
                    page = Container.Resolve<School_OverviewPage>().For(schoolType);
                    break;
                //case AcademicDashboardType.Student:
                //    page = Container.Resolve<Student_OverviewPage>().For(schoolType);
                //    break;
                default:
                    throw new NotSupportedException(string.Format("Cannot yet visit the {0} academic dashboard yet.", academicDashboardType.ToString()));
            }

            // Navigate to the Overview page of the appropriate academic dashboard
            if (!page.IsCurrent() || forceNavigation)
                page.Visit(forceNavigation);

            var browser = ScenarioContext.Current.GetBrowser();
            
            // Try to find the desired link on the Academic Dashboard submenu
            if (!TryClickLink(browser, linkText, Make_It.Wait_1_Second))
            {
                // Try to click the Academic Dashboard
                if (!TryClickLink(browser, "Academic Dashboard"))
                {
                    Thread.Sleep(2000);
                    ScenarioContext.Current.GetBrowser().SaveScreenshot(string.Format("Trying to find the '{0}' link", "Academic Dashboard"));
                    throw new Exception("Unable to locate the Academic Dashboard link.");
                }

                // Try to click the target submenu again
                if (!TryClickLink(browser, linkText))
                {
                    Thread.Sleep(2000);
                    ScenarioContext.Current.GetBrowser().SaveScreenshot(string.Format("Trying to find the '{0}' link", linkText));
                    throw new Exception("Unable to locate the " + linkText + " link.");
                }
            }
        }