public void AllDocsUpload(string coursename) { try { Pages.Courses.Courses c = new Pages.Courses.Courses(driver); System.Threading.Thread.Sleep(2000); c.CourseName().SendKeys(coursename); c.CourseSelect().Click(); CourseContent cc = new CourseContent(driver); System.Threading.Thread.Sleep(2000); _test = _extent.StartTest("Test Case#01: All type of Docs Upload functionality check"); Pages.Courses.UploadContent uc = new Pages.Courses.UploadContent(driver); System.IO.DirectoryInfo root = new System.IO.DirectoryInfo(@"D:\Prakash\Ez2enlight\LMSAutomation\LMSAutomation\Data\AllDocs"); var files = root.GetFileSystemInfos("*.*").ToArray(); foreach (var file in files) { cc.UploadContent().Click(); uc.FileName().SendKeys(file.Name); uc.Duration().SendKeys(prop.getProperty("durationforUploaded")); uc.SelectAFile().Click(); Utility.FileUpload.UploadFile(@"D:\Prakash\Ez2enlight\LMSAutomation\LMSAutomation\Data\AllDocs\" + file.Name); uc.SubmitButton().Click(); cc.SuccessAlert().Click(); } cc.CheckBoxForPublish().Click(); cc.PublishButton().Click(); PublishCourse objPublishCourse = new PublishCourse(driver); objPublishCourse.FirstMod().Click(); Assert.AreEqual(files.Length, objPublishCourse.TotalImagesFiles().Count); _test.Log(LogStatus.Pass, "Upload files are successfully visible in preview"); _extent.EndTest(_test); } catch (Exception e) { screenShotObj.GetScreenshot(driver, "UploadCOntent" + e.Message); _test.Log(LogStatus.Fail, "Some files are missing in preview course"); _extent.EndTest(_test); } _extent.Flush(); _extent.Close(); }
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(); }