class RegisterCoursesTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetUp(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.cs = CheckStatus(self.driver) def test_invalidEnrollment(self): self.courses.enterCourseName("JavaScript") self.courses.selectCourseToEnroll('JavaScript for beginners') self.courses.enrollCourse('1111 2222 3333 4444', '1122', '123') result1 = self.courses.verifyPurchaseBtn() self.cs.markFinal("test_invalidEnrollment", result1, 'Checking Purchase Button')
class RegisterCourseCSVDataTest(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.courses = RegistrationCoursesPage(self.driver) self.cs = CheckStatus(self.driver) @pytest.mark.run(order=1) @data(*getCSVData("/Users/adiellevy/PycharmProjects/FrameWorkAutomation/Testdata.csv")) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCvv, zipCode): self.courses.searchBox(courseName) self.courses.selectCourse(courseName) self.courses.enrollCourse(num=ccNum, exp=ccExp, ccv=ccCvv, zip=zipCode) verification = self.courses.verifyEnrollFailed() self.cs.markFinal(" Test invalid Enrollment ", verification, "Error Message Is Correct") self.courses.allCourses()
class RegisterCourseTest(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.courses = RegistrationCoursesPage(self.driver) self.cs = CheckStatus(self.driver) @pytest.mark.run(order=1) def test_invalidEnrollment(self): self.courses.searchBox("python") self.courses.selectCourse("Learn Python 3 from scratch") self.courses.enrollCourse(num="1234 5678 9123 4567", exp="1121", ccv="123", zip="12345") verification = self.courses.verifyEnrollFailed() self.cs.markFinal(" Test invalid Enrollment ", verification, "Error Message Is Correct")
class RegisterMultiCoursesTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetUp(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.cs = CheckStatus(self.driver) # we provide multiple data 'packs' as tuples (watch the order!) which we unpack @data(('JavaScript for beginners', '1111 2222 3333 4444', '1122', '123'), ("Learn Python 3 from scratch", '5555 6666 7777 8888', '0722', '666')) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCvc): self.courses.enterCourseName(courseName) self.courses.selectCourseToEnroll(courseName) self.courses.enrollCourse(num=ccNum, exp=ccExp, cvc=ccCvc) result1 = self.courses.verifyPurchaseBtn() self.cs.markFinal("test_invalidEnrollment", result1, 'Checking Purchase Button') self.driver.find_element_by_xpath("//a[@class='navbar-brand header-logo']").click()
class RegisterMultiCoursesTests(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetUp(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.cs = CheckStatus(self.driver) self.nav = NavigationPage(self.driver) def setUp(self): self.nav.navigateToAllCourses() # we provide getCSVdata method as *args @data(*getCSVdata( 'C:/Users/Lenovo/workspace_python/probastrony/testdata.csv')) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCvc): self.courses.enterCourseName(courseName) self.courses.selectCourseToEnroll(courseName) self.courses.enrollCourse(num=ccNum, exp=ccExp, cvc=ccCvc) result1 = self.courses.verifyPurchaseBtn() self.cs.markFinal("test_invalidEnrollment", result1, 'Checking Purchase Button')
class TestLogin(unittest.TestCase): @pytest.fixture(autouse=True) def objectSetUp(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.cs = CheckStatus(self.driver) self.nav = NavigationPage(self.driver) # @pytest.fixture() # def methSetUp(self, setUp): @pytest.mark.run(order=2) def test_ValidLogin(self): self.nav.navigateToHomePage() self.lp.login('*****@*****.**', 'abcabc') result1 = self.lp.verifyLoginPageTitle() self.cs.mark(result1, 'We verify title... ###') result2 = self.lp.verifySuccessLogin() self.cs.markFinal('test_ValidLogin', result2, 'We test correct login/password ###') @pytest.mark.run(order=1) def test_InvalidLogin(self): self.lp.logout() self.lp.login('*****@*****.**', 'gunwo') result0 = self.lp.verifyFailLogin() self.cs.markFinal('test_InvalidLogin', result0, 'We test wrong login/password ###')
class RegisterCourseTest(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): self.courses = RegistrationCoursesPage(self.driver) self.cs = CheckStatus(self.driver) self.nav = NavigationPage(self.driver) def setUp(self): self.nav.moveBack() self.nav.navigateToAllCourses() @pytest.mark.run(order=1) @data(("Learn Python 3 from scratch", "1234 5678 9123 4567", "1121", "123", "12345"), ()) @unpack def test_invalidEnrollment(self, courseName, ccNum, ccExp, ccCvv, zipCode): self.courses.searchBox(courseName) self.courses.selectCourse(courseName) self.courses.enrollCourse(num=ccNum, exp=ccExp, ccv=ccCvv, zip=zipCode) verification = self.courses.verifyEnrollFailed() self.cs.markFinal(" Test invalid Enrollment ", verification, "Error Message Is Correct")
class LoginTo(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetUp): # lp = Login Page self.lp = LoginPage(self.driver) # cs = Test Status self.cs = CheckStatus(self.driver) @pytest.mark.run(order=2) def test_ValidTest(self): self.lp.clearField() self.lp.login("*****@*****.**", "abcabc") verification1 = self.lp.veriftTitle() self.cs.mark(verification1, "Title Is Correct") verification2 = self.lp.verifyLoginSuccessful() self.cs.markFinal("test_ValidTest", verification2, "You Have Successful Login") @pytest.mark.run(order=1) def test_invalidLogin(self): self.lp.logout() self.lp.login("", "Usf") result = self.lp.verifyLoginFailed() assert result is True
def classSetup(self, oneTimeSetUp): self.courses = RegistrationCoursesPage(self.driver) self.cs = CheckStatus(self.driver)
def objectSetUp(self, oneTimeSetUp): self.courses = RegisterCoursesPage(self.driver) self.cs = CheckStatus(self.driver)
def classSetup(self, oneTimeSetUp): # lp = Login Page self.lp = LoginPage(self.driver) # cs = Test Status self.cs = CheckStatus(self.driver)
def objectSetUp(self, oneTimeSetUp): self.lp = LoginPage(self.driver) self.cs = CheckStatus(self.driver) self.nav = NavigationPage(self.driver)