def setUp(self) -> None: self.lp = LoginPage() self.lp.driver.get("https://services.empirix.com") self.hp = HomePage() self.lp.enter_username("QA_traininguser30") self.lp.enter_pwd("Empirix!") self.lp.click_signin()
def setUpClass(cls) -> None: cls.lp = LoginPage() cls.lp.driver.get("https://services.empirix.com") cls.hp = HomePage() cls.lp.enter_username("QA_traininguser30") cls.lp.enter_pwd("Empirix!") cls.lp.click_signin()
class HomeTest(unittest.TestCase): def setUp(self) -> None: self.lp = LoginPage() self.lp.driver.get("https://services.empirix.com") self.hp = HomePage() self.lp.enter_username("QA_traininguser30") self.lp.enter_pwd("Empirix!") self.lp.click_signin() def test_all_links(self): self.hp.click_alerts() self.hp.click_dashboard() self.hp.click_notify() self.hp.click_tests() self.hp.click_variables() def tearDown(self) -> None: self.hp.driver.close()
def test_login_valid(self, setup): driver = self.driver login = LoginPage(driver) login.enter_username("Admin") login.enter_password("admin123") login.click_login() homepage = HomePage(driver) homepage.click_welcome_link() time.sleep(5) homepage.click_logout() time.sleep(10)
class LoginPage(BasePage): #locators username_locator = "callback_0" pwd_locator = "callback_1" signin_locator = "callback_2" hp = HomePage() def enter_username(self, username): self.element_sendkeys(username, By.NAME, self.username_locator) def enter_pwd(self, pwd): self.element_sendkeys(pwd, By.NAME, self.pwd_locator) def click_signin(self): self.click_element(By.NAME, self.signin_locator) def do_login(self, username, pwd): self.enter_username(username) self.enter_pwd(pwd) self.click_signin()
def test_search(self): home = HomePage(self.driver) # self.assertTrue(home.is_page_loaded()) assert home.is_page_loaded() is True home.select_video_from_dropdown() home.set_exact_flag("false") home.type_search_request("milf") home.click_submit() result_page = ResultPage(self.driver)
def test_logout(self): driver = self.driver time.sleep(30) # driver.find_element_by_xpath("//*[text()='Logout']").click() hp = HomePage(driver) hp.click_on_logout()
def setUpClass(cls) -> None: cls.lp=LoginPage() cls.lp.driver.get("https://services.empirix.com") cls.hp=HomePage()
def test_logout(self): driver = self.driver time.sleep(5) hp = HomePage(driver) hp.logout_page()