Best Python code snippet using selene_python
configuration.py
Source: configuration.py
...72 @property73 def base_url(self) -> str:74 return self._base_url75 @property76 def set_value_by_js(self) -> bool:77 return self._set_value_by_js78 @property79 def type_by_js(self) -> bool:80 return self._type_by_js81 @property82 def wait_for_no_overlap_found_by_js(self) -> bool:83 return self._wait_for_no_overlap_found_by_js84 @property85 def window_width(self) -> Optional[int]:86 return self._window_width87 @property88 def window_height(self) -> Optional[int]:89 return self._window_height90 @property...
banner_home_page.py
Source: banner_home_page.py
1import os2from selene import Browser3from selene.api import s4from selene.core.configuration import Config5from selene.support.conditions import be6from tests.backoffice.web.pages.backoffice_page import BackofficeBasePage7from tests.backoffice.web.pages.component.combobox import ComboBox8from tests.backoffice.web.support.enuns.filepath_enum import FilePath9class BannerHome(BackofficeBasePage):10 def __init__(self, app: Browser):11 super().__init__(app)12 self.btn_supplier_banner = s('#supplier-banner-modal')13 self.card_new_banner_repository = s('#NewBannerCard')14 def access_btn_by_text(self, btn_title):15 if btn_title == 'Novo banner de fornecedor':16 self.btn_supplier_banner.click()17 self.modal.wait_modal_title_presented(btn_title)18 else:19 btn = self.get_elem_by_text(btn_title).s('./..')20 assert btn.with_(Config(timeout=12)).wait_until(be.clickable)21 btn.click()22 if btn_title == 'Novo banner de simulador de margem':23 self.modal.wait_modal_title_presented(btn_title)24 def combo_supplier(self):25 combo = self.modal.combo_by_title('Fornecedor')26 return ComboBox(combo)27 def combo_validity(self):28 combo = self.modal.combo_by_title('PerÃodo de vigência')29 return ComboBox(combo)30 def combo_action_audience(self):31 combo = self.modal.combo_by_title('Público da ação')32 return ComboBox(combo)33 def input_initial_date(self):34 return self.modal.content.s(35 "./descendant::*[text()='Data de inÃcio']/../following-sibling::*/descendant::input")36 def input_end_date(self):37 return self.modal.content.s(38 "./descendant::*[text()='Data de término']/../following-sibling::*/descendant::input")39 def fill_new_banner_popup(self, **kwargs):40 if kwargs.get('supplier'):41 self.combo_supplier().select(kwargs.get('supplier'))42 if kwargs.get('validity'):43 self.combo_validity().select(kwargs.get('validity'))44 if kwargs.get('initial_date'):45 self.input_initial_date().with_(Config(46 set_value_by_js=True)).set_value(kwargs.get('initial_date'))47 if kwargs.get('validity') == 'Personalizado':48 self.input_end_date().with_(Config(49 set_value_by_js=True)).set_value(kwargs.get('end_date'))50 if kwargs.get('action_audience'):51 self.combo_action_audience().select(kwargs.get('action_audience'))52 if kwargs.get('action_audience') == 'Subir lista':53 self.upload_stores()54 def upload_stores(self):55 self.modal.btn_by_title('SUBIR LISTA DE LOJAS').click()56 upload_area_selector = self.modal.content.s("./descendant::input[@type='file']")57 upload_area_selector.type(os.path.abspath(FilePath.STORES.value))58 upload_stores_list_tags = self.modal.content.s("//*[contains(@class, 'UploadTags_fileIte')]")59 assert upload_stores_list_tags.wait_until(be.clickable)60 self.modal.confirm()61 def combo_repository(self, label):62 combo = self.get_combo_by_label(label, self.card_new_banner_repository)63 return ComboBox(combo)64 def input_repository(self, label):...
Check out the latest blogs from LambdaTest on this topic:
There are times when developers get stuck with a problem that has to do with version changes. Trying to run the code or test without upgrading the package can result in unexpected errors.
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
Web applications continue to evolve at an unbelievable pace, and the architecture surrounding web apps get more complicated all of the time. With the growth in complexity of the web application and the development process, web application testing also needs to keep pace with the ever-changing demands.
“Test frequently and early.” If you’ve been following my testing agenda, you’re probably sick of hearing me repeat that. However, it is making sense that if your tests detect an issue soon after it occurs, it will be easier to resolve. This is one of the guiding concepts that makes continuous integration such an effective method. I’ve encountered several teams who have a lot of automated tests but don’t use them as part of a continuous integration approach. There are frequently various reasons why the team believes these tests cannot be used with continuous integration. Perhaps the tests take too long to run, or they are not dependable enough to provide correct results on their own, necessitating human interpretation.
Hey LambdaTesters! We’ve got something special for you this week. ????
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!!