class IMDGNegativeLoginTest(IMDGBaseTest): def setUp(self): super().setUp() def test_001_login_with_wrong_password(self): # Instantiate an object of LoginPage class. When the constructor of LoginPage # is called, it opens up the browser and navigates to Login Page of IMDA iCheck # then login using provided credential but with wrong password self.loginPage = LoginPage(self.driver) self.loginPage.login_wrong_password() #Asserting the Login alert is visible and its text self.assertTrue(self.loginPage.is_visible(Locators.LOGIN_ALERT)) self.assertTrue( self.loginPage.assert_element_text(Locators.LOGIN_ALERT, TestData.LOGIN_ALERT_TEXT)) def test_002_login_with_not_existed_user(self): # Instantiate an object of LoginPage class. When the constructor of LoginPage # is called, it opens up the browser and navigates to Login Page of IMDA iCheck # then login using non existing credential but with wrong password self.loginPage = LoginPage(self.driver) self.loginPage.login_wrong_user() # Asserting the Login alert is visible and its text self.assertTrue(self.loginPage.is_visible(Locators.LOGIN_ALERT)) self.assertFalse( self.loginPage.assert_element_text(Locators.LOGIN_ALERT, TestData.LOGIN_ALERT_TEXT))
class IMDGLoginTest(IMDGBaseTest): def setUp(self): super().setUp() def test_001_login_with_correct_credential(self): #Instantiate an object of LoginPage class. When the constructor of LoginPage #is called, it opens up the browser and navigates to Login Page of IMDA iCheck #then login using provided credential self.loginPage = LoginPage(self.driver) self.loginPage.login() #Assert that redirect to Home page with Extract name is visible at the page self.assertTrue(self.loginPage.is_visible(Locators.APP_NAME)) @unittest.skip("Not first time login") def test_002a_first_time_login_then_logout(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() # Asserting that claim application list is not present self.homePage = HomePage(self.loginPage.driver) self.assertFalse(self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2)) self.homePage.logout() #Asserting redirection to Login page with Login button is visible self.assertTrue(self.homePage.is_visible(Locators.LOGIN_PAGE_TITLE)) def test_002b_login_then_logout(self): self.loginPage = LoginPage(self.driver) self.loginPage.login() self.homePage = HomePage(self.loginPage.driver) self.assertTrue(self.homePage.is_clickable(Locators.CLAIM_APPLICATION_ROW_2)) self.homePage.logout() #Asserting redirection to Login page with Login button is visible self.assertTrue(self.homePage.is_visible(Locators.LOGIN_PAGE_TITLE)) def test_003_login_with_wrong_password(self): # Instantiate an object of LoginPage class. When the constructor of LoginPage # is called, it opens up the browser and navigates to Login Page of IMDA iCheck # then login using provided credential but with wrong password self.loginPage = LoginPage(self.driver) self.loginPage.login_wrong_password() #Asserting the Login alert is visible and its text self.assertTrue(self.loginPage.is_visible(Locators.LOGIN_ALERT)) self.assertTrue(self.loginPage.assert_element_text(Locators.LOGIN_ALERT, TestData.LOGIN_ALERT_TEXT)) def test_004_login_with_not_existed_user(self): # Instantiate an object of LoginPage class. When the constructor of LoginPage # is called, it opens up the browser and navigates to Login Page of IMDA iCheck # then login using non existing credential but with wrong password self.loginPage = LoginPage(self.driver) self.loginPage.login_wrong_user() # Asserting the Login alert is visible and its text self.assertTrue(self.loginPage.is_visible(Locators.LOGIN_ALERT)) self.assertTrue(self.loginPage.assert_element_text(Locators.LOGIN_ALERT, TestData.LOGIN_ALERT_TEXT))