class TestLogin(unittest.TestCase): @pytest.fixture(autouse=True) def class_setup(self, one_time_set_up): self.hp = HomePage(self.driver) @pytest.mark.run(order=2) # @pytest.mark.skip def test_valid_login(self): # Home page self.hp.login('*****@*****.**', 'coding*016') # verify title # title_result = self.hp.verify_title() # assert title_result == True # verify success login login_result = self.hp.verify_login_success() assert login_result == True @pytest.mark.run(order=1) def test_invalid_login(self): self.hp.login('*****@*****.**', 'testtest') result = self.hp.verify_login_fail() assert result == True
def test_valid_login(self): url = "https://courses.letskodeit.com" driver = webdriver.Chrome() driver.maximize_window() driver.get(url=url) lp = HomePage(driver) lp.login("*****@*****.**", "brownwindow*03") # sign_in_link = driver.find_element(By.XPATH, "//a[text()='Sign In']") # sign_in_link.click() # # email_id = driver.find_element(By.ID, "email") # email_id.send_keys("*****@*****.**") # # password = driver.find_element(By.ID, "password") # password.send_keys("brownwindow*03") # # login_button = driver.find_element(By.XPATH, "//input[@value='Login']") # login_button.click() image_home = driver.find_element(By.XPATH, "//img[@class='img-fluid']") if image_home is not None: print("test successful") else: print("test failed")