Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- from uaprom.tests.se.test_case import WebDriverTestCase
- from uaprom.tests.se.services import fake
- from uaprom.tests.se.purchase.urls import sign_in_url, secure_url, case_url
- from uaprom.tests.se.elements.base import (
- wait_for_page_loaded,
- wait_for_ajax,
- wait_for_animation,
- scroll_to_element
- )
- from uaprom.tests.se.state.user import UserFactory
- from uaprom.tests.se.state.purchase.create_access_item import AccessItemFactory
- from uaprom.tests.se.state.purchase.employee import EmployeeFactory
- from uaprom.tests.se.state.purchase.merchant import MerchantFactory
- from uaprom.tests.se.state.purchase.merchant_group import MerchantGroupFactory
- from uaprom.tests.se.training_test.pages.company_profile import CompanyProfile
- class TestProfileComapny(WebDriverTestCase):
- def test_company_profile_validation(self):
- user = UserFactory.create_user()
- employee = EmployeeFactory.create_employee(user)
- merchant_group = MerchantGroupFactory.create_merchant_group()
- merchant = MerchantFactory.create_merchant(
- merchant_group,
- employee,
- merchant_type=1,
- state_merchant=False,
- verified=False
- )
- AccessItemFactory.create_access_item_for_merchant(employee, merchant)
- AccessItemFactory.create_access_item_for_merchant_group(
- employee, merchant_group
- )
- url = sign_in_url(user.id)
- self.driver.get(url)
- company_profile = CompanyProfile(self.driver)
- self.driver.get(company_profile.url)
- company_profile.company_profile_block.edit_icon.click()
- company_profile.company_profile_popup.close_popup_button.click()
- company_profile.company_profile_popup.close_popup_button.wait_to_disappear()
- company_profile.company_profile_block.edit_icon.click()
- company_profile.company_profile_popup.wait_to_display()
- company_profile.company_profile_popup.name_input.clear()
- company_profile.company_profile_popup.name_en_input.clear()
- company_profile.company_profile_popup.srn_input.clear()
- company_profile.company_profile_popup.web_site_input.clear()
- company_profile.company_profile_popup.web_site_input.send_keys("3123123")
- company_profile.company_profile_popup.phone_input.clear()
- company_profile.company_profile_popup.phone_input.send_keys("+3806546546546546")
- company_profile.company_profile_popup.zip_code.clear()
- company_profile.company_profile_popup.city_name_input.clear()
- company_profile.company_profile_popup.company_adress_input.clear()
- company_profile.company_profile_popup.submit_button.click()
- self.soft_assert_equals(
- company_profile.company_profile_popup.name_error_alert.text,
- u"Це поле обов'язкове",
- "No name alert present"
- )
- self.soft_assert_equals(
- company_profile.company_profile_popup.name_en_error.text,
- u"Це поле обов'язкове",
- "No en_name alert present"
- )
- self.soft_assert_equals(
- company_profile.company_profile_popup.srn_error_alert.text,
- u"Це поле обов'язкове",
- "No srn alert present"
- )
- self.soft_assert_equals(
- company_profile.company_profile_popup.phone_error_alert.text,
- u"Телефон повинен складатися не менше 5 і не більше 15 символів",
- "No phone alert present"
- )
- self.soft_assert_equals(
- company_profile.company_profile_popup.zip_error_alert.text,
- u"Це поле обов'язкове",
- "No zip_code alert present"
- )
- self.soft_assert_equals(
- company_profile.company_profile_popup.address_error_alert.text,
- u"Це поле обов'язкове",
- "No adress alert present"
- )
- self.soft_assert_equals_text_with_ignore_spaces_and_register(
- company_profile.company_profile_popup.url_error_alert.text,
- u"Невірний URL",
- "No url alert present"
- )
- def test_company_profile(self):
- user = UserFactory.create_user()
- employee = EmployeeFactory.create_employee(user)
- merchant_group = MerchantGroupFactory.create_merchant_group()
- merchant = MerchantFactory.create_merchant(
- merchant_group,
- employee,
- merchant_type=1,
- state_merchant=False,
- verified=False
- )
- AccessItemFactory.create_access_item_for_merchant(employee, merchant)
- AccessItemFactory.create_access_item_for_merchant_group(
- employee, merchant_group
- )
- url = sign_in_url(user.id)
- self.driver.get(url)
- company_profile = CompanyProfile(self.driver)
- self.driver.get(company_profile.url)
- company_profile.company_profile_block.edit_icon.click()
- company_profile.company_profile_popup.wait_to_display()
- company_profile.company_profile_popup.name_input.clear()
- company_profile.company_profile_popup.name_input.send_keys(fake.name())
- company_profile.company_profile_popup.name_en_input.clear()
- company_profile.company_profile_popup.name_en_input.send_keys(fake.name())
- company_profile.company_profile_popup.srn_input.send_keys("123456789101213")
- company_profile.company_profile_popup.ownership_dropdown.select_random_options()
- company_profile.company_profile_popup.web_site_input.send_keys(fake.url())
- company_profile.company_profile_popup.phone_input.clear()
- company_profile.company_profile_popup.phone_input.send_keys(fake.phone_number())
- company_profile.company_profile_popup.more_phones_link.click()
- company_profile.company_profile_popup.second_phone_number.clear()
- company_profile.company_profile_popup.second_phone_number.send_keys(fake.phone_number())
- company_profile.company_profile_popup.third_phone_number.clear()
- company_profile.company_profile_popup.third_phone_number.send_keys(fake.phone_number())
- company_profile.company_profile_popup.fourth_phone_number.clear()
- company_profile.company_profile_popup.fourth_phone_number.send_keys(fake.phone_number())
- company_profile.company_profile_popup.fifth_phone_number.clear()
- company_profile.company_profile_popup.fifth_phone_number.send_keys(fake.phone_number())
- company_profile.company_profile_popup.country_dropdown.select_random_options()
- company_profile.company_profile_popup.country_dropdown.select_option_by_text(u"Украина")
- company_profile.company_profile_popup.zip_code.send_keys("123456")
- if len(company_profile.company_profile_popup.zip_code.text) > 6:
- self.soft_assert_equals(
- company_profile.company_profile_popup.zip_error_alert.text,
- u"Поле не может содержать больше 6 символов.",
- "Not zip_error alert present"
- )
- company_profile.company_profile_popup.location_dropdown.select_random_options()
- company_profile.company_profile_popup.city_name_input.clear()
- company_profile.company_profile_popup.city_name_input.send_keys(fake.name())
- company_profile.company_profile_popup.company_adress_input.clear()
- company_profile.company_profile_popup.company_adress_input.send_keys(fake.name())
- company_profile.company_profile_popup.physic_adress_dropdown.select_random_options()
- company_profile.company_profile_popup.physic_zip_code_input.clear()
- company_profile.company_profile_popup.physic_zip_code_input.send_keys("123456")
- company_profile.company_profile_popup.physic_city_name_input.clear()
- company_profile.company_profile_popup.physic_city_name_input.send_keys(fake.name())
- company_profile.company_profile_popup.physic_company_adress_input.clear()
- company_profile.company_profile_popup.physic_company_adress_input.send_keys(fake.name())
- company_profile.company_profile_popup.add_file_button.upload_file()
- company_profile.company_profile_popup.submit_button.click()
- self.soft_assert_equals(
- company_profile.company_profile_block.merchant_profile.text,
- u"Структура компанії",
- "Company profile doesn't save"
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement