def login_user(self, password): if App.is_exist(self, NewsScreen.signOutButton): App.click(self, NewsScreen.signOutButton) App.wait_until_disappear(self, NewsScreen.Loading) App.click(self, NewsScreen.loginButton) if password == "valid password": App.send_keys(self, LoginScreen.inputField1, CONST.login['PASSWORD']) if password == "invalid password": App.send_keys(self, LoginScreen.inputField1, CONST.login['INVALID PASSWORD']) else: App.click(self, NewsScreen.loginButton) if App.is_exist(self, LoginScreen.inputField2): App.send_keys(self, LoginScreen.inputField1, CONST.login['USERNAME']) if password == "valid password": App.send_keys(self, LoginScreen.inputField2, CONST.login['PASSWORD']) if password == "invalid password": App.send_keys(self, LoginScreen.inputField2, CONST.login['INVALID PASSWORD']) else: if password == "valid password": App.send_keys(self, LoginScreen.inputField1, CONST.login['PASSWORD']) if password == "invalid password": App.send_keys(self, LoginScreen.inputField1, CONST.login['INVALID PASSWORD']) App.click(self, LoginScreen.loginButton)
def test_login(self): App.click(self, HomeScreen.loginMenu) App.send_keys(self, LoginScreen.inputField, "*****@*****.**") App.send_keys(self, LoginScreen.passwordField, "password", index=0) App.tap(self, LoginScreen.inputField)