def test_reset_app_individual_page(self): try: driver = self.driver driver.get(var_info.url_login) login = LoginPage(driver) login.enter_login_info(var_info.username_s, var_info.password_s) product = ProductPage(driver) product.click_add_to_cart(3) product.click_product_label(3) general = GeneralPage(driver) general.drop_down_menu() general.pick_item_from_menu("Reset App State") general.delete_button_menu() details = DetailsPage(driver) add_to_cart_product = details.check_single_add_to_cart() cart_qty = general.cart_qty() assert add_to_cart_product.text == "ADD TO CART" assert cart_qty == None except AssertionError as error: print("AssertionError occurred") print(error) cur_time = datetime.datetime.now().strftime("%H-%M-%S_%d_%m_%Y") testName = utils.whoami() screenshotName = testName + "_" + cur_time allure.attach(self.driver.get_screenshot_as_png(), name=screenshotName, attachment_type=allure.attachment_type.PNG) self.driver.get_screenshot_as_file( "/Users/yuchienhuang/Desktop/Swag_labs/Funtionality_Reports/product_page/product_page_screentshots/product_page_valid_user/" + screenshotName + ".png") raise
def test_all_items_details_page(self): try: driver = self.driver driver.get(var_info.url_login) login = LoginPage(driver) login.enter_login_info(var_info.username_pe, var_info.password_s) product = ProductPage(driver) product.click_product_label(1) #click label 1 details = DetailsPage(driver) add_to_cart = details.check_single_add_to_cart( ) #click add_to_cart add_to_cart.click() general = GeneralPage(driver) general.drop_down_menu() general.pick_item_from_menu("Reset App State") general.delete_button_menu() add_to_cart_product = details.check_single_add_to_cart() #cart_qty = general.cart_qty() assert driver.current_url != "https://www.saucedemo.com/inventory.html" assert add_to_cart_product.text == "ADD TO CART" #assert cart_qty == None except AssertionError as error: print("AssertionError occurred") print(error) cur_time = datetime.datetime.now().strftime("%H-%M-%S_%d_%m_%Y") testName = utils.whoami() screenshotName = testName + "_" + cur_time allure.attach(self.driver.get_screenshot_as_png(), name=screenshotName, attachment_type=allure.attachment_type.PNG) self.driver.get_screenshot_as_file( "/Users/yuchienhuang/Desktop/Swag_labs/Funtionality_Reports/product_page/product_page_screentshots/product_page_performance_glitch/" + screenshotName + ".png") raise