Пример #1
0
 def test_cart_attribute_redirect(self):
     card = CardPage(self.driver)
     self.driver.get(TEST_URL +
                     project_page.get('product_card_with_offers'))
     link = card.get_link_first_attribute_value
     card.click_first_attribute_value()
     assert self.driver.current_url == link
Пример #2
0
 def test_cart_in_header_add_from_card(self):
     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()
     assert card.check_present_button_in_cart
     assert '1' == header_cart.text_digit_cart_header
     assert header_cart.text_cart_price in card.text_price
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 def __init__(self, base_url, headless):
     setup("INFO")
     logger.setLevel("INFO")
     driver_path = ChromeDriverManager().install()
     options = Options()
     if headless:
         options.add_argument("--headless")
     self.wd = webdriver.Chrome(driver_path, options=options)
     self.base_url = base_url
     self.login_page = LoginPage(self)
     self.main_page = MainPage(self)
     self.deposit_page = DepositsPage(self)
     self.card_page = CardPage(self)
     self.fake_data = FakeData.lets_random_bitchas()
     self.taxes_page = TaxesPage(self)
     self.payment_page = PaymentPage(self)
     self.event_page = EventPage(self)
Пример #6
0
 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()
Пример #7
0
 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
Пример #8
0
 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)
Пример #9
0
 def test_cart_in_header_add_from_card_offers(self):
     header_cart = HeaderPage(self.driver)
     card = CardPage(self.driver)
     self.driver.get(TEST_URL +
                     project_page.get('product_card_with_offers'))
     prices = card.list_text_first_offers_price
     for i, buy_button in enumerate(card.get_first_offers_buy_button):
         buy_button.click()
         assert header_cart.check_text_digit_cart_header(str(i + 1))
     assert card.amount_first_offers == card.amount_offers_button_in_cart
     format_price_for_header_cart = str(
         sum(list(map(lambda el: int(el[:-3]), prices)))) + prices[0][-4:]
     assert format_price_for_header_cart == header_cart.text_cart_price
Пример #10
0
 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
Пример #11
0
    def tap_answer_cell(self) -> AnswerCellPage:
        from pages.card_page import CardPage
        from pages.answer_cell_page import AnswerCellPage

        AnswerCellPage().tap()
        return CardPage()
Пример #12
0
def test_product_card(browser):
    CardPage(browser).check_elements_exist()
    CardPage(browser).add_to_cart()
Пример #13
0
class Application:
    """
    Класс  приложения - APP
    """

    @allure.step("Инициализация класса APP")
    def __init__(self, base_url, headless):
        setup("INFO")
        logger.setLevel("INFO")
        driver_path = ChromeDriverManager().install()
        options = Options()
        if headless:
            options.add_argument("--headless")
        self.wd = webdriver.Chrome(driver_path, options=options)
        self.base_url = base_url
        self.login_page = LoginPage(self)
        self.main_page = MainPage(self)
        self.deposit_page = DepositsPage(self)
        self.card_page = CardPage(self)
        self.fake_data = FakeData.lets_random_bitchas()
        self.taxes_page = TaxesPage(self)
        self.payment_page = PaymentPage(self)
        self.event_page = EventPage(self)

    @allure.step("Открытие страницы авторизации")
    def open_login_page(self) -> None:
        """Открытие страницы авторизации."""
        logger.info("Открытие страницы авторизации")
        self.wd.get(self.base_url)
        logger.info("Текущий URL - " + self.wd.current_url)

    @allure.step("Открытие главной страницы")
    def open_main_page(self) -> None:
        """Открытие главной страницы."""
        logger.info("Открытие главной страницы")
        self.wd.get((self.base_url + "/welcome"))
        logger.info("Текущий URL - " + self.wd.current_url)

    @allure.step("Закрытие браузера")
    def teardown(self) -> WebDriver:
        """Закрытие браузера."""
        logger.info("Закрытие браузера")
        return self.wd.quit()

    @allure.step("Создание депозита в долларах со свободным сроком")
    def open_free_term_usd_deposit(self, test_data: Any, check=False) -> None:
        """Создание депозита в долларах со свободным сроком"""
        logger.info("Создание депозита в долларах со свободным сроком")
        self.open_main_page()
        self.main_page.click_on_deposits()
        self.deposit_page.click_open_deposit()
        self.deposit_page.choose_usd()
        self.deposit_page.choose_free_term()
        self.deposit_page.choose_demo_2_deposit()
        self.deposit_page.input_to_amount_field(test_data)
        if check:
            self.deposit_page.text_of_percent_of_deposit()
        self.deposit_page.choose_end_date()
        self.deposit_page.click_next_button()

    @allure.step("Переход на страницу 'Добавление карты другого банка' ")
    def add_other_bank_card_page(self):
        self.open_main_page()
        self.main_page.click_on_cards_button()
        self.card_page.click_on_other_bank_card()
Пример #14
0
 def tap(self) -> CardPage:
     from pages.card_page import CardPage
     self._cell.click()
     return CardPage()
Пример #15
0
    def tap_speaker_button(self) -> CardPage:
        from pages.card_page import CardPage

        self._sheet.find_element_by_name("Speaker").click()
        return CardPage()
Пример #16
0
    def tap_default_button(self) -> CardPage:
        from pages.card_page import CardPage

        self._sheet.find_element_by_name("Default").click()
        return CardPage()