class RegisterCoursesTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = Status(self.driver) @pytest.mark.run(order=1) def testInvalidEnrollment(self): self.courses.enterCourseName("JavaScript for") self.courses.clickEnrollButton() self.courses.enterCreditCardInfo("4280323963876221", "0521", "192", "00-001") self.courses.clickTermsCheckbox() self.courses.clickEnrollSubmitButton() result1 = self.courses.verifyEnrollFailed() self.ts.markFinal("testInvalidEnrollment", result1, "Verify if fake card makes button enabled.")
class LoginTest(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = Status(self.driver) @pytest.mark.run(order=2) def test_validLogin(self): self.lp.login("*****@*****.**", "abcabc") result1 = self.lp.verifyLoginTitle() self.ts.mark(result1, 'Title verified') result2 = self.lp.verifyLoginSuccess() self.ts.markFinal("test_validLogin", result2, 'Login was successful') @pytest.mark.run(order=1) def test_invalidLogin(self): self.lp.login("*****@*****.**", "incorrect") result = self.lp.verifyLoginFail() assert result == True
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lg = LoginPage(self.driver) self.ts = Status(self.driver) @pytest.mark.run(order=1) def tests_invalidLogin(self): self.lg.login() result = self.lg.verifyFailedLogin() self.ts.markFinal("tests_invalidLogin", result, "Invalid Login Verification") @pytest.mark.run(order=2) def tests_validLogin(self): self.lg.login('*****@*****.**', 'test1234') result1 = self.lg.verifyTitle() self.ts.mark(result1, "Title Verification") result2 = self.lg.verifySuccessfulLogin() self.ts.markFinal("tests_validLogin", result2, "Login Verification")
class ReadFromCSVTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = Status(self.driver) self.nav = NavigationPage(self.driver) @pytest.mark.run(order=1) @data(*getCSVData("/Users/pawel/PycharmProjects/letskodeit/testdata.csv")) @unpack def testInvalidEnrollment(self, courseName, num, exp, cvv, post): self.courses.enterCourseName(courseName) self.courses.clickEnrollButton() self.courses.enterCreditCardInfo(num, exp, cvv, post) self.courses.clickTermsCheckbox() self.courses.clickEnrollSubmitButton() result1 = self.courses.verifyEnrollFailed() self.ts.markFinal("testInvalidEnrollment", result1, "Verify if fake card makes button enabled.") self.nav.navigationToIcon()
class LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = Status(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 LoginTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.ts = Status(self.driver) @pytest.mark.run(order=2) def test_validLogin(self): self.lp.clearing() self.lp.logging("*****@*****.**", "abcabc") result2 = self.lp.verifyLoginTitle() self.ts.mark(result2, "Title verification.") result3 = self.lp.verifyLogin() self.ts.markFinal("test_validLogin", result3, "Login verification.") @pytest.mark.run(order=1) def test_failedLogin(self): self.lp.logout() self.lp.logging("*****@*****.**", "abcaaabc") result1 = self.lp.verifyLoginFailed() self.ts.mark(result1, "Testing login to fail.")
class MultipleDataTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.ts = Status(self.driver) @pytest.mark.run(order=1) @data(("JavaScript for beginners", "4280323963876221", "0521", "192", "00-001"), ("Complete Test Automation Bundle", "4280323963876221", "0622", "111", "00-002")) @unpack def testInvalidEnrollment(self, courseName, num, exp, cvv, post): self.courses.enterCourseName(courseName) self.courses.clickEnrollButton() self.courses.enterCreditCardInfo(num, exp, cvv, post) self.courses.clickTermsCheckbox() self.courses.clickEnrollSubmitButton() result1 = self.courses.verifyEnrollFailed() self.ts.markFinal("testInvalidEnrollment", result1, "Verify if fake card makes button enabled.") self.driver.find_element_by_xpath( "//a[@class='navbar-brand header-logo']").click()
class CoursesTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSet(self, oneTimeSetUp): self.cp = RegisterCoursesPage(self.driver) self.ts = Status(self.driver) self.np = NavigationPage(self.driver) # @pytest.mark.run(order=1) # def test_invalidEnrollment(self): # self.cp.enrollToCourse() # result = self.cp.verifyEnrollFailed() # self.ts.markFinal("Verification of Invalid Enrollment", result, "Negative Test Case") @pytest.mark.run(order=1) @data(*getCSVData( '/Users/Dule-PC/workspace_python/PageObjectModel_framework/testdata.csv' )) @unpack def test_invalidEnrollment(self, course, courseFullName): self.cp.enrollToCourse(course, courseFullName) result = self.cp.verifyIfEnrollBtnIsDisable() self.ts.markFinal("test_invalidEnrollment", result, "Negative Test Case") self.np.navigateToAllCourses()