コード例 #1
0
        public void AutoAssignCheck()
        {
            try
            {
                Pages.Courses.Courses coursepage   = new Pages.Courses.Courses(driver);
                CreateCourse          createcourse = new CreateCourse(driver);
                CourseContent         cc           = new CourseContent(driver);
                coursepage.NewCourse().Click();

                //Test Case#01: Auto Assign Check
                //logger.debug("Test Case#01: Auto Assign Check");
                _test = _extent.StartTest("Test Case#01: Auto Assign Check");
                System.Threading.Thread.Sleep(1000);
                createcourse.SetCategory("newCategory");
                createcourse.CourseTitle().SendKeys("sample course14");
                createcourse.AutoAssign().Click();
                createcourse.CourseImageUpload(@"C:\Users\Ansuman\Desktop\172.16.1.99\LMS\index.jpg");
                createcourse.CourseCreate().Click();
                System.Threading.Thread.Sleep(1000);
                string   widgetSummary      = cc.WidgetSummary().GetAttribute("innerText");
                string[] totalParticipants  = widgetSummary.Substring(widgetSummary.LastIndexOf("Total Participants:") + "Total Participants:".Length, widgetSummary.IndexOf("Total Assignment: ") - (widgetSummary.LastIndexOf("Total Participants:") + "Total Participants:".Length)).Split('/');
                string   totalParticipants1 = totalParticipants[0].Trim();
                string   totalParticipants2 = totalParticipants[1].Trim();
                Assert.AreEqual(totalParticipants1, totalParticipants2);
                _test.Log(LogStatus.Pass, "Total Participants are auto assigned. Total Participants:" + totalParticipants1 + " Total auto assigned Participants:" + totalParticipants2);
                _extent.EndTest(_test);
            }
            catch
            {
                _test.Log(LogStatus.Fail, "Total Participants are not auto assigned");
                screenShotObj.GetScreenshot(driver, "AutoAssign");
            }
            _extent.Flush();
            _extent.Close();

            System.Threading.Thread.Sleep(1000);
            //driver.Close();
        }
コード例 #2
0
        public void ElectiveCourse()
        {
            try
            {
                Pages.Courses.Courses coursepage   = new Pages.Courses.Courses(driver);
                CreateCourse          createcourse = new CreateCourse(driver);
                CourseContent         cc           = new CourseContent(driver);
                coursepage.NewCourse().Click();

                //Test Case#01: Elective Course Check
                //logger.debug("Test Case#01: Elective Course Check");
                _test = _extent.StartTest("Test Case#01: Elective Course Create and Validate");
                System.Threading.Thread.Sleep(1000);
                createcourse.SetCategory("newCategory");
                createcourse.CourseTitle().SendKeys("sample course22");
                createcourse.Elective().Click();
                createcourse.CourseImageUpload(@"C:\Users\Ansuman\Desktop\172.16.1.99\LMS\index.jpg");
                createcourse.CourseCreate().Click();
                System.Threading.Thread.Sleep(1000);

                cc.Module().Click();
                Module m = new Module(driver);
                m.ModuleName().SendKeys(prop.getProperty("moduleName"));
                m.SubmitButton().Click();

                System.Threading.Thread.Sleep(1000);
                cc.SuccessAlert().Click();

                System.Threading.Thread.Sleep(1000);
                cc.CheckBoxForPublish().Click();
                cc.PublishButton().Click();

                System.Threading.Thread.Sleep(5000);
                PublishCourse objPublishCourse = new PublishCourse(driver);
                objPublishCourse.PublishCourseButton().Click();
                System.Threading.Thread.Sleep(1000);
                objPublishCourse.PublishSwAlert().Click();
                System.Threading.Thread.Sleep(1000);
                cc.PublishButton().Click();

                SwitchUserLogin(driver);

                //Checking in Explore courses
                ExploreCourses objExploreCourses = new ExploreCourses(driver);
                objExploreCourses.Filter().SendKeys("sample course22");

                Assert.AreEqual("sample course22", objExploreCourses.FirstExploreCourse().Text);
                _test.Log(LogStatus.Pass, "Course is checked with " + objExploreCourses.FirstExploreCourse().Text + " Success");
                _extent.EndTest(_test);
            }
            catch (Exception e)
            {
                _test.Log(LogStatus.Fail, "Failed " + e.Message);
                screenShotObj.GetScreenshot(driver, "ErrorOccuredInElective");
            }
            _extent.Flush();
            _extent.Close();

            System.Threading.Thread.Sleep(1000);
            //driver.Close();
        }