Example #1
0
        public void ThenOnLaunchingPreTestAndPostTestPastDueMessageShouldDisplayForPastDueStudyPlanAndSubmitPretestAndPost()
        {
            try
            {
                string sp = DatabaseTools.GetActivityName(Enumerations.ActivityType.StudyPlan);
                _studTodoDonePage.OpenStudyPlan(sp);
                GenericHelper.WaitUtilWindow("Open Study Plan");
                GenericHelper.SelectWindow("Open Study Plan");
                _drtDefaultUxPage.ClickBegin();
                GenericHelper.WaitUtilWindow("Pre Test");
                GenericHelper.SelectWindow("Pre Test");
                if (_studentPresentationPage.VerifyPastDueMsg())
                {
                    GenericHelper.Logs("on launching pretest Past due message displayed ", "PASSED");
                }
                else
                {
                    GenericHelper.Logs("on launching pretest Past due message not displayed", "PASSED");
                    throw new Exception("on launching pretest Past due message not displayed");
                }
                _studentPresentationPage.AnswerTrue();
                _studentPresentationPage.SubmitActivity();
                WebDriver.Close();
                GenericHelper.SelectWindow("Open Study Plan");
                WebDriver.Navigate().Refresh();
                Thread.Sleep(4000);
                GenericHelper.WaitUtilWindow("Open Study Plan");
                GenericHelper.SelectWindow("Open Study Plan");

                _drtDefaultUxPage.ClickBeginForPostTest();
                GenericHelper.WaitUtilWindow("Post Test");
                GenericHelper.SelectWindow("Post Test");
                if (_studentPresentationPage.VerifyPastDueMsg())
                {
                    GenericHelper.Logs("on launching posttest Past due message displayed ", "PASSED");
                }
                else
                {
                    GenericHelper.Logs("on launching posttest Past due message not displayed", "PASSED");
                    throw new Exception("on launching posttest Past due message not displayed");
                }
                _studentPresentationPage.AnswerTrue();
                _studentPresentationPage.SubmitActivity();
                WebDriver.Close();
                GenericHelper.WaitUtilWindow("Open Study Plan");
                GenericHelper.SelectWindow("Open Study Plan");
                _drtDefaultUxPage.BackToPreviousFolder();
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "FAILED");
                Assert.Fail(e.ToString());
            }
        }
        public void GivenStudentHasAlreadySubmittedTheStudyPlansIfNotThenSubmitTheStudyPlans()
        {
            try
            {
                bool SubmissionStatus1 = true;
                bool SubmissionStatus2 = true;
                bool SubmissionStatus3 = true;

                bool SubmissionStatus = true;

                string isSpAlreadySubmitted1 = DatabaseTools.GetSubmissionStatusOfActivity(Enumerations.ActivityType.SpWith1Rem);
                if (isSpAlreadySubmitted1 == null || isSpAlreadySubmitted1.Equals("False") || isSpAlreadySubmitted1.Equals(""))
                {
                    SubmissionStatus1 = false;
                }
                string isSpAlreadySubmitted2 = DatabaseTools.GetSubmissionStatusOfActivity(Enumerations.ActivityType.Sp1With3Rem);
                if (isSpAlreadySubmitted2 == null || isSpAlreadySubmitted2.Equals("False") || isSpAlreadySubmitted2.Equals(""))
                {
                    SubmissionStatus2 = false;
                }
                string isSpAlreadySubmitted3 = DatabaseTools.GetSubmissionStatusOfActivity(Enumerations.ActivityType.Sp2With3Rem);
                if (isSpAlreadySubmitted3 == null || isSpAlreadySubmitted3.Equals("False") || isSpAlreadySubmitted3.Equals(""))
                {
                    SubmissionStatus3 = false;
                }

                SubmissionStatus = SubmissionStatus1 && SubmissionStatus2;

                if ((SubmissionStatus && SubmissionStatus3) == false)
                {
                    string isSpAlreadySubmitted = DatabaseTools.GetSubmissionStatusOfActivity(Enumerations.ActivityType.SpWith1Rem);
                    if (isSpAlreadySubmitted == null || isSpAlreadySubmitted.Equals("False") || isSpAlreadySubmitted.Equals(""))
                    {
                        string _SpName = DatabaseTools.GetActivityName(Enumerations.ActivityType.SpWith1Rem);

                        GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsStudent");
                        GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSStudent();
                        GenericTestStep.StepToCloseStudentHelpTextWindow();
                        GenericTestStep.StepToIAmOnThePage("Global Home");
                        GenericTestStep.StepToSelectTheCreatedCourse(_courseName);
                        GenericTestStep.StepToItShouldBeOnPage("Today's View");
                        GenericTestStep.StepToNavigateToTheTab("Course Materials");

                        if (_SpName != null)
                        {
                            _coursePreviewMainUxPage.OpenAsset(_SpName);
                        }
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        _drtDefaultUxPage.ClickBegin();
                        _showMessagePage.ClickContinue();
                        GenericHelper.SelectWindow("Pre Test");
                        _studentPresentationPage.AnswerFalse();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);

                        // studymaterial presentation
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        GenericHelper.SelectWindow("Open Study Plan");
                        _drtStudentUxPage.SelectAllAvailableStudyMaterial();
                        _drtStudentUxPage.SelectFrame();
                        _drtStudentUxPage.OpenFirstStudyMaterial();
                        Thread.Sleep(2000);
                        GenericHelper.SelectWindow("Web Activity");
                        _studentPresentationPage.AnswerTrue();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        // WebDriver.Navigate().Refresh();
                        //Thread.Sleep(4000);
                        _drtDefaultUxPage.ClickReturnToCourse();
                        Thread.Sleep(4000);
                        DatabaseTools.UpdateSubmissionStatusOfActivity(_SpName);
                    }

                    string isSp2AlreadySubmitted = DatabaseTools.GetSubmissionStatusOfActivity(Enumerations.ActivityType.Sp1With3Rem);
                    if (isSp2AlreadySubmitted == null || isSp2AlreadySubmitted.Equals("False") || isSp2AlreadySubmitted.Equals(""))
                    {
                        string _SpName = DatabaseTools.GetActivityName(Enumerations.ActivityType.Sp1With3Rem);

                        GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsStudent");
                        GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSStudent();
                        GenericTestStep.StepToCloseStudentHelpTextWindow();
                        GenericTestStep.StepToIAmOnThePage("Global Home");
                        GenericTestStep.StepToSelectTheCreatedCourse(_courseName);
                        GenericTestStep.StepToItShouldBeOnPage("Today's View");
                        GenericTestStep.StepToNavigateToTheTab("Course Materials");

                        if (_SpName != null)
                        {
                            _coursePreviewMainUxPage.OpenAsset(_SpName);
                        }
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        _drtDefaultUxPage.ClickBegin();
                        _showMessagePage.ClickContinue();
                        GenericHelper.SelectWindow("Pre Test");
                        _studentPresentationPage.AnswerFalse();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);


                        // studymaterial presentation
                        // first studymaterial
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        GenericHelper.SelectWindow("Open Study Plan");
                        _drtStudentUxPage.SelectAllAvailableStudyMaterial();
                        _drtStudentUxPage.SelectFrame();
                        _drtStudentUxPage.OpenFirstStudyMaterial();
                        Thread.Sleep(2000);
                        GenericHelper.SelectWindow("Web Activity");
                        _studentPresentationPage.AnswerFalse();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);

                        // Second studymaterial
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        GenericHelper.SelectWindow("Open Study Plan");
                        _drtStudentUxPage.SelectFrame();
                        _drtStudentUxPage.OpenSecondStudyMaterial();
                        Thread.Sleep(2000);
                        GenericHelper.SelectWindow("Web Activity");
                        _studentPresentationPage.AnswerTrue();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);

                        // Third studymaterial
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        GenericHelper.SelectWindow("Open Study Plan");
                        _drtStudentUxPage.SelectFrame();
                        _drtStudentUxPage.OpenThirdStudyMaterial();
                        Thread.Sleep(2000);
                        GenericHelper.SelectWindow("Web Activity");
                        _studentPresentationPage.AnswerTrue();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);
                        _drtDefaultUxPage.ClickReturnToCourse();
                        Thread.Sleep(4000);
                        DatabaseTools.UpdateSubmissionStatusOfActivity(_SpName);
                    }

                    string isSp3AlreadySubmitted = DatabaseTools.GetSubmissionStatusOfActivity(Enumerations.ActivityType.Sp2With3Rem);
                    if (isSp3AlreadySubmitted == null || isSp3AlreadySubmitted.Equals("False") || isSp3AlreadySubmitted.Equals(""))
                    {
                        string _SpName = DatabaseTools.GetActivityName(Enumerations.ActivityType.Sp2With3Rem);

                        GenericTestStep.StepToBrowsedUrlForPegasusUser("CsSmsStudent");
                        GenericTestStep.StepToLoggedIntoTheCourseSpaceAsSMSStudent();
                        GenericTestStep.StepToCloseStudentHelpTextWindow();
                        GenericTestStep.StepToIAmOnThePage("Global Home");
                        GenericTestStep.StepToSelectTheCreatedCourse(_courseName);
                        GenericTestStep.StepToItShouldBeOnPage("Today's View");
                        GenericTestStep.StepToNavigateToTheTab("Course Materials");

                        if (_SpName != null)
                        {
                            _coursePreviewMainUxPage.OpenAsset(_SpName);
                        }
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        _drtDefaultUxPage.ClickBegin();
                        _showMessagePage.ClickContinue();
                        GenericHelper.SelectWindow("Pre Test");
                        _studentPresentationPage.AnswerFalse();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);


                        // studymaterial presentation
                        // first studymaterial
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        GenericHelper.SelectWindow("Open Study Plan");
                        _drtStudentUxPage.SelectAllAvailableStudyMaterial();
                        _drtStudentUxPage.SelectFrame();
                        _drtStudentUxPage.OpenFirstStudyMaterial();
                        Thread.Sleep(2000);
                        GenericHelper.SelectWindow("Web Activity");
                        _studentPresentationPage.AnswerFalse();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);

                        // Second studymaterial
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        GenericHelper.SelectWindow("Open Study Plan");
                        _drtStudentUxPage.SelectFrame();
                        _drtStudentUxPage.OpenSecondStudyMaterial();
                        Thread.Sleep(2000);
                        GenericHelper.SelectWindow("Web Activity");
                        _studentPresentationPage.AnswerTrue();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);

                        // Third studymaterial
                        GenericHelper.WaitUtilWindow("Open Study Plan");
                        GenericHelper.SelectWindow("Open Study Plan");
                        _drtStudentUxPage.SelectFrame();
                        _drtStudentUxPage.OpenThirdStudyMaterial();
                        Thread.Sleep(2000);
                        GenericHelper.SelectWindow("Web Activity");
                        _studentPresentationPage.AnswerTrue();
                        _studentPresentationPage.SubmitActivity();
                        WebDriver.Close();
                        GenericHelper.SelectWindow("Open Study Plan");
                        WebDriver.Navigate().Refresh();
                        Thread.Sleep(4000);

                        _drtDefaultUxPage.ClickReturnToCourse();
                        Thread.Sleep(4000);
                        DatabaseTools.UpdateSubmissionStatusOfActivity(_SpName);
                    }
                    GenericTestStep.StepToClickedOnTheLogoutLinkToGetLoggedOutFromTheApplication();
                }
            }
            catch (Exception e)
            {
                GenericHelper.Logs(e.ToString(), "FAILED");
                Assert.Fail(e.ToString());
            }
        }