def test_module_cart_delete_item(self): module_cart = ModulePage(self.driver) header_cart = HeaderPage(self.driver) card = CardPage(self.driver) self.driver.get(TEST_URL + project_page.get('product_card_with_offers')) card.click_button_buy() header_cart.click_cart() assert module_cart.check_cart_module_info_loaded('грн') module_cart.click_button_remove_item() assert header_cart.check_cart_without_items
def test_add_update_delete_car_by_my_car(self): self.driver.get(TEST_URL) my_car = HeaderPage(self.driver) module_car = ModulePage(self.driver) self.add_car(self.driver, test_car.get('manufacture'), test_car.get('model'), test_car.get('type_model'), test_car.get('modification'), 'my_car', test_car.get('year')) self.change_year_vin(self.driver, 'module', vin=test_car.get('vin')) assert test_car.get('vin') in module_car.text_car_vin('my_cars') assert test_car.get('vin') in module_car.text_car_vin('chosen_car') self.delete_chosen_car(self.driver, 'module') assert my_car.check_empty_my_car
def test_cart_delete_item(self): header_cart = HeaderPage(self.driver) cart = CartPage(self.driver) card = CardPage(self.driver) module_cart = ModulePage(self.driver) self.driver.get(TEST_URL + project_page.get('product_card_with_offers')) card.click_button_buy() header_cart.click_cart() module_cart.click_to_cart() # self.close_draggable(self.driver) cart.click_button_remove_item() assert header_cart.check_cart_without_items
def test_comparison_info_cart_vs_recommended_in_cart(self): module_cart = ModulePage(self.driver) header_cart = HeaderPage(self.driver) cart = CartPage(self.driver) self.driver.get(TEST_URL + project_page.get('cart')) page_info = cart.set_recommended_product_info() cart.click_first_buy_button_recommended() assert self.driver.current_url == (TEST_URL + project_page.get('cart')) cart_info = cart.set_product_info() # self.close_draggable(self.driver) header_cart.click_cart() assert module_cart.check_cart_module_info_loaded('грн') cart_module_info = module_cart.set_product_info() assert page_info == cart_info assert page_info == cart_module_info
def test_check_name_garage(self): self.driver.get(TEST_URL) my_car = HeaderPage(self.driver) module_car = ModulePage(self.driver) garage = GaragePage(self.driver) self.add_car(self.driver, test_car.get('manufacture'), test_car.get('model'), test_car.get('type_model'), test_car.get('modification'), 'parts_search', test_car.get('year')) assert '{}{}'.format( test_car.get('manufacture'), test_car.get('model')).upper() == my_car.text_my_car my_car.click_my_car() module_car.click_button_go_to_garage() assert self.expected_car == garage.text_car_name
def test_comparison_info_cart_vs_full_search(self): module_cart = ModulePage(self.driver) header_cart = HeaderPage(self.driver) cart = CartPage(self.driver) full_search_product = FullSearchProductPage(self.driver) self.driver.get(TEST_URL + project_page.get('full-search-product')) page_info = full_search_product.set_product_info() full_search_product.click_first_buy_button() full_search_product.click_first_in_cart_button() assert self.driver.current_url == (TEST_URL + project_page.get('cart')) cart_info = cart.set_product_info() # self.close_draggable(self.driver) header_cart.click_cart() assert module_cart.check_cart_module_info_loaded('грн') cart_module_info = module_cart.set_product_info() assert page_info == cart_info assert page_info == cart_module_info
def login(self, driver, login=None, password=None): if not login: login = self.get_username password = self.get_password header = HeaderPage(driver) module = ModulePage(driver) header.click_empty_profile() module.fill_module_phone_field(login) module.fill_module_pass_field(password) module.click_module_enter()
def test_comparison_info_cart_vs_card(self): module_cart = ModulePage(self.driver) header_cart = HeaderPage(self.driver) cart = CartPage(self.driver) card = CardPage(self.driver) self.driver.get(TEST_URL + project_page.get('product_card_with_offers')) page_info = card.set_product_info() card.click_button_buy() card.click_to_cart_button() assert self.driver.current_url == (TEST_URL + project_page.get('cart')) cart_info = cart.set_product_info() # self.close_draggable(self.driver) header_cart.click_cart() assert module_cart.check_cart_module_info_loaded('грн') cart_module_info = module_cart.set_product_info() assert page_info == cart_info assert page_info == cart_module_info
def test_comparison_info_cart_vs_search(self): count = random.randint(0, 2) module_cart = ModulePage(self.driver) header_cart = HeaderPage(self.driver) cart = CartPage(self.driver) search = SearchPage(self.driver) self.driver.get(TEST_URL + project_page.get('search')) page_info = search.set_recomended_product_info(count) search.get_first_offers_buy_button[count].click() search.get_first_offers_in_cart_button[0].click() assert self.driver.current_url == (TEST_URL + project_page.get('cart')) cart_info = cart.set_product_info() # self.close_draggable(self.driver) header_cart.click_cart() assert module_cart.check_cart_module_info_loaded('грн') cart_module_info = module_cart.set_product_info() assert page_info == cart_info assert page_info == cart_module_info
def test_auth_checkout_page(self): """Test 4""" header = HeaderPage(self.driver) card = CardPage(self.driver) module = ModulePage(self.driver) checkout = CheckoutPage(self.driver) self.driver.get(TEST_URL + project_page.get('product_card_with_offers')) card.click_button_buy() assert header.text_digit_cart_header header.click_cart() module.click_module_button_order() self.wait_client_loader(self.driver) self.login_multi_checkout(self.driver) assert test_user.get( 'multi_name').lower() in header.text_profile_user.lower() assert test_user.get( 'multi_name').lower() in checkout.text_checkout_user_name.lower()
def delete_chosen_car(driver, mode): if mode == 'module': delete_car = ModulePage(driver) else: delete_car = GaragePage(driver) driver.execute_script("window.scrollTo(0, document.body.scrollTop);") delete_car.click_delete_car() delete_car.click_confirm_delete_car()
def test_add_update_delete_car_by_parts_search(self): self.driver.get(TEST_URL) my_car = HeaderPage(self.driver) module_car = ModulePage(self.driver) garage = GaragePage(self.driver) self.add_car(self.driver, test_car.get('manufacture'), test_car.get('model'), test_car.get('type_model'), test_car.get('modification'), 'parts_search', test_car.get('year')) my_car.click_my_car() module_car.click_button_go_to_garage() self.change_year_vin(self.driver, 'garage', year=self.expected_car_year, vin=test_car.get('vin')) assert test_car.get('vin') in garage.text_car_vin assert self.expected_car_year in garage.text_car_year self.delete_chosen_car(self.driver, 'garage') assert my_car.check_empty_my_car
def test_comparison_info_cart_vs_you_watched(self): module_cart = ModulePage(self.driver) header_cart = HeaderPage(self.driver) cart = CartPage(self.driver) main = MainPage(self.driver) self.driver.get(TEST_URL + project_page.get('product_card_with_offers')) self.driver.get(TEST_URL) page_info = main.set_you_watched_product_info() main.click_first_buy_button_you_watched() main.click_first_in_cart_button_you_watched() assert self.driver.current_url == (TEST_URL + project_page.get('cart')) cart_info = cart.set_product_info() # self.close_draggable(self.driver) header_cart.click_cart() assert module_cart.check_cart_module_info_loaded('грн') cart_module_info = module_cart.set_product_info() assert page_info == cart_info assert page_info == cart_module_info
def test_comparison_info_cart_vs_card_offers(self): count = random.randint(0, 1) module_cart = ModulePage(self.driver) header_cart = HeaderPage(self.driver) cart = CartPage(self.driver) card = CardPage(self.driver) self.driver.get(TEST_URL + project_page.get('product_card_with_offers')) page_info = card.set_product_info_offers(count) card.get_first_offers_buy_button[count].click() card.click_offer_in_cart_button() assert self.driver.current_url == (TEST_URL + project_page.get('cart')) cart_info = cart.set_product_info() # self.close_draggable(self.driver) header_cart.click_cart() assert module_cart.check_cart_module_info_loaded('грн') cart_module_info = module_cart.set_product_info() assert page_info == cart_info assert page_info == cart_module_info
def test_check_name_my_car(self): self.driver.get(TEST_URL) my_car = HeaderPage(self.driver) module_car = ModulePage(self.driver) self.add_car(self.driver, test_car.get('manufacture'), test_car.get('model'), test_car.get('type_model'), test_car.get('modification'), 'my_car', test_car.get('year')) assert '{}{}'.format( test_car.get('manufacture'), test_car.get('model')).upper() == my_car.text_my_car assert set(self.expected_car) == module_car.set_text_car_name
def test_cart_change_count_items(self, mode): header_cart = HeaderPage(self.driver) cart = CartPage(self.driver) card = CardPage(self.driver) module_cart = ModulePage(self.driver) self.driver.get(TEST_URL + project_page.get('product_card_with_offers')) decrease = card.text_price increase = str(int(decrease[:-3]) * 2) card.click_button_buy() header_cart.click_cart() module_cart.click_to_cart() # self.close_draggable(self.driver) cart.click_button_plus() assert cart.check_field_digit_field_count('2') assert cart.check_sum_price( increase) if mode == 'sum' else cart.check_total_price(increase) cart.click_button_minus() assert cart.check_field_digit_field_count('1') assert cart.check_sum_price( decrease) if mode == 'sum' else cart.check_total_price(decrease)
def add_car(driver, manufacture, model, type_model, modification, mode, year=None): add_car = ModulePage(driver) my_car = HeaderPage(driver) if mode == 'my_car': my_car.click_my_car() if year: add_car.click_years_select(mode) add_car.click_car_year_selected(year) add_car.click_munufactures_select(mode) add_car.fill_manufacture_field(manufacture) add_car.click_car_manufacture_selected() add_car.click_models_select(mode) add_car.click_car_model_selected(model) add_car.click_type_models_select(mode) add_car.click_car_type_model_selected(type_model) add_car.click_modifications_select(mode) add_car.click_car_modification_selected(modification) add_car.click_select_car()
def change_year_vin(driver, mode, **car_attr): if mode == 'module': edit_car = ModulePage(driver) else: edit_car = GaragePage(driver) if car_attr.get('year'): edit_car.click_edit_car() edit_car.clear_year() edit_car.fill_year_field(car_attr.get('year')) edit_car.click_button_ok_car_year() if car_attr.get('vin'): edit_car.fill_vin_field(car_attr.get('vin')) edit_car.click_button_ok_car_vin()