class TestRegisterCourseCSV(unittest.TestCase): @pytest.fixture(autouse=True) def object_setup(self, one_time_setUp): self.register_courses_page = RegisterCoursesPage(self.driver) self.test_status = ErrorStatus(self.driver) self.nav = NavigationPage(self.driver) def setUp(self): self.nav.navigate_to_home() @pytest.mark.run(order=1) @data(*get_csv_data( "C:\\Users\\Zarko\\Documents\\python_projects\\python_projects\\lets_code_it_Framework\\test_data.csv" )) @unpack def test_register_courses_error(self, course_name, cc_num, cc_exp, cc_cvv, postal): self.register_courses_page.test(course=course_name, cc_num=cc_num, exp_date=cc_exp, cvv=cc_cvv, postal=postal) time.sleep(1) result_1 = self.register_courses_page.verify_card_invalid() self.test_status.mark(result_1, "Verify invalid credit card Failed") result_2 = self.register_courses_page.verify_enrol_btn_disabled() self.test_status.mark_final("Verify state", result_2, "Verify enroll button disabled Failed") time.sleep(1)
class TestRegisterMultipleCourses(unittest.TestCase): @pytest.fixture(autouse=True) def class_setup(self, one_time_setUp): self.register_courses_page = RegisterCoursesPage(self.driver) self.test_status = ErrorStatus(self.driver) @pytest.mark.run(order=1) @data(("JavaScript", "1111 5678 9098 7654", "1020", '111', '11000'), ("Python", "2222 5678 9098 7654", "1020", '222', '22000')) @unpack def test_register_courses_error(self, course_name, cc_num, cc_exp, cc_cvv, postal): self.register_courses_page.test(course=course_name, cc_num=cc_num, exp_date=cc_exp, cvv=cc_cvv, postal=postal) time.sleep(1) result_1 = self.register_courses_page.verify_card_invalid() self.test_status.mark(result_1, "Verify invalid credict card Failed") result_2 = self.register_courses_page.verify_enrol_btn_disabled() self.test_status.mark_final("Verify state", result_2, "Verify enroll button disabled Failed") time.sleep(1) self.driver.find_element_by_css_selector('img[alt="Let\'s Kode It"]').click() self.driver.find_element_by_link_text('All Courses').click()
class LoginTest(unittest.TestCase): @pytest.fixture(autouse=True) def class_setup(self, one_time_setUp): self.log_in_page = LoginPage(self.driver) self.ts = ErrorStatus(self.driver) # @pytest.mark.run(order=2) def test_valid_login(self): # self.driver.get('https://learn.letskodeit.com/') self.log_in_page.login('*****@*****.**', 'abcabc') result_1 = self.log_in_page.verify_title() # time.sleep(20) self.ts.mark(result_1, " Title is Incorrect") result_2 = self.log_in_page.verify_login_successfull() self.ts.mark_final("Test Valid Login", result_2, "Loggin Failed") time.sleep(2) # @pytest.mark.run(order=1) def test_failed_login(self): self.log_in_page.logout() self.log_in_page.login('*****@*****.**', 'abcabcxyz') result = self.log_in_page.verify_login_failed() # self.ts.mark(result, "Failed Login test is Unsuccessful") assert result is True time.sleep(2)
class TestPDP(unittest.TestCase): @pytest.fixture(autouse=True) def class_setup(self, one_time_setup): self.pdp_test = PDP(self.driver) self.error_status = ErrorStatus(self.driver) # @pytest.mark.run(order=1) def test_a_pdp(self): self.pdp_test.test_pdp1() # time.sleep(2) result = self.pdp_test.test_qty_of_items_added(2) self.error_status.mark(result, "2 Items in the cart Failed") # @pytest.mark.run(order=2) def test_b_2(self): self.pdp_test.test_pdp2() # time.sleep(2) result = self.pdp_test.test_qty_of_items_added(1) self.error_status.mark(result, "One item added to the cart Failed") # @pytest.mark.run(order=3) def test_c_3(self): self.pdp_test.test_pdp_remove_item() # time.sleep(2) title_result = self.pdp_test.verify_title_matches("Order - My Store") self.error_status.mark(title_result, " Verify the Title") result = self.pdp_test.products_in_cart(1) self.error_status.mark_final("Remove item Test", result, " Verify number of products in cart")
class TestRegisterCourse(unittest.TestCase): @pytest.fixture(autouse=True) def class_setup(self, one_time_setUp): self.register_courses_page = RegisterCoursesPage(self.driver) self.test_status = ErrorStatus(self.driver) @pytest.mark.run(order=1) def test_register_courses_error(self): self.register_courses_page.test(course="JavaScript", cc_num='1234 5678 9098 7654', exp_date='1020', cvv='737', postal='11000') time.sleep(2) result_1 = self.register_courses_page.verify_card_invalid() self.test_status.mark(result_1, "Verify invalid credict card Failed") result_2 = self.register_courses_page.verify_enrol_btn_disabled() self.test_status.mark_final("Verify state", result_2, "Verify enroll button disabled Failed") time.sleep(2)
def object_setup(self, one_time_setUp): self.register_courses_page = RegisterCoursesPage(self.driver) self.test_status = ErrorStatus(self.driver) self.nav = NavigationPage(self.driver)
def class_set_up(self, one_time_setup): self.home = HomePage(self.driver) self.errors = ErrorStatus(self.driver) self.account = MyAccount(self.driver)
class TestMyAcc(unittest.TestCase): @pytest.fixture(autouse=True) def class_set_up(self, one_time_setup): self.home = HomePage(self.driver) self.errors = ErrorStatus(self.driver) self.account = MyAccount(self.driver) # def test_my_addresses(self): # # # ADD FIRST ADDRESS # self.account.add_address() # # result = self.home.verify_no_addresses() # if result is True: # result = False # else: # result = True # self.errors.mark(result, 'Checking if address is added') # # # UPDATE ADDRESS # self.account.update_address() # # result = self.account.verify_updated_state() # self.errors.mark(result, 'Editing address') # # # DELETE ADDRESS # self.home.address_delete() # # result = self.home.verify_no_addresses() # self.errors.mark_final('Addresses test', result, 'Deleting address') # # # LOGOUT # self.home.log_out() # # def test_a_order_history(self): # self.home.go_to_homepage() # self.home.log_in() # # ORDER HISTORY # self.account.go_to_history() # # result = self.account.verify_checkout_btn() # self.errors.mark_final('My account test', result, "My Order History") # # self.home.log_out() def test_wishlist(self): self.home.log_in() self.home.go_to_homepage() self.home.adding_2_products_wishlist() self.account.test_wishlist() result_deleting_item = self.account.verify_item_delete() self.errors.mark(result_deleting_item, 'Deleting item') self.account.qty_manipulation() result_qty = self.account.verify_product_qty() self.errors.mark(result_qty, 'Qty manipulation inside wishlist') self.account.create_new_wishlist() result_new_wishlist = self.account.verify_new_wishlist() self.errors.mark(result_new_wishlist, 'Adding new wishlist') self.account.delete_wishlists() result_delete_wishlists = self.account.verify_wishlist_removed() self.errors.mark_final('Wish List tests', result_delete_wishlists, 'Deleting wishlists')
def class_setup(self, one_time_setup): self.home_page = HomePage(self.driver) self.errors = ErrorStatus(self.driver) self.plp = ProductListingPage(self.driver) self.pdp = PDP(self.driver) self.checkout = CheckoutPage(self.driver)
class SanityTest1(unittest.TestCase): @pytest.fixture(autouse=True) def class_setup(self, one_time_setup): self.home_page = HomePage(self.driver) self.errors = ErrorStatus(self.driver) self.plp = ProductListingPage(self.driver) self.pdp = PDP(self.driver) self.checkout = CheckoutPage(self.driver) # @pytest.mark.run(order=1) def test_a_reach_woman_dresses(self): self.home_page.click_woman_dresses() time.sleep(1) result = self.home_page.verify_woman_dresses_title( "Dresses - My Store") self.errors.mark_final( "Reach woman dress", result, 'Reach woman dresses Failed - Title doesnt match') # @pytest.mark.run(order=2) def test_b_plp_actions(self): self.plp.plp_test_1(0) time.sleep(1) add_result = self.pdp.test_qty_of_items_added(1) self.errors.mark_final("Test items in cart", add_result, "Failed to add 1 item from PLP") self.plp.plp_test_2() # @pytest.mark.run(order=3) def test_c_pdp_actions(self): self.pdp.test_pdp1() self.pdp.continue_to_checkout() result = self.pdp.products_in_cart(3) self.errors.mark_final("Cart qty check", result, "Qty in cart is not correct") # @pytest.mark.run(order=4) def test_d_cart_actions(self): self.checkout.cart_actions(1, 0) result = self.pdp.products_in_cart(2) self.errors.mark_final("Cart qty check", result, "Qty in cart is not correct") # @pytest.mark.run(order=5) def test_e_login_actions(self): self.checkout.click_proceed_to_checkout() self.checkout.login('*****@*****.**', '123') result = self.checkout.verify_invalid_login() self.errors.mark(result, 'Invalid Login Test') time.sleep(1) self.checkout.login('*****@*****.**', 'Zarko321') result = self.checkout.verify_valid_login() self.errors.mark_final('Login Actions', result, 'Valid Login Test') # @pytest.mark.run(order=6) def test_f_address_actions(self): self.checkout.add_new_address_btn() self.checkout.address_handling('Zarko', 'Test', '565 W Orchard st', 'Milwaukee', '53204', "Wisconsin", '2345678902') time.sleep(1) result = self.checkout.verify_address_submit_success() self.errors.mark(result, 'Adding Address') # select address from dropdown self.checkout.select_shipping_address_dropdown() self.checkout.add_billing_address() self.checkout.address_handling('Zarko', 'Test', '123 Santa Monica Blvd', 'Santa Monica', '90401', 'California', '2349030994') result_billing = self.checkout.verify_address_submit_success() self.errors.mark_final('Handling SHipping and billing address', result_billing, 'Billing Address Add') # @pytest.mark.run(order=7) def test_g_carrier_actions(self): self.checkout.handling_4th_step() bank_present = self.checkout.verify_payment_method_wire() self.errors.mark(bank_present, "Bank Payment Method present") check_present = self.checkout.verify_payment_check() self.errors.mark_final('Payment methods present', check_present, 'Check Payment Method present') # @pytest.mark.run(order=8) def test_h_place_order(self): self.checkout.place_order_wire() # @pytest.mark.run(order=9) def test_i_remove_addresses(self): self.home_page.address_delete() result = self.home_page.verify_no_addresses() self.errors.mark(result, "Removing addresses") self.home_page.log_out() result_2 = self.home_page.verify_log_out() self.errors.mark_final('Teardown', result_2, 'Log out') time.sleep(1)
def class_setup(self, one_time_setUp): self.register_courses_page = RegisterCoursesPage(self.driver) self.test_status = ErrorStatus(self.driver)
def class_setup(self, one_time_setUp): self.log_in_page = LoginPage(self.driver) self.ts = ErrorStatus(self.driver)
def class_setup(self, one_time_setup): self.pdp_test = PDP(self.driver) self.error_status = ErrorStatus(self.driver)