def setup_method(self, method): super().setup_method(method) lp = LoginPage(self.driver) lp.login(page=self.login_url_http, **ADMIN_USER) ap = AdminPage(self.driver, self.ts) ap.open(self.base_url)
def test_admin_shop_count(self): """ Tests that admin user has access to admin API and that admin page shows correct number of shops """ # Check that logged admin user has access to admin api lp = LoginPage(self.driver) lp.login(user='******', password='******', page=self.login_url_http) status_code, content = self.api_get_shop_counts() assert status_code == 200 assert content == {'etsyShops': 1, 'userShops': 1} # Check that admin page displays the shop count value correctly ap = AdminPage(self.driver, self.ts) ap.open(self.base_url) assert ap.etsy_shop_count() == '1'
def to_admin_page(self) -> AdminPage: path = self.driver.find_element_by_xpath( self.ADMIN_ITEM).get_attribute('href') admin_page = AdminPage(self.driver, path=path) admin_page.open() return AdminPage(self.driver, path=path)