Exemplo n.º 1
0
        public void PublishAssessment()
        {
            //if(prop.getProperty("AssessmentTest").trim().Equals("false"))
            //throw new SkipException("create Assessment skipped");
            try
            {
                //			Test Case1: Publish Assessment Acknowledge check validation message check
                //logger.debug("Publish Assessment Acknowledge check validation message check");

                PublishAssessment pa = new PublishAssessment(driver);
                pa.Publish().Click();

                pa.SweetAlertYesButton().Click();

                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                js.ExecuteScript("document.getElementById('divValidMsg').scrollIntoView();");
                Assert.AreEqual(pa.ValidationMessage().Text, "Please Check the Acknowledge.");

                //			Test Case2: Publishing the Assessment
                //logger.debug("Publishing the Assessment");

                pa.Acknowledge().Click();
                pa.Publish().Click();

                pa.SweetAlertYesButton().Click();
                //TimeUnit.SECONDS.sleep(5);
            }
            catch (Exception e)
            {
                //logger.error(e.getMessage());
                screenShotObj.GetScreenshot(driver, "publishAssessment");
            }
        }
Exemplo n.º 2
0
        public void AddQAndImportQ(string coursename)
        {
            try
            {
                Pages.Courses.Courses c = new Pages.Courses.Courses(driver);
                System.Threading.Thread.Sleep(1000);
                c.CourseName().SendKeys(coursename);
                c.CourseSelect().Click();
                CourseContent cc = new CourseContent(driver);
                System.Threading.Thread.Sleep(1000);
                cc.AddQuiz().Click();

                CreateQuiz          cq = new CreateQuiz(driver);
                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;

                _test = _extent.StartTest("Test Case #01: Add Quiz");
                System.Threading.Thread.Sleep(1000);
                cq.Title().SendKeys("sample Q1");
                cq.TimeLimit().SendKeys("30");
                //cq.StartDate().SendKeys(prop.getProperty("quizstartDate"));
                //cq.EndDate().SendKeys(prop.getProperty("quizendDate"));
                cq.PassPercentage().SendKeys("50");
                js.ExecuteScript("document.getElementById('btnAssessmentCreate').scrollIntoView();");
                cq.QuestionCount().SendKeys("1");
                cq.NextButton().Click();
                _test.Log(LogStatus.Pass, "Quiz is added successfully");


                _test = _extent.StartTest("Test Case #02: Import Questions in Quiz test");
                //AssessmentQuestions objAssessmentQuestions = new AssessmentQuestions(driver);
                //objAssessmentQuestions.ImportQuestions().Click();
                driver.FindElement(By.XPath(".//*[contains(@id,'addQuestion')]/../a[2]")).Click();
                System.Threading.Thread.Sleep(1000);
                ImportQuestions objImportQuestions = new ImportQuestions(driver);
                objImportQuestions.CheckBoxFirstQ().Click();
                objImportQuestions.ImportQuestion().Click();
                System.Threading.Thread.Sleep(1000);
                //objAssessmentQuestions.NextToPublish().Click();
                driver.FindElement(By.Id("btnPublishContent")).Click();
                _test.Log(LogStatus.Pass, "Successfully added Questions to Quiz");

                _test = _extent.StartTest("Test Case #03: Publish");
                System.Threading.Thread.Sleep(1000);
                PublishAssessment pa = new PublishAssessment(driver);
                pa.Publish().Click();
                pa.SweetAlertYesButton().Click();
                _test.Log(LogStatus.Pass, "Successfully published");
                _extent.EndTest(_test);
            }
            catch (Exception e)
            {
                screenShotObj.GetScreenshot(driver, "AddedQuiz" + e.Message);
                _test.Log(LogStatus.Fail, "Failed" + e.Message);
                _extent.EndTest(_test);
            }

            _extent.Flush();
            _extent.Close();
        }