From 3fff9afae1c289e5bf1c6cf42c1fc1328a57318a Mon Sep 17 00:00:00 2001 From: kdaud Date: Mon, 1 Apr 2024 15:26:27 +0300 Subject: [PATCH] Enhance the implementation of systemSavesEncounter() method within the patient encounter test --- .../qaframework/automation/PatientEncounterSteps.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qaframework-bdd-tests/src/test/java/org/openmrs/contrib/qaframework/automation/PatientEncounterSteps.java b/qaframework-bdd-tests/src/test/java/org/openmrs/contrib/qaframework/automation/PatientEncounterSteps.java index 5028264f8..ed4939fed 100644 --- a/qaframework-bdd-tests/src/test/java/org/openmrs/contrib/qaframework/automation/PatientEncounterSteps.java +++ b/qaframework-bdd-tests/src/test/java/org/openmrs/contrib/qaframework/automation/PatientEncounterSteps.java @@ -9,8 +9,6 @@ */ package org.openmrs.contrib.qaframework.automation; -import static org.junit.Assert.assertTrue; - import io.cucumber.java.After; import io.cucumber.java.Before; import io.cucumber.java.en.And; @@ -18,12 +16,15 @@ import io.cucumber.java.en.Then; import io.cucumber.java.en.When; +import org.junit.Assert; import org.openmrs.contrib.qaframework.RunTest; import org.openmrs.contrib.qaframework.helper.TestData; import org.openmrs.contrib.qaframework.page.AdministrationPage; import org.openmrs.contrib.qaframework.page.EncounterFormPage; import org.openmrs.contrib.qaframework.page.ManageEncountersPage; import org.openmrs.contrib.qaframework.page.SystemAdministrationPage; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; public class PatientEncounterSteps extends Steps { @@ -81,11 +82,13 @@ public void fillEncounterForm() { @And("a user clicks Save Encounter button") public void clickOnSaveEncounterButton() { encounterFormPage.clickOnSaveEncounter(); + encounterFormPage.waitForPage(); } @Then("the system saves encounter in the encounters table") public void systemSavesEncounter() { - assertTrue(textExists("Encounter saved")); + WebElement element = driver.findElement(By.xpath("//*[@id='openmrs_msg']")); + Assert.assertEquals(element.getText(), "Encounter saved"); } @When("a user clicks on deleted checkbox")