Exemple #1
0
        public void Createmodule(String coursename)
        {
            try
            {
                Pages.Courses.Courses coursepage = new Pages.Courses.Courses(driver);
                System.Threading.Thread.Sleep(2000);
                coursepage.CourseName().SendKeys(coursename);
                // TimeUnit.SECONDS.sleep(1);
                coursepage.CourseSelect().Click();
                CourseContent cc = new CourseContent(driver);
                cc.Module().Click();

                //			Test Case 01: Required Field Validation
                // logger.debug("Test Case 01: Required Field Validation");
                _test = _extent.StartTest("Test Case 01: Required Field Validation in Module create");
                Module m = new Module(driver);
                m.SubmitButton().SendKeys(Keys.Enter);
                Assert.AreEqual(m.ValidationMess().Text, "Course Module Name is required");
                _test.Log(LogStatus.Pass, "Assert Pass as condition is true");
                _extent.EndTest(_test);

                //			Test Case 02: Valid data
                //logger.debug("Test Case 02: Valid data");
                _test = _extent.StartTest("Test Case 02: Valid Data check");
                m.ModuleName().SendKeys(prop.getProperty("moduleName"));
                m.SubmitButton().Click();
                _test.Log(LogStatus.Pass, "Assert Pass as condition is true");
                _extent.EndTest(_test);
            }
            catch (Exception e)
            {
                //logger.error(e.getMessage());
                screenShotObj.GetScreenshot(driver, "createModule");
                _test.Log(LogStatus.Fail, "Assert Fail as condition is false");
                _extent.EndTest(_test);
            }

            _extent.Flush();
            _extent.Close();
        }
Exemple #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();
        }