Best Python code snippet using toolium_python
test_training_diary_page.py
Source:test_training_diary_page.py
...40 LETD.close_button,41 LETD.description_exercise,42 )43 edit_training_page.scroll_to_element(LTD.scrolling)44 edit_training_page.wait_until_not_visible(LETD.click_add_foto_exercise)45 edit_training_page.click(LETD.click_add_foto_exercise)46 edit_training_page.wait_until_not_visible(LETD.add_foto_exercise)47 edit_training_page.upload_file(48 LETD.add_foto_exercise, (str(path_to_root_project) + str(Path("/beef.png")))49 )50 edit_training_page.wait_until_not_visible(LETD.img_foto_load, timeout=200)51 edit_training_page.click(LETD.save_button_foto)52 edit_training_page.send_keys(LETD.number_of_approaches, "2")53 edit_training_page.click(LER.save_button, button_go_back)54 with allure.step(55 "Ðликаем на наÑÑ ÑÑениÑÐ¾Ð²ÐºÑ Ð² базе и пÑовеÑÑем оÑобÑажение загÑÑженной Ñанее каÑÑинки и дÑÑгиÑ
даннÑÑ
"56 ):57 training_diary_page = TrainingDiaryPage(driver)58 training_diary_page.wait_until_not_visible(LTD.other_category_post, timeout=30)59 training_diary_page.click(60 LTD.other_category_post, LTD.my_name_training_category61 )62 training_diary_page.click(LTD.description_record_my_training)63 training_diary_page.wait_until_not_visible(LTD.img_foto_load_description)64 assert (training_diary_page.is_visible(LTD.img_foto_load_description)) and (65 expected_list66 == (67 training_diary_page.get_text(LTD.title_name_training),68 training_diary_page.get_text(LTD.repetitions_times_column),69 training_diary_page.get_text(LTD.name_parameters_column),70 training_diary_page.get_text(LTD.column_count_approaches),71 training_diary_page.get_text(LTD.large_chest_decsripion),72 training_diary_page.get_text(LTD.comb_muscle_decription),73 )74 )75def test_my_filtr_exercises(driver):76 """testing the filter of the exercise program"""77 with allure.step(78 "Ðликаем в базе на Ð²ÐºÐ»Ð°Ð´ÐºÑ Ð¿ÑогÑÐ°Ð¼Ð¼Ñ Ð¸ далее на ÐºÐ½Ð¾Ð¿ÐºÑ Ð¿Ð¾Ð´Ð¾Ð±ÑаÑÑ Ð¿ÑогÑÐ°Ð¼Ð¼Ñ "79 ):80 training_diary_page = TrainingDiaryPage(driver, login_accaunt=True)81 training_diary_page.wait_until_not_visible(LTD.other_category_post, timeout=30)82 training_diary_page.click(LTD.tab_programms, LTD.button_choose_program)83 with allure.step(84 "ÐÑбиÑаем даннÑе Ð´Ð»Ñ ÑилÑÑÑаÑии и пÑовеÑÑем ÑезÑлÑÑÐ°Ñ Ð¾ÑобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¿Ð¾Ð¸Ñка"85 ):86 training_diary_page.to_select(LTD.select_gender, "2")87 training_diary_page.to_select(LTD.select_place, "1")88 training_diary_page.to_select(LTD.select_target, "2")89 training_diary_page.to_select(LTD.select_difficulty_level, "1")90 assert " Ðома Ð´Ð»Ñ Ð¼ÑжÑин" == training_diary_page.get_text(LTD.home_for_men)91@pytest.mark.dependency(depends=["create_edit_training"])92def test_delete_record_training(driver):93 """testing deleting a training record"""94 with allure.step("УдалÑем запиÑÑ ÑÑениÑовки в дневнике "):95 training_diary_page = TrainingDiaryPage(driver, login_accaunt=True)96 training_diary_page.wait_until_not_visible(LTD.still_button)97 training_diary_page.click(LTD.still_button, LTD.icon_trash)98 assert "Ðневник ÑÑениÑовок пÑÑÑ" == training_diary_page.get_text(99 LTD.not_is_name_my_training100 )101@pytest.mark.dependency(depends=["create_edit_training"])102def test_delete_my_training(driver):103 """testing deleting my training"""104 with allure.step("УдалÑем наÑÑ ÑÑениÑовкÑ"):105 training_diary_page = TrainingDiaryPage(driver, login_accaunt=True)106 training_diary_page.wait_until_not_visible(LTD.other_category_post, timeout=30)107 training_diary_page.click(LTD.other_category_post)108 training_diary_page.wait_until_not_visible(LTD.my_name_training_category)109 training_diary_page.click(LTD.my_name_training_category)110 training_diary_page.wait_until_not_visible(LTD.still_button)111 training_diary_page.click(LTD.still_button, LTD.editing_parameters_training)112 training_diary_page.scroll_down()113 training_diary_page.click(LTD.delete_my_training, LTD.button_yes_delete)114 training_diary_page.wait_until_not_visible(LTD.other_category_post, timeout=30)115 assert all(116 i.text != "NameTraining (мое)"117 for i in training_diary_page.finds(LTD.my_other_category)...
test_auth.py
Source:test_auth.py
...7@pytest.mark.smoke8def test_auth_with_valid_data(driver, page):9 page.input_field = user_code10 page.enter_button.click()11 page.text_code.wait_until_not_visible()12 assert page.text_code.is_presented()13def test_auth_with_invalid_data(driver, page):14 page.input_field = 'invalid user code'15 page.enter_button.click()16 page.wait_page_loaded()17 assert page.error_code_msg.is_presented()18def test_auth_with_nothing(driver, page):19 page.input_field = ''20 assert page.enter_button.is_clickable() == False21def test_auth_with_whitespaces(driver, page):22 page.input_field = ' '23 assert page.error_whitespaces_msg.is_presented()24def test_auth_with_too_long_phone_number(driver, page):25 page.input_field = '+7123456789012'26 page.enter_button.click()27 page.error_phone_msg.wait_until_not_visible()28 assert page.error_phone_msg.is_presented()29def test_auth_with_special_character(driver, page):30 page.input_field = '@' # or any another special character31 page.error_wrong_char_msg.wait_until_not_visible()32 assert page.error_wrong_char_msg.is_presented()33 assert page.enter_button.is_clickable() == False34def test_auth_with_cyrillic_character(driver, page):35 page.input_field = 'киÑиллиÑеÑие ÑимволÑ'36 page.enter_button.click()37 assert page.error_code_msg.is_presented()38def test_auth_with_china_character(driver, page):39 page.input_field = 'ç©ºæ ¼'40 page.error_wrong_char_msg.wait_until_not_visible()41 assert page.error_wrong_char_msg.is_presented()42 assert page.enter_button.is_clickable() == False43def test_auth_with_string_255(driver, page):44 page.input_field = gen_random_string(255)45 page.enter_button.click()46 assert page.error_code_msg.is_presented()47def test_auth_with_string_over1000(driver, page):48 page.input_field = gen_random_string(1001)49 page.enter_button.click()50 page.error_code_msg.wait_until_not_visible()51 assert page.error_code_msg.is_presented()52@pytest.mark.smoke53def test_registration(driver, page):54 page.input_field = gen_random_string(5) + '@' + gen_random_string(3) + '.com'55 page.enter_button.click()56 page.text_code.wait_until_not_visible()57 assert page.text_code.is_presented()58def test_logout(driver_with_cookies, page):59 if page.coupon_reminder.is_visible():60 page.my_labirint_button.click()61 page.my_labirint_button.move_to_show_submenu()...
base_page.py
Source:base_page.py
...3from src.sel.elements.base_element import BaseElement4class BasePage:5 @allure.step6 def backdrop_dissapears(self):7 BaseElement((By.CSS_SELECTOR, "[class='aui-blanket']")).wait_until_not_visible()8 @allure.step9 def details_loaded(self):10 BaseElement((By.CSS_SELECTOR, "[class='details-layout'] > [class='loading']")).wait_until_not_visible()11 @allure.step12 def get_aui_error(self) -> str:13 return BaseElement((By.CSS_SELECTOR, "[class*='aui-message-error']")).get_value()14 @allure.step15 def get_error(self) -> str:...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!