/// <summary>
        /// Delete the test. Clicking this link and Accepting the Alert can take you to different pages based on the Workflow.
        /// </summary>
        public void DeleteTest()
        {
            CurrentWindow = Driver.CurrentWindowHandle;
            Report.Write("The current window is: '" + CurrentWindow + "'.");

            DeleteTestLink.Wait(2).Click();
            AlertHandler alert = new AlertHandler();

            alert.VerifyText("Are you sure you want to delete this test?");
            alert.VerifyText("This cannot be undone.");
            alert.Accept();

            /*
             * IAlert alert = Driver.SwitchTo().Alert();
             * string expected1 = "Are you sure you want to delete this test?";
             * string expected2 = "This cannot be undone.";
             * if (Driver.GetType() == typeof (DummyDriver))
             * {
             *  ((DummyIAlert)alert).Text = expected1 + " " + expected2;
             * }
             * string actual = alert.Text;
             * Debug.WriteLine("The alert text: '" + actual + "'.");
             * Assert.IsTrue(actual.Contains(expected1), "The delete confirmation pop-up does not contain the expected text: '" + expected1 + "'; actual text: '" + actual + "'.");
             * Assert.IsTrue(actual.Contains(expected2), "The delete confirmation pop-up does not contain the expected text: '" + expected2 + "'; actual text: '" + actual + "'.");
             * alert.Accept();
             */

            //switch to window
            DriverCommands.WaitToSwitchWindow(CurrentWindow, 5);
        }
        private void VerifyPageIsActuallyLoad()
        {
            // tc 24186, bug 87479
            // Sometimes network is slow and gateway return a blank page. This page will need to be refresh
            try
            {
                Report.Write("Attempting to verified page content is actually loaded. Checking if site title exist.");
                //SiteTitleLabel = new WebElementWrapper(Driver, BySiteTitleLabel);
                //SiteTitleLabel.FindElement();
                //Make sure page is actually loaded by clicking on welcome message
                this.Utilities.FocusOnMainContentArea();//Header.SelectWelcomeMessage();
                Report.Write("Page content is loaded successfully. Got Site title.");
            }
            catch (Exception e)
            {
                if (Driver.WrappedDriver.GetType() == typeof(FirefoxDriver))
                {
                    this.CurrentWindowHandle = Driver.CurrentWindowHandle;

                    Report.Write("Page content was not loaded. Attempting to refresh the page again.");
                    Driver.Navigate().Refresh();

                    AlertHandler alert = new AlertHandler();
                    alert.VerifyText("Are you sure you wish to delete this item?");
                    alert.Accept();

                    //switch to window
                    DriverCommands.WaitToSwitchWindow(this.CurrentWindowHandle, 5);
                }//exception was not being thrown for other browsers
                else
                {
                    throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
                }
            }
        }
        /// <summary>
        /// delete
        /// </summary>
        public void SelectDelete()
        {
            string currentWindow = Driver.CurrentWindowHandle;

            Report.Write("The current window is: '" + currentWindow + "'.");
            DeleteLink.Click();

            AlertHandler alert = new AlertHandler();

            alert.VerifyText("Are you sure you want to delete this rubric? All associations to this rubric will be permanently deleted.");
            alert.Accept();

            //switch to window
            DriverCommands.WaitToSwitchWindow(currentWindow, 5);
        }
        /// <summary>
        /// ready to schedule the test
        /// </summary>
        /// <returns>ViewTestDetailsPage</returns>
        public ViewTestDetailsPage ReadyToSchedule()
        {
            this.CurrentWindowHandle = Driver.CurrentWindowHandle;
            Report.Write("The current window is: '" + this.CurrentWindowHandle + "'.");

            TestStages.ReadyToSchedule();
            //Driver.AcceptAlert();

            AlertHandler alert = new AlertHandler();

            alert.VerifyText("Are you sure you are ready to schedule the test?");
            alert.VerifyText("You will no longer be able to make changes to the test.");
            alert.VerifyText("Do you want to proceed?");
            alert.Accept();

            //switch to window
            DriverCommands.WaitToSwitchWindow(this.CurrentWindowHandle, 5);

            DriverCommands.WaitAndMeasurePageLoadTime();
            //return new ViewTestDetailsPage( TestStage.ReadyToSchedule);
            Data.TestStage = TestStage.ReadyToSchedule;
            ReloadThePage();
            return(this);
        }
Пример #5
0
        /// <summary>
        /// Delete the item and Accept the Alert.
        /// </summary>
        public void DeleteItem()
        {
            this.Parent.CurrentWindowHandle = Driver.CurrentWindowHandle;
            Report.Write("The current window is: '" + this.Parent.CurrentWindowHandle + "'.");

            DeleteItemButton.Wait(3).Click();

            AlertHandler alert = new AlertHandler();

            alert.VerifyText("Are you sure you wish to delete this item?");
            alert.Accept();

            //switch to window
            DriverCommands.WaitToSwitchWindow(this.Parent.CurrentWindowHandle, 5);
        }
        /// <summary>
        /// Delete the item and Accept the Alert.
        /// </summary>
        public void DeleteItem()
        {
            this.Parent.CurrentWindowHandle = Driver.CurrentWindowHandle;
            Report.Write("The current window is: '" + this.Parent.CurrentWindowHandle + "'.");

            Utilities.FocusOnMainContentArea(); //stop hover over menu
            Delete_Link.Wait(3).Click();

            AlertHandler alert = new AlertHandler();

            alert.VerifyText("Are you sure you wish to delete this item?");
            alert.Accept();

            //switch to window
            DriverCommands.WaitToSwitchWindow(this.Parent.CurrentWindowHandle, 5);
        }
        /// <summary>
        /// select assign to individual students
        /// </summary>
        public void SelectAssignToIndividualStudents()
        {
            AssignToIndividualStudentsRadio.Wait(3);
            AssignToIndividualStudentsRadio.Selected = true;
            if (AssignToIndividualStudentsRadio.Selected == false)
            {
                this.Parent.CurrentWindowHandle = Driver.CurrentWindowHandle;
                Report.Write("The current window is: '" + this.Parent.CurrentWindowHandle + "'.");

                AssignToIndividualStudentsRadio.Wait(3).Click();

                AlertHandler alert = new AlertHandler();
                alert.VerifyText("You will lose your selection if you change to a different assignment method?");
                alert.Accept();

                //switch to window
                DriverCommands.WaitToSwitchWindow(this.Parent.CurrentWindowHandle, 5);

                DriverCommands.WaitAndMeasurePageLoadTime();
                this.Parent.InitElements();
                Grid = new EditTeacherAssignmentGrid(assignToIndividualStudentsGrid, true, ControlPrefix);
            }
        }