class CoreFlow(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.maximize_window() self.driver.get("https://insurify.com") self.assertIn( "Insurify® - Official Site: Compare Insurance Quotes with Insurify", self.driver.title) self.homepage = HomePage(self.driver) self.car_make = CarMake(self.driver) self.car_detail = CarDetails(self.driver) self.driver_info = DriverInfo(self.driver) self.discounts = Discounts(self.driver) self.prior_insurance = PriorInsurance(self.driver) self.professional_discount = ProfessionalDiscount(self.driver) self.add_incident = AddIncident(self.driver) self.driver_summary = DriverSummary(self.driver) self.save_quote = SaveQuote(self.driver) self.student_discount = StudentDiscount(self.driver) def test_flow_in_ca_state(self): '''insurify_happy_flow_in_california''' self.homepage.enter_zipcode_and_proceed('90001') self.car_make.select_car() self.car_detail.select_car_details() self.driver_info.enter_driver_info('CA') self.discounts.select_all_discounts() self.prior_insurance.select_prior_insurance('yes', 'Esurance', 'March, 2020', '13') self.student_discount.select_student_options() self.professional_discount.enter_professional_information() self.add_incident.add_incident() self.driver_summary.select_driver_summary_options() self.save_quote.fill_up_save_quote_form('*****@*****.**', '9999999999', '599 Gresham Ave') # def test_flow_in_il_state(self): # '''insurify_happy_flow_in_illinois''' # self.homepage.enter_zipcode_and_proceed('60007') # self.car_make.select_car() # self.car_detail.select_car_details() # self.driver_info.enter_driver_info('IL') # self.discounts.select_all_discounts_except_student() # self.prior_insurance.select_no_prior_insurance() # self.professional_discount.enter_professional_information() # self.add_incident.add_incident() # self.driver_summary.select_driver_summary_options() # self.save_quote.fill_up_save_quote_form('*****@*****.**', '9999999999', '855 Spring Creek Ct Unit A') def tearDown(self): self.driver.close()
def test_login_registered_user(self): user = data.get_user("registered_user") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element('urban-plan-button') login_page = LoginPage(self.driver) self.driver.get("http://localhost:4200/login") login_page.wait_to_load() login_page.logIn(user["cpf"], user["password"]) statement_page = StatementPage(self.driver) statement_page.wait_to_load()
def test_login_unregistered_cpf(self): user = data.get_user("new_unregistered_user") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element('urban-plan-button') login_page = LoginPage(self.driver) self.driver.get("http://localhost:4200/login") login_page.wait_to_load() login_page.setCpf(user['cpf']) cpf_not_found_page = CpfNotFoundPage(self.driver) cpf_not_found_page.wait_to_load() sleep(10)
def test_ponto_a_ponto(self): user = data.get_user("registered_user") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element('urban-plan-button') login_page = LoginPage(self.driver) self.driver.get("http://localhost:4200/login") login_page.wait_to_load() login_page.logIn(user["cpf"], user["password"]) statement_page = StatementPage(self.driver) statement_page.wait_to_load() self.driver.get("http://localhost:4200/ponto-a-ponto") ponto_a_ponto = PontoAPontoPage(self.driver) ponto_a_ponto.wait_to_load() ponto_a_ponto.accept() ponto_a_ponto.check_acceptance()
def test_login_client_no_user(self): car = data.get_vehicle("vehicle_legado") car2 = data.get_vehicle("unregistered_vehicle_2") user = data.get_user("client_with_no_user") card = data.get_card("valid_card") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element('urban-plan-button') login_page = LoginPage(self.driver) self.driver.get("http://localhost:4200/login") login_page.wait_to_load() login_page.set_cpf(user["cpf"]) plaque_page = Plaque(self.driver) plaque_page.wait_for_element("plaque") plaque_page.set_plaque(car["plaque"]) plaque_page.click_element("next-button") tag_page = TagPage(self.driver) tag_page.wait_for_element("adesivo") tag_page.set_tag(car["tag"]) tag_page.click_element("next-button") name_page = Name(self.driver) name_page.wait_for_element("name") name_page.set_name(user["name"]) name_page.click_element("next-button") email_page = Email(self.driver) email_page.wait_for_element("email") email_page.set_email(user["email"]) email_page.click_element("next-button") phone_page = Phone(self.driver) phone_page.wait_for_element("phone") phone_page.set_phone(user["phone"]) phone_page.click_element("next-button") birth_page = BirthDate(self.driver) birth_page.wait_for_element("date") birth_page.set_birthdate(user["birthdate"]) birth_page.click_element("next-button") password_page = Password(self.driver) password_page.wait_for_element("password") password_page.set_password(user["password"]) password_page.click_element("next-button") statement_page = StatementPage(self.driver) statement_page.wait_to_load()
def setUp(self): self.driver = webdriver.Chrome() self.driver.maximize_window() self.driver.get("https://insurify.com") self.assertIn( "Insurify® - Official Site: Compare Insurance Quotes with Insurify", self.driver.title) self.homepage = HomePage(self.driver) self.car_make = CarMake(self.driver) self.car_detail = CarDetails(self.driver) self.driver_info = DriverInfo(self.driver) self.discounts = Discounts(self.driver) self.prior_insurance = PriorInsurance(self.driver) self.professional_discount = ProfessionalDiscount(self.driver) self.add_incident = AddIncident(self.driver) self.driver_summary = DriverSummary(self.driver) self.save_quote = SaveQuote(self.driver) self.student_discount = StudentDiscount(self.driver)
def test_check_order_status(self): user = data.get_user("registered_user") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element('urban-plan-button') login_page = LoginPage(self.driver) self.driver.get("http://localhost:4200/login") login_page.wait_to_load() login_page.logIn(user["cpf"], user["password"]) statement_page = StatementPage(self.driver) statement_page.wait_to_load() self.driver.get("http://localhost:4200/pedidos") orders_page = OrdersPage(self.driver) orders_page.wait_to_load() orders_page.click_order() order_details_page = OrderDetailsPage(self.driver) order_details_page.wait_to_load() order_details_page.check_status()
def test_list_orders(self): user = data.get_user("registered_user") homepage = HomePage(self.driver) homepage.navigate() sleep(3) homepage.navigate_to_login() login_page = LoginPage(self.driver) login_page.wait_to_load() login_page.logIn(user["cpf"], user["password"]) orders_page = OrdersPage(self.driver) orders_page.wait_to_load()
def test_search_by_topic(self): test_search_word = "space" home_page = HomePage(self.driver) home_page.navigate_to_home_page() home_page.search_by_topic(test_search_word) search_page_result = SearchPageResult(self.driver) search_page_result.click_on_image() tags_list = search_page_result.get_tags() assert test_search_word in tags_list
def test_status_delivered(self): user = data.get_user("registered_user") homepage = HomePage(self.driver) homepage.navigate() sleep(3) homepage.navigate_to_login() login_page = LoginPage(self.driver) login_page.wait_to_load() login_page.logIn(user["cpf"], user["password"]) orders_page = OrdersPage(self.driver) orders_page.wait_to_load() orders_page.find_delivered() order_details_page = OrderDetailsPage(self.driver) order_details_page.check_delivered()
def test_shop_new_client(self): car = data.get_vehicle("unregistered_vehicle_1") user = data.get_user("new_unregistered_user") card = data.get_card("valid_card") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element("urban-plan-button") homepage.click_element("urban-plan-button") self.profile(user) self.address(user["address"]) self.vehicle(car) self.payment(card)
def test_second_shop_new_card(self): user = data.get_user("registered_user") car = data.get_vehicle("unregistered_vehicle_5") card = data.get_card("valid_card") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element("urban-plan-button") homepage.click_element("urban-plan-button") cpf_page = Cpf(self.driver) cpf_page.wait_for_element("cpf") cpf_page.set_cpf(user["cpf"]) password_page = Password(self.driver) password_page.wait_for_element("password") password_page.set_password(user["password"]) password_page.click_element("next-button") self.address(user["address"]) self.vehicle(car) summary_page = Summary(self.driver) summary_page.wait_for_element_by_class("meus_planos") sleep(3) summary_page.click_element("next-button") payment_page = Payment(self.driver) payment_page.wait_for_element("card-number") payment_page.click_element("change-card") payment_page.set_card(card) sleep(3) payment_page.click_element("adesao-click") payment_page.click_element("next-button") payment_page.wait_for_element_by_class("image-checked")
def test_shop_registered_client_from_stop(self): user = data.get_user("registered_user") car = data.get_vehicle("unregistered_vehicle_3") card = data.get_card("valid_card") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element("urban-plan-button") homepage.click_element("urban-plan-button") cpf_page = Cpf(self.driver) cpf_page.wait_for_element("cpf") cpf_page.set_cpf(user["cpf"]) password_page = Password(self.driver) password_page.wait_for_element("password") password_page.set_password(user["password"]) password_page.click_element("next-button") self.address(user["address"]) self.vehicle(car) homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("urban-plan-button") homepage.click_element("urban-plan-button") cpf_page = Cpf(self.driver) cpf_page.wait_for_element("cpf") cpf_page.set_cpf(user["cpf"]) password_page = Password(self.driver) password_page.wait_for_element("password") password_page.set_password(user["password"]) password_page.click_element("next-button") self.payment(card)
def test_shop_client_no_user(self): car = data.get_vehicle("vehicle_legado") car2 = data.get_vehicle("unregistered_vehicle_2") user = data.get_user("client_with_no_user") card = data.get_card("valid_card") homepage = HomePage(self.driver) homepage.navigate() homepage.wait_for_element("btn-close") homepage.click_element("btn-close") homepage.wait_for_element("urban-plan-button") homepage.click_element("urban-plan-button") cpf_page = Cpf(self.driver) cpf_page.wait_for_element("cpf") cpf_page.set_cpf(user["cpf"]) plaque_page = Plaque(self.driver) plaque_page.wait_for_element("plaque") plaque_page.set_plaque(car["plaque"]) plaque_page.click_element("next-button") tag_page = TagPage(self.driver) tag_page.wait_for_element("adesivo") tag_page.set_tag(car["tag"]) tag_page.click_element("next-button") name_page = Name(self.driver) name_page.wait_for_element("name") name_page.set_name(user["name"]) name_page.click_element("next-button") email_page = Email(self.driver) email_page.wait_for_element("email") email_page.set_email(user["email"]) email_page.click_element("next-button") phone_page = Phone(self.driver) phone_page.wait_for_element("phone") phone_page.set_phone(user["phone"]) phone_page.click_element("next-button") birth_page = BirthDate(self.driver) birth_page.wait_for_element("date") birth_page.set_birthdate(user["birthdate"]) birth_page.click_element("next-button") password_page = Password(self.driver) password_page.wait_for_element("password") password_page.set_password(user["password"]) password_page.click_element("next-button") self.address(user["address"]) self.vehicle(car2) self.payment(card)