//implemented methods
 public override void InputFormFields()
 {
     StandardPickerForm.InputAndSubmitForm();
     DriverCommands.WaitAndMeasurePageLoadTime(90, 30);
     InitElements();
     //TODO: implement
 }
        //public void ClickDeleteLink()
        //{
        //    Delete_Link.Click();
        //}

        /// <summary>
        /// delete the Passage
        /// </summary>
        public void ClickDeleteLink(bool isItemLinked)
        {
            this.Parent.CurrentWindowHandle = Driver.CurrentWindowHandle;
            Report.Write("The current window is: '" + this.Parent.CurrentWindowHandle + "'.");

            Delete_Link.Wait(2).Click();
            IAlert alert     = Driver.SwitchTo().Alert();
            string expected1 = "Are you sure you wish to delete this passage?";
            string expected2 = "Warning: All 1 Items linked to passage will be deleted.";

            string actual = alert.Text;

            Report.Write("The alert text: '" + actual + "'.");

            if (isItemLinked)
            {
                Assert.IsTrue(actual.Contains(expected2), "The delete confirmation pop-up does not contain the expected text: '" + expected1 + "'; actual text: '" + actual + "'.");
            }
            else
            {
                Assert.IsTrue(actual.Contains(expected1), "The delete confirmation pop-up does not contain the expected text: '" + expected1 + "'; actual text: '" + actual + "'.");
            }
            alert.Accept();
            //switch to window
            DriverCommands.WaitToSwitchWindow(this.Parent.CurrentWindowHandle, 5);
            //wait for page to load after delete
            DriverCommands.WaitAndMeasurePageLoadTime();
        }
        public Program(AppLaunchingCommandLine commandLine)
        {
            _commandLine = commandLine;
            StartEmuAutomationController();

            var driverCommands = new DriverCommands()
                                     {
                                         Driver = _emuAutomationController.Driver,
                                         CommandLine = _commandLine
                                     };
            AddCommands(driverCommands);

            var inputCommands = new DisplayInputCommands()
                                    {
                                        DisplayInputController = _emuAutomationController.DisplayInputController
                                    };
            AddCommands(inputCommands);

            var phoneAutomationCommands = new PhoneAutomationCommands()
                                              {
                                                  PhoneAutomationController =
                                                      _emuAutomationController.PhoneAutomationController
                                              };
            AddCommands(phoneAutomationCommands);
        }
        /// <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);
                }
            }
        }
 //implemented methods
 public override void InputFormFields()
 {
     SelectShareWithOthers();
     DriverCommands.WaitAndMeasurePageLoadTime(90, 30);
     InitElements();
     SelectEveryone();
 }
 /// <summary>
 /// Clicks on the Basic Search Link
 /// </summary>
 public void SelectBaiscSearch()
 {
     BasicSearchLink.Click();
     isAdvancedSearchExpanded = false;
     DriverCommands.WaitAndMeasurePageLoadTime(60, 30);
     InitElements();
     //Do we need to refresh the data object as well here?
 }
 /// <summary>
 /// select classroom tests tab
 /// </summary>
 public void SelectClassroomTestsTab()
 {
     this.Utilities.FocusOnMainContentArea();//this.Parent.Header.SelectWelcomeMessage(); //stop hover over menu
     ClassroomTestsLink.Wait(3).Click();
     DriverCommands.WaitAndMeasurePageLoadTime();
     ((TeacherProfileHomePage)Parent).TabName = ProfileHomeTabNames.ClassroomTests;
     ((TeacherProfileHomePage)Parent).InitElements();
 }
Beispiel #9
0
        /// <summary>
        /// Close online help window and switch back to parent window
        /// </summary>
        public void Close()
        {
            Report.Write("Closing online test help window");
            Driver.Close();

            Report.Write("Switch back to parent window");
            IReadOnlyCollection <string> WindowHandles = Driver.WindowHandles;

            DriverCommands.WaitToSwitchWindow(WindowHandles.FirstOrDefault(), 90.0);
        }
Beispiel #10
0
 private void WaitForFrameToDisplay()
 {
     //_currentWindow = Driver.CurrentWindowHandle;
     this.CurrentWindowHandle = Driver.CurrentWindowHandle;
     Report.Write("The current window is: '" + this.CurrentWindowHandle + "'.");
     LightBox.WaitUntilExists(3);
     IFrame.WaitUntilExists(3);
     //Driver.SwitchTo().Frame(IFrame.Element);
     DriverCommands.WaitToSwitchFrame(IFrame, 3);
 }
Beispiel #11
0
 public override void SubmitFormAndVerifyErrors()
 {
     base.SubmitFormAndVerifyErrors();
     DriverCommands.WaitAndMeasurePageLoadTime(90, 30);
     InitElements();
     ItemPropertiesForm.Data = Data.ItemTypeData;
     //the standard popup should not be displayed here, so skip setting the data
     //StandardPickerForm.DataObject = Data.StandardPickerData;
     //StandardPopupDialog.DataObject = Data.StandardPickerData;
     ItemTypeForm.Data = Data.ItemTypeData;
 }
Beispiel #12
0
        /// <summary>
        /// Accept the quick assignment
        /// </summary>
        public void Accept_Quick_Assignment()
        {
            AcceptQuickAssignmentLink.Wait(3).Click();

            DriverCommands.WaitAndMeasurePageLoadTime();
            InitElements();

            //Wait for page to reload
            //Wait until the View Assignment Summary link is visible
            ViewAssignmentSummaryLink.WaitUntilVisible(120);
        }
Beispiel #13
0
 /// <summary>
 /// select the grade level
 /// </summary>
 public void SelectGradeLevel()
 {
     WaitForFrameToDisplay();
     WaitForMainTableToDisplay();
     GradeLevel.Wait(5).SelectByText(Data.GradeLevel);
     DriverCommands.WaitAndMeasurePageLoadTime(90, 30);
     InitElements();
     WaitForFrameToDisplay();
     WaitForMainTableToDisplay();
     SetSelectedStandardsGroupList();
 }
 /// <summary>
 /// make the test public
 /// </summary>
 /// <returns>ViewTestDetailsPage</returns>
 public ViewTestDetailsPage MakePublic()
 {
     TestStages.MakePublic();
     //wait a second for the event to catch up
     // (getting stale element reference on page reload - after waiting for page to load)
     Thread.Sleep(TimeSpan.FromSeconds(1));
     DriverCommands.WaitAndMeasurePageLoadTime(90, 30);
     //return new ViewTestDetailsPage(Driver, TestStage.PublicDraft);
     Data.TestStage = TestStage.PublicDraft;
     ReloadThePage();
     return(this);
 }
 public void ClickLastPage()
 {
     if (PaginationLinkCount == 4)
     {
         if (IsLastPageEnabled)
         {
             LastTopLink.Wait(3).Click();
             DriverCommands.WaitAndMeasurePageLoadTime(60, 30);
             InitElements();
         }
     }
 }
Beispiel #16
0
 public virtual IBaseScreenView SubmitForm()
 {
     try
     {
         Submit.Click();
         DriverCommands.WaitAndMeasurePageLoadTime();
     }
     catch (Exception e)
     {
         //
     }
     return(ReturnSubmitPage());
 }
Beispiel #17
0
        /// <summary>
        /// select Online Test Help
        /// </summary>
        /// <returns>SchoolnetOnlineHelpPage</returns>
        public SchoolnetOnlineHelpPage SelectOnlineTestHelp()
        {
            OnlineTestHelpButton.Wait(3).Click();
            //pause the script for a second to let the pop-up display
            System.Threading.Thread.Sleep(1000);

            /*
             * https://team-automation-st.sndev.net/onlinetest/tutorial.html
             */
            string windowName = "SchoolNetHelp";

            DriverCommands.WaitToSwitchWindow(windowName, 30);
            return(new SchoolnetOnlineHelpPage(windowName));
        }
Beispiel #18
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
        /// </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>
        /// 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);
        }
Beispiel #21
0
 private void WaitForFrameToDisplay()
 {
     if ((this.PageNames == PageNames.TestItemStandardPopup) ||
         (this.PageNames == PageNames.CreateNewItem) ||
         (this.PageNames == PageNames.EditTestItem) ||
         (this.PageNames == PageNames.EditTask) ||
         (this.PageNames == PageNames.EditQuestion) ||
         (this.PageNames == PageNames.EditRubric))
     {
         //switch to window
         DriverCommands.WaitToSwitchWindow(_currentWindow, 5);
         LightBox.WaitUntilExists(3);
         IFrame.WaitUntilExists(3);
         //Driver.SwitchTo().Frame(IFrame.Element);
         DriverCommands.WaitToSwitchFrame(IFrame, 3);
     }
 }
Beispiel #22
0
        public override IBaseScreenView SubmitForm()
        {
            Submit.Wait(5).Click();
            if ((this.PageNames == PageNames.TestItemStandardPopup) ||
                (this.PageNames == PageNames.CreateNewItem) ||
                (this.PageNames == PageNames.EditTestItem) ||
                (this.PageNames == PageNames.EditTask) ||
                (this.PageNames == PageNames.EditQuestion) ||
                (this.PageNames == PageNames.EditRubric))
            {
                //switch to window
                DriverCommands.WaitToSwitchWindow(_currentWindow, 5);
            }
            //pause the script for a few seconds to let the page settle down
            System.Threading.Thread.Sleep(5000);

            //workaround for "*No standard(s) selected" after trying to select a standard
            try
            {
                if (NoStandardSelectedLabel.Wait(5).Displayed)
                {
                    SelectFirstStandardTreeInGroup();
                    Submit.Wait(5).Click();
                    if ((this.PageNames == PageNames.TestItemStandardPopup) ||
                        (this.PageNames == PageNames.CreateNewItem) ||
                        (this.PageNames == PageNames.EditTestItem) ||
                        (this.PageNames == PageNames.EditTask) ||
                        (this.PageNames == PageNames.EditQuestion) ||
                        (this.PageNames == PageNames.EditRubric))
                    {
                        //switch to window
                        DriverCommands.WaitToSwitchWindow(_currentWindow, 5);
                    }
                    //pause the script for a few seconds to let the page settle down
                    System.Threading.Thread.Sleep(5000);
                }
            }
            catch (Exception e)
            {
                //do nothing
            }

            return(ReturnSubmitPage());
        }
Beispiel #23
0
        /// <summary>
        /// select Online Test Help
        /// </summary>
        /// <returns>SchoolnetOnlineHelpPage</returns>
        public SchoolnetOnlineHelpPage SelectOnlineTestHelp()
        {
            OnlineTestHelpButton.Wait(3).Click();
            //pause the script for a second to let the pop-up display
            System.Threading.Thread.Sleep(1000);

            /*
             * https://team-automation-st.sndev.net/OnlineTest/onlinetest.js
             * function openTutorial() calls openHelpWindow()
             * https://team-automation-st.sndev.net/OnlineTest/onlinetest.SNInclude.js
             * var openHelpWindow = my.openHelpWindow = function
             * var title = 'SchoolNetHelp'
             * snHelpTopicWindow = window.open(url, title,
             */
            string windowName = "SchoolNetHelp";

            DriverCommands.WaitToSwitchWindow(windowName, 30);
            return(new SchoolnetOnlineHelpPage(windowName));
        }
 public void ClickPreviousPage()
 {
     if (PaginationLinkCount == 2)
     {
         if (IsFirstPageEnabled)
         {
             FirstTopLink.Wait(3).Click();
             DriverCommands.WaitAndMeasurePageLoadTime(60, 30);
             InitElements();
         }
     }
     if (PaginationLinkCount == 4)
     {
         if (IsPreviousPageEnabled)
         {
             PreviousTopLink.Wait(3).Click();
             DriverCommands.WaitAndMeasurePageLoadTime(60, 30);
             InitElements();
         }
     }
 }
Beispiel #25
0
        /// <summary>
        /// click the delete link
        /// </summary>
        public void SelectDelete()
        {
            CurrentWindow = Driver.CurrentWindowHandle;
            Report.Write("The current window is: '" + CurrentWindow + "'.");

            DeleteLink.Wait(5).Click();
            IAlert alert    = Driver.SwitchTo().Alert();
            string expected = "Are you sure you want to delete this rubric?";

            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                ((DummyIAlert)alert).Text = expected;
            }
            string actual = alert.Text;

            Report.Write("The alert text: '" + actual + "'.");
            Assert.IsTrue(actual.Contains(expected), "The delete confirmation pop-up does not contain the expected text: '" + expected + "'; actual text: '" + actual + "'.");
            alert.Accept();

            //switch to window
            DriverCommands.WaitToSwitchWindow(CurrentWindow, 5);
            DriverCommands.WaitAndMeasurePageLoadTime(90, 30);
        }
        /// <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);
            }
        }
Beispiel #27
0
 //implement methods
 public override void InputFormFields()
 {
     if (Data.FirstName != null)
     {
         FirstName_textbox.Wait(5).Clear();
         FirstName_textbox.SendKeys(Data.FirstName);
     }
     if (Data.LastName != null)
     {
         LastName_textbox.Wait(5).Clear();
         LastName_textbox.SendKeys(Data.LastName);
     }
     if (Data.Username != null)
     {
         Username_textbox.Wait(5).Clear();
         Username_textbox.SendKeys(Data.Username);
     }
     if (Data.Institution != null)
     {
         Institution_dropdown.Wait(5).SelectByText(Data.Institution);
         DriverCommands.WaitAndMeasurePageLoadTime();
         InitElements();
     }
     if (Data.IncludeChildInistutitons != null)
     {
         if (Data.IncludeChildInistutitons.Equals("1"))
         {
             CheckBoxClick(IncludeChildInstitutions_chkbox, true);
         }
     }
     if (Data.Role != null)
     {
         Role_dropdown.Wait(5).SelectByText(Data.Role);
         DriverCommands.WaitAndMeasurePageLoadTime();
         InitElements();
     }
 }
        /// <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);
        }
        /// <summary>
        /// delete item
        /// </summary>
        public void DeleteItem()
        {
            ((SNWebPage)this.Parent).CurrentWindowHandle = Driver.CurrentWindowHandle;
            Report.Write("The current window is: '" + ((SNWebPage)this.Parent).CurrentWindowHandle + "'.");

            DeleteActivityButton.Wait(5).Click();
            IAlert alert    = Driver.SwitchTo().Alert();
            string expected = "Are you sure you wish to delete this item?";

            if (Driver.GetType() == typeof(DummyDriver))
            {
                ((DummyIAlert)alert).Text = expected;
            }
            string actual = alert.Text;

            Report.Write("The alert text: '" + actual + "'.");
            Assert.IsTrue(actual.Contains(expected), "The delete confirmation pop-up does not contain the expected text: '" + expected + "'; actual text: '" + actual + "'.");
            alert.Accept();

            //switch to window
            DriverCommands.WaitToSwitchWindow(((SNWebPage)this.Parent).CurrentWindowHandle, 5);
            DriverCommands.WaitAndMeasurePageLoadTime();
            ((EditQuestionCreateNewItemPage)Parent).SetRibbonBarItems();
        }
 public void SelectResultsPerPage(string resultsPerPage)
 {
     ResultsPerPageSelect.Wait(3).SelectByText(resultsPerPage);
     DriverCommands.WaitAndMeasurePageLoadTime(60, 30);
     InitElements();
 }
 /// <summary>
 /// select actions, then select edit
 /// </summary>
 public void SelectEdit()
 {
     SelectActions();
     EditLink.Wait(3).Click();
     DriverCommands.WaitAndMeasurePageLoadTime(90, 30);
 }