Hello to everyone
I am testing an identification form to login on the web site I am working on. A strange “error” occurs during the process. I want to understand why this occurs and how to fix it.
There is simple and clean (as possible) explanation of what I want to achieve:
•set wrong identification to the fields of mail and password
•submit them by clicking on the submit button
•verify I am still on the identification page and that an error message appears
This test is only a part of all the script, before doing this I am testing different thing on fields like is a string accepted when it is not a valid mail address or what is happening when I enter an empty string to the fields.
Beside when I reach this particular point my test failed. Actually the test is still on the identification page, I am checking it with the title of the page, but no trace of the error message I am expecting for.
In the log the click on submit button is marked as passed but when I am watching the test processing, the page doesn’t seem to react to it. No loading sign nor moving, nothing
I remarked that if I manually click on the button, the test was passing through this difficulty. Then I add a second click command in my script, it fixes but it is not an acceptable solution (I think or at least use doubleClick
maybe?)
I have also tried to blur the last field I am interacting with before clicking on the submit button and it helped but as it is a process I am using in other test and where the error doesn’t occur I feel strange to add this command for this particular case…
I’ve tried delay
but as I said, there no move on the page so it doesn’t work, there is nothing to wait for. I’ve read topic on waitForPageLoad
, I don’t think it will help either but after all I don’t know and I am looking for solution. What is your point of view on this situation? In advance thank for your answer
Here follows my code (the part with error is near to the end, the code is a bit long sorry):
//création de l'objet de test: champ de texte identifiant
TestObject fieldset_mail = new TestObject('champ de texte identifiant')
fieldset_mail.addProperty('xpath', ConditionType.EQUALS, '//input[@id=\'dbkz\']')
//création de l'objet de test: message erreur mail manquant
TestObject err_msg_mail_requis = new TestObject('message erreur mail requis')
err_msg_mail_requis.addProperty('xpath', ConditionType.EQUALS, '//div[@id=\'advice-required-dbkz\']')
//création de l'objet de test: message erreur mail invalide
TestObject err_msg_mail_invalide = new TestObject('message erreur mail invalide')
err_msg_mail_invalide.addProperty('xpath', ConditionType.EQUALS, '//div[@id=\'advice-validate-email-dbkz\']')
//création de l'objet de test: champ de texte mot de passe
TestObject fieldset_pswd = new TestObject('champ de texte mot de passe')
fieldset_pswd.addProperty('xpath', ConditionType.EQUALS, '//input[@id=\'pswd\']')
//création de l'objet de test: message erreur mot de passe absent
TestObject err_msg_pswd = new TestObject('message erreur mot de passe absent')
err_msg_pswd.addProperty('xpath', ConditionType.EQUALS, '//div[@id=\'advice-required-pswd\']')
//création de l'ojet de test: case à cocher enregistrer la connexion
TestObject case_svco = new TestObject('bouton enregistrer les informations de connexion')
case_svco.addProperty('xpath', ConditionType.EQUALS, '//input[@id=\'ic\']')
//création de l'objet de test: bouton identification
TestObject button_iden = new TestObject('bouton identification')
button_iden.addProperty('xpath', ConditionType.EQUALS, '//button[@name=\'submit\']')
//création de l'objet de test: titre page accueil personnel
TestObject valid_ID_title = new TestObject('titre accueil personnel')
valid_ID_title.addProperty('xpath', ConditionType.EQUALS, '//h2/span[contains(text(), \'Accueil personnel\')]')
//création de l'objet de test: message erreur connexion mdp ou id invalide
TestObject err_msg_id = new TestObject('message erreur invalde mdp ou id')
err_msg_id.addProperty('xpath', ConditionType.EQUALS, '//p[@class=\'msg erreur\']')
//création de l'objet de test: titre page accueil principal
TestObject main_title = new TestObject('titre page acceuil principal')
main_title.addProperty('xpath', ConditionType.EQUALS, '//h1')
//création de l'objet de test: acces direct a l'application
TestObject button_access = new TestObject('Bouton acces a l\'application')
button_access.addProperty('xpath', ConditionType.EQUALS, '//a[contains(text(), \'Accès\')]')
//création de l'objet de test: titre page identification
TestObject identification_title = new TestObject('titre de la page d\'idendtification')
identification_title.addProperty('xpath', ConditionType.EQUALS, '//h2/span[contains(text(), \'Identification\')]')
//Vérification clic sans adresse mail
KeywordUtil.logInfo("Verification clic sans adresse mail")
WebUI.setText(fieldset_mail, "")
WebUI.setText(fieldset_pswd, "fakepswd")
WebUI.click(button_iden)
WebUI.verifyElementVisible(identification_title)
WebUI.verifyElementVisible(err_msg_mail_requis)
WebUI.verifyElementNotVisible(err_msg_mail_invalide)
//Verification bouton enregistrement des informations de connexions
KeywordUtil.logInfo("Verification case à cocher")
WebUI.verifyElementClickable(case_svco)
//Vérification identification
KeywordUtil.logInfo("Vérification identification")
//Verification fausse adresse faux mot de passe
KeywordUtil.logInfo("Verification fausse adresse mail faux mot de passe")
//Where the error occurs
WebUI.setText(fieldset_mail, "fakeuser@test.com")
WebUI.setText(fieldset_pswd, "fakePswd123")
WebUI.click(button_iden)
WebUI.verifyElementVisible(identification_title)
WebUI.verifyElementVisible(err_msg_id)
if (WebUI.getAttribute(fieldset_mail, 'value') == "fakeuser@test.com") {
KeywordUtil.markPassed("L'adresse mail est bien conservée")
} else {
KeywordUtil.markError("L'adresse n'est pas conservée")
}
if (WebUI.getAttribute(fieldset_pswd, 'value') == "") {
KeywordUtil.markPassed("Le champ de texte du mot de passe est bien nettoyé")
} else {
KeywordUtil.markError("Le champ de texte du mot de passe n'est pas nettoyé")
}
WebUI.closeBrowser()
Here is the log report: