class RegisterCoursesCSVDataTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = TestStatus(self.driver) self.nav = NavigationPage(self.driver) def setUp(self): self.nav.navigateToAllCourses() @pytest.mark.run(order=1) @data(*getCSVData( "/Users/Parth\PycharmProjects/automationFramework/tests/courses/testdata.csv" )) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV): self.courses.enterCourseName(courseName) time.sleep(1) self.courses.selectCourseToEnroll(courseName) time.sleep(1) self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV) time.sleep(1) result = self.courses.verifyEnrollFailed() self.ts.markFinal("test_invalidEnrollment", result, "Enrollment Failed Verification")
class RegisterCoursesTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = TestStatus(self.driver) @pytest.mark.run(order=1) def test_invalidEnrollment(self): self.courses.enterCourseName("JavaScript") self.courses.selectCourseToEnroll("JavaScript for beginners") self.courses.enrollCourse(num="10", exp="1220", cvv="10") result = self.courses.verifyEnrollFailed() self.ts.markFinal("test_invalidEnrollment", result, "Enrollment Failed Verification")
class RegisterMultipleCoursesTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = TestStatus(self.driver) @pytest.mark.run(order=1) @data(("JavaScript for beginners", "10", "1220", "10"), ("Learn Python 3 from scratch", "20", "1220", "20")) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV): self.courses.enterCourseName(courseName) self.courses.selectCourseToEnroll(courseName) self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV) result = self.courses.verifyEnrollFailed() self.ts.markFinal("test_invalidEnrollment", result, "Enrollment Failed Verification") self.driver.find_element_by_link_text("All Courses").click()
class RegisterCoursesCSVDataTests(unittest.TestCase): """ Do everything simsilar to LoginTests Examples: import page class, Test Status class Use fixtures """ @pytest.fixture(autouse=True) def objectSetup(self): self.courses = RegisterCoursesPage(self.driver) self.ts = TestStatus(self.driver) #self.navigator = NavigationPage(self.driver) def setUp(self): self.driver.get("https://letskodeit.teachable.com/courses") @data( *getCSVData("C:/Users/Jacob/PycharmProjects/letskodeit2/testdata.csv")) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV, ccZip): """ call required methods from page class to perform the test Enter course name select course Enroll in course Verify error message Test Status.markFinal() """ self.courses.enterCourseName(courseName) self.courses.selectCourseToEnroll(courseName) self.courses.enrollMaadi() #self.courses.webScroll('down') self.courses.enrollCourse(ccNum, ccExp, ccCVV, ccZip) result = self.courses.verifyEnrollFailed() self.ts.markFinal('test_invalidEnrollment', result, 'Regarding Enroll Button') #self.driver.find_element_by_link_text("All Courses").click() self.setUp()
class RegisterCoursesTests(unittest.TestCase): """ Do everything simsilar to LoginTests Examples: import page class, Test Status class Use fixtures """ @pytest.fixture(autouse=True) def classSetup(self): self.courses = RegisterCoursesPage(self.driver) self.ts = TestStatus(self.driver) @data(("JavaScript for beginners", "1209 4367 9809 4576", "09/22", "236", "90203"), ("Learn Python 3 from scratch", "1209 4367 9809 4576", "09/22", "236", "90203")) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV, ccZip): """ call required methods from page class to perform the test Enter course name select course Enroll in course Verify error message Test Status.markFinal() """ self.courses.enterCourseName(courseName) self.courses.selectCourseToEnroll(courseName) self.courses.enrollMaadi() #self.courses.webScroll('down') self.courses.enrollCourse(ccNum, ccExp, ccCVV, ccZip) result = self.courses.verifyEnrollFailed() self.ts.markFinal('test_invalidEnrollment', result, 'Regarding Enroll Button') #self.driver.find_element_by_link_text("All Courses").click() self.driver.get("https://letskodeit.teachable.com/courses")