def test_can_add_new_user(): admin = User("admin", "admin") user = User("donald", "123456", "*****@*****.**") (LoginPage().open().login_as(admin).go_to_user_tab().add_new_user( user).table.user_names().should(have.text("donald")))
def test_verify_product_in_cart(driver): home_page = HomePage(driver) home_page.search('alcool em gel') home_page.txt_qty_products_found.should(have.text('produtos encontrados')) assert int(home_page.get_qty_products_returned()) > 0 prod_selected = home_page.detail_product() ProductDetailPage(driver).add_to_cart() prod_title_in_cart = CartPage(driver).get_title_product() assert prod_selected == prod_title_in_cart
def test_rozetka_search(): rozetka = RozetkaMainPage().load_page() sign_page = rozetka.login() sign_page.sign_in() search_results = sign_page.search('moto g') for idx in range(5): search_results.results[idx].should(have.text("Moto G")) user_page = sign_page.load_user_page() user_page.sign_out()
from selene.support.shared import browser from selene.support.conditions import be from selene.support.conditions import have browser.open( 'http://selenium.dunossauro.live/aula_07' ) label = browser.element( '[for="nome"]' ) label.should(have.text('nome')) browser.all( 'input' ).should(have.size(4)).first.type('Duduzin') label.should(have.text('Não vale mentir o nome'))
def test_condition_have_text(): assert have.exact_text("text").expected_text == 'text' assert have.text("t").expected_text == 't'
def test_search_not_found(driver): home_page = HomePage(driver) home_page.search('productnotfound') home_page.get_prod_not_found_text().should(have.text('não encontrou resultado algum :('))
def test_can_add_new_user(): (LoginPage().open().login_as(User( name="admin", password="******")).go_to_users_tab().add_new_user( User(name="Mike", password="******", email="*****@*****.**")).table.user_names().should( have.text("Mike")))
def should_have(self, product: Product): self.name.should(have.text( product.name.split()[0])) # In case of shortened name in menu self.price.should(have.exact_text(product.price)) return self
def test_rambler_search2(): google = GooglePage().open() search = google.search("selene2") search.results[0].should( have.text( "In Greek mythology, Selene is the goddess of the moon")) # :D
def test_no_name_job(): MainPage()._add_button.click() MainPage().allert.should(have.text('Job name cannot be empty')) MainPage().jobs_list.should(have.size(0)) time.sleep(2)
def __accept_import(message): __import_button.click() __success_dialog_icon.should_be(be.visible, timeout=20) __status_message.should(have.text(message)) __import_continue_btn.click()
def __select_import_type(import_type): element(by_xpath(__import_format_pattern.format(IMPORT_TYPES[import_type]))).click() __file_type_label.should(have.text(IMPORT_TYPES_MESSAGE[import_type]))
def see_user_name(context, msg): context.page.get_text_after_search().should(have.text(msg))
def check_popup_message(message, timeout=None): __popup_message.should(have.text(message), timeout=timeout) __popup_message.should_not(be.visible)
def step_impl3(driver): home_page = HomePage(driver) home_page.txt_qty_products_found.wait_until(be.visible) home_page.txt_qty_products_found.should(have.text('produtos encontrados')) assert int(home_page.get_qty_products_returned()) > 0
def test_admin_can_login(): admin = User("tomsmith", "SuperSecretPassword!") LoginPage() \ .open() \ .login_as(admin) \ .logo.should_have(text("Secure Area"))
def select_by_text(self, text): self._options().element_by(have.text(text)).click()
def test_admin_can_login(): (LoginPage().open().login_as(User(name="admin", password="******")).logo.should_have( text("Video service")))