class RegisterCourseCSVTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = CheckStatus(self.driver) self.nav = NavigationPage(self.driver) def setUp(self): self.nav.navigateToAllCourse() time.sleep(5) @pytest.mark.run(order=1) @data(*getCSVData( "/Users/dattran/Documents/Virtualenv/PyCharm/workspace_python/letskodeit/data.csv" )) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCVV): self.courses.enterCourseName(courseName) time.sleep(2) self.courses.selectCourseToEnroll(courseName) time.sleep(2) self.courses.enrollCourse(num=ccNum, exp=ccExp, cvv=ccCVV) time.sleep(5) result = self.courses.verifyEnrollFailed() self.ts.markFinal("test_invalidEnrollment", result, "Enrollment Failed Verification")
class RegisterCourseTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = CheckStatus(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="4450900412345678", exp="1220", cvv="123") time.sleep(5) result = self.courses.verifyEnrollFailed() self.ts.markFinal("test_invalidEnrollment", result, "Enrollment Failed Verification")
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = CheckStatus(self.driver) @pytest.mark.run(order=2) def test_validLogin(self): self.lp.login("*****@*****.**", "abcabc") result1 = self.lp.verifyLoginTitle() self.ts.mark(result1, "Title Verification") result2 = self.lp.verifyLoginSuccessful() self.ts.markFinal("test_validLogin", result2, "Login Verification") @pytest.mark.run(order=1) def test_InvalidLogin(self): self.lp.logout() self.lp.login("*****@*****.**", "abcabcabc") result = self.lp.verifyLoginFailed() assert result == True
class RegisterCourseMutipleDataSet(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = CheckStatus(self.driver) @pytest.mark.run(order=1) @data(("JavaScript for beginners", "4450900412345678", "1220", "123"), ("Selenium WebDriver Advanced", "4450900412345678", "1220", "124")) @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) time.sleep(5) result = self.courses.verifyEnrollFailed() self.ts.markFinal("test_invalidEnrollment", result, "Enrollment Failed Verification") self.driver.find_element_by_link_text("ALL COURSES").click()
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classLevelSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = CheckStatus(self.driver) @pytest.mark.run(order=2) def test_validLogin(self): self.lp.login("*****@*****.**", "abcabc") result1 = self.lp.verifyTitle() self.ts.mark(result1, "Title is incorrect") result2 = self.lp.verifyLoginSuccessful() self.ts.markFinal("test_ValidLogin", result2, "Some problem with test_Valid Login") @pytest.mark.run(order=1) def test_InvalidLogin(self): #self.driver.get(self.baseURL) self.lp.login("*****@*****.**", "353abcabc") result = self.lp.verifyLoginFailed() self.ts.mark(result, " Login is unsuccessfull")
def objectSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = CheckStatus(self.driver) self.nav = NavigationPage(self.driver)
def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = CheckStatus(self.driver)