Esempio n. 1
0
 def fill_new_banner_popup(self, **kwargs):
     if kwargs.get('supplier'):
         self.combo_supplier().select(kwargs.get('supplier'))
     if kwargs.get('validity'):
         self.combo_validity().select(kwargs.get('validity'))
     if kwargs.get('initial_date'):
         self.input_initial_date().with_(Config(
             set_value_by_js=True)).set_value(kwargs.get('initial_date'))
     if kwargs.get('validity') == 'Personalizado':
         self.input_end_date().with_(
             Config(set_value_by_js=True)).set_value(kwargs.get('end_date'))
     if kwargs.get('action_audience'):
         self.combo_action_audience().select(kwargs.get('action_audience'))
         if kwargs.get('action_audience') == 'Subir lista':
             self.upload_stores()
Esempio n. 2
0
    def wait_to(self, webdriver_condition, timeout=None, polling=None):
        warnings.warn(
            'use browser.should instead of browser.wait_to or wait_to',
            DeprecationWarning)
        tuned_self = self if timeout is None else self.with_(
            Config(timeout=timeout))

        return tuned_self.should(webdriver_condition)
Esempio n. 3
0
 def select(self, value, partial_text: bool = False):
     assert self.combo.with_(Config(timeout=20)).wait_until(be.clickable)
     if value and value != self.get_value_selected():
         self.combo.click()
         time.sleep(0.3)
         assert self.options().with_(Config(timeout=15)).wait_until(
             have.size_greater_than(0))
         if isinstance(value, int):
             self.select_option_by_index(value)
         elif isinstance(value, str):
             if partial_text:
                 self.select_option_by_partial_text(value)
             else:
                 self.select_option_by_text(value)
         else:
             raise ValueError(
                 f"Type not implemented for combobox item: {value}")
Esempio n. 4
0
def should(webdriver_condition, timeout=None, polling=None):
    warnings.warn(
        'selene.browser.should is deprecated, '
        'use `from selene.support.shared import browser` import',
        DeprecationWarning)
    tuned_browser = browser if timeout is None else browser.with_(
        Config(timeout=timeout))

    return tuned_browser.should(webdriver_condition)
Esempio n. 5
0
 def close_by_text(self, text, timeout=3):
     self.list_msg.with_(Config(timeout=timeout)).wait_until(
         have.size_greater_than(0))
     for msg in self.list_msg:
         if msg.s("./*").get_attribute('innerText').__contains__(text):
             btn_close = msg.s(
                 "./descendant::a[contains(@class, 'ant-notification-notice-close')]"
             )
             btn_close.click()
Esempio n. 6
0
 def access_btn_by_text(self, btn_title):
     if btn_title == 'Novo banner de fornecedor':
         self.btn_supplier_banner.click()
         self.modal.wait_modal_title_presented(btn_title)
     else:
         btn = self.get_elem_by_text(btn_title).s('./..')
         assert btn.with_(Config(timeout=12)).wait_until(be.clickable)
         btn.click()
         if btn_title == 'Novo banner de simulador de margem':
             self.modal.wait_modal_title_presented(btn_title)
Esempio n. 7
0
def wait_to(webdriver_condition, timeout=None, polling=None):
    warnings.warn(
        'selene.browser.wait_to is deprecated, '
        'use `from selene.support.shared import browser` import, '
        'and also use browser.should style',
        DeprecationWarning,
    )
    tuned_browser = (browser if timeout is None else browser.with_(
        Config(timeout=timeout)))

    return tuned_browser.should(webdriver_condition)
Esempio n. 8
0
 def get_banner_request_list(self):
     banners = self.get_elem_by_text('Solicitações de banner').ss("./../div")
     banners.with_(Config(timeout=12)).wait_until(have.size_greater_than(0))
     return banners
Esempio n. 9
0
 def get_prod_not_found_text(self):
     self._txt_products_not_found.with_(Config(timeout=15)).wait_until(
         be.visible)
     return self._txt_products_not_found
Esempio n. 10
0
 def wait_products_presented(self, timeout=20):
     self.first_prod.with_(Config(timeout=timeout)).wait_until(be.clickable)
Esempio n. 11
0
 def verify_msg(self, msg_txt, timeout=7, throw_exc=False):
     if self.is_visible(timeout):
         assert self.last_msg().with_(Config(timeout=timeout)).wait_until(
             have.attribute('innerText').value_containing(msg_txt))
     elif throw_exc:
         raise ValueError("Toast not presented")
Esempio n. 12
0
 def is_visible(self, timeout=3):
     return self.last_msg().with_(Config(timeout=timeout)).wait_until(
         be.visible)