Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RATEST-288: Fix Failing Test: AddUserTest #299

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -9,22 +9,18 @@
*/
package org.openmrs.contrib.qaframework.legacy;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.List;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openmrs.contrib.qaframework.helper.BuildTests;
import org.openmrs.contrib.qaframework.page.AddEditUserPage;
import org.openmrs.contrib.qaframework.page.AdministrationPage;
import org.openmrs.contrib.qaframework.page.CreateNewUserPage;
import org.openmrs.contrib.qaframework.page.HomePage;
import org.openmrs.contrib.qaframework.page.ManageUserPage;
import org.openmrs.contrib.qaframework.page.SystemAdministrationPage;

@Ignore
public class AddUserTest extends ReferenceApplicationTestBase {

@Test
Expand All @@ -38,26 +34,9 @@ public void addUserTest() {
manageUserPage.removeUser("super_nurse");
} else {
AddEditUserPage addEditUserPage = manageUserPage.clickOnAddUser();
addEditUserPage.createNewPerson();

addEditUserPage.saveUser();
List<String> validationErrors = addEditUserPage.getValidationErrors();
assertTrue(validationErrors.contains("You must define at least one name"));
assertTrue(validationErrors.contains("Cannot be empty or null"));
assertFalse(addEditUserPage.isDataCorrect(validationErrors));

addEditUserPage.enterGivenFamily("Super", "Nurse");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for removing the assertions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for removing the assertions?
@kdaud initially the test was made to rely on addEditUserPage, however, It should rely on CreateNewUserPage. Now given the coupling of methods in the createNewUserPage, there's no room for errors. You could advise me on the best approach to take @kdaud

Copy link
Member

@kdaud kdaud Dec 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for switching the test from using AddEditUserPage ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdaud the actual page that is meant to implement it is the CreateNewUserPage, you follow their URLs

Copy link
Member

@kdaud kdaud Dec 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two ways of creating user account and the test is using the legacy ui captured in second option on the talk post. You need to investigate why the test is failing the validation declaration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the test clicks save user and the validation errors are displayed, it looks like the session is killed and the test can not proceed after that.

@Irenyak1 investigate why the test run is killed at that point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdaud did you take time to look into the error logs?

Copy link
Member

@kdaud kdaud Dec 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdaud did you take time to look into the error logs?

yes.

That is why I made the comment above !

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is why I made the comment above !

What were your findings ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What were your findings ?

haven't investigated since you're looking into the test.

addEditUserPage.saveUser();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is working fine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is working fine

@sherrif10 it is working fine on my side, I have just rerun it again. I just want to look into the reason why it's failing here.

validationErrors = addEditUserPage.getValidationErrors();
assertFalse(addEditUserPage.isDataCorrect(validationErrors));
CreateNewUserPage createNewUserPage = addEditUserPage.createNewPerson();

addEditUserPage.clickOnFemale();
addEditUserPage.enterUsernamePassword("super_nurse", "supernurse", "supernurse123");
addEditUserPage.saveUser();
assertFalse(addEditUserPage.isDataCorrect(validationErrors));
addEditUserPage.enterUsernamePassword("super_nurse", "Nurse123", "Nurse123");
addEditUserPage.saveUser();
assertFalse(addEditUserPage.isDataCorrect(validationErrors));
createNewUserPage.fillInPersonName("Super", "Nurse", "super_nurse", "Nurse123");

manageUserPage.waitForPage();
assertTrue(manageUserPage.getUserSavedNotification().contains("User Saved"));
Expand Down