class TestIndexPage: @pytest.fixture(scope="function", autouse=True) def setup(self, browser): self.browser = browser self.index_page = IndexPage(self.browser, INDEXPAGE_URL) self.index_page.open() def test_open_index_page(self): self.index_page.is_it_index_page() def test_authorized_user_can_see_login_link(self): self.index_page.should_contain_login_link() def test_authorized_user_press_login_link(self): self.index_page.go_to_login_page() login_page = LoginPage(self.browser, self.browser.current_url) login_page.is_it_login_page() def test_authorized_user_can_see_registration_link(self): self.index_page.should_contain_registration_link() def test_authorized_user_press_registration_link(self): self.index_page.go_to_registration_page() registration_page = RegistrationPage(self.browser, self.browser.current_url) registration_page.is_it_registration_page() def test_authorized_user_can_not_see_create_post_button(self): self.index_page.should_not_contain_create_post_button() def test_authorized_user_can_not_see_create_test_button(self): self.index_page.should_not_contain_create_test_button()
class TestIndexPage: @pytest.fixture(scope="function", autouse=True) def setup(self, browser): self.browser = browser self.index_page = IndexPage(self.browser, INDEXPAGE_URL) self.index_page.open() def test_open_index_page(self): self.index_page.is_it_eng_index_page() def test_info_bar_end(self): self.index_page.info_bar_eng() def test_info_bar_eng_rus_eng(self): self.index_page.click_language_button() self.index_page.click_rus_lang() self.index_page.click_language_button() self.index_page.click_eng_lang() self.index_page.info_bar_eng() def test_click_change_language_button(self): self.index_page.click_language_button() self.index_page.is_lang_buttons_presented() def test_change_to_rus_lang(self): self.index_page.click_language_button() self.index_page.click_rus_lang() self.index_page.is_it_rus_index_page() def test_info_bar_rus(self): self.index_page.click_language_button() self.index_page.click_rus_lang() self.index_page.info_bar_rus() def test_table_header_eng(self): self.index_page.table_header_eng() def test_table_header_rus(self): self.index_page.click_language_button() self.index_page.click_rus_lang() self.index_page.table_header_rus() def test_total_market_eng(self): self.index_page.total_market_eng() def test_total_market_rus(self): self.index_page.click_language_button() self.index_page.click_rus_lang() self.index_page.total_market_rus() def test_table_row_eng(self): self.index_page.table_row_eng() def test_table_row_rus(self): self.index_page.click_language_button() self.index_page.click_rus_lang() self.index_page.table_row_rus()
class Application: def __init__(self): self.driver = webdriver.Chrome() self.index_page = IndexPage(self.driver) self.product_page = ProductPage(self.driver) self.checkout_page = CheckoutPage(self.driver) def quit(self): self.driver.quit() def check_cart(self): self.index_page.open() self.index_page.open_product(self.index_page.product_element) self.product_page.check_size() self.product_page.add_to_cart() self.product_page.wait_cart() self.checkout_page.open() self.checkout_page.delete_by_one_item( self.checkout_page.quantity_count) self.quit()
def test_refresh(driver): index_page = IndexPage(driver) index_page.open() driver.refresh() assert index_page.logoutPresence(10)
def test_auth_correct(driver): index_page = IndexPage(driver) index_page.open() index_page.login("admin", "qwerty") assert index_page.logoutPresence(120)
def test_auth_incorrect(driver): index_page = IndexPage(driver) index_page.open() index_page.login("admin", "dsfsdf") assert not index_page.logoutPresence(10)
def test_title(driver): index_page = IndexPage(driver) index_page.open() assert index_page.isIndexPage()