diff --git a/README.md b/README.md index fb10655..3c5e8da 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,8 @@ FAQ * To make it running again, please run the below commands * `Xvfb -ac :99 -screen 0 1280x1024x16 &` * `export DISPLAY=:99` + +* Running Single Spec locally + * `cd bahmni-gauge-default` + * `mvn gauge:execute -DspecsDir=specs/Registration.spec` + * For any changes in the `bahmni-gauge-commons` module create the jar again with `mvn clean install` \ No newline at end of file diff --git a/bahmni-gauge-amman/pom.xml b/bahmni-gauge-amman/pom.xml index 408eb6f..0c772ae 100644 --- a/bahmni-gauge-amman/pom.xml +++ b/bahmni-gauge-amman/pom.xml @@ -16,8 +16,8 @@ org.apache.maven.plugins maven-compiler-plugin - 1.7 - 1.7 + 11 + 11 diff --git a/bahmni-gauge-commons/pom.xml b/bahmni-gauge-commons/pom.xml index dbfb7f4..c8693a1 100644 --- a/bahmni-gauge-commons/pom.xml +++ b/bahmni-gauge-commons/pom.xml @@ -29,8 +29,8 @@ maven-compiler-plugin 3.5.1 - 1.7 - 1.7 + 11 + 11 @@ -46,5 +46,33 @@ commons-beanutils 1.9.2 + + io.github.bonigarcia + webdrivermanager + 3.7.1 + + + org.seleniumhq.selenium + selenium-java + 3.12.0 + test + + + org.reflections + reflections + 0.9.10 + + + org.seleniumhq.selenium + selenium-api + 3.12.0 + compile + + + org.seleniumhq.selenium + selenium-support + 3.12.0 + compile + diff --git a/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/common/BahmniPage.java b/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/common/BahmniPage.java index ee3bf58..b0de04d 100644 --- a/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/common/BahmniPage.java +++ b/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/common/BahmniPage.java @@ -45,6 +45,7 @@ protected static WebElement find(Collection elements, String element } public void get(String url) { + driver.get(url); } diff --git a/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/common/home/HomePage.java b/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/common/home/HomePage.java index 1a182d3..28048ec 100644 --- a/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/common/home/HomePage.java +++ b/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/common/home/HomePage.java @@ -55,7 +55,7 @@ public class HomePage extends BahmniPage { public WebElement formBuilder; public void clickRegistrationApp(){ - registration.click(); + waitForElementOnPage(registration).click(); } public void clickClinicalApp() { diff --git a/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/rest/BahmniRestClient.java b/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/rest/BahmniRestClient.java index f0fda82..a1ea86b 100644 --- a/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/rest/BahmniRestClient.java +++ b/bahmni-gauge-commons/src/main/java/org/bahmni/gauge/rest/BahmniRestClient.java @@ -92,7 +92,7 @@ public boolean isTrusted(X509Certificate[] certificate, String authType) { } }) .build(); - SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext); + SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); CloseableHttpClient httpclient = HttpClients.custom() .setSSLSocketFactory(sslsf) .build(); diff --git a/bahmni-gauge-commons/src/test/java/org/bahmni/gauge/common/DriverFactory.java b/bahmni-gauge-commons/src/test/java/org/bahmni/gauge/common/DriverFactory.java index 4e43651..7f25cbc 100644 --- a/bahmni-gauge-commons/src/test/java/org/bahmni/gauge/common/DriverFactory.java +++ b/bahmni-gauge-commons/src/test/java/org/bahmni/gauge/common/DriverFactory.java @@ -4,7 +4,6 @@ import com.thoughtworks.gauge.AfterScenario; import com.thoughtworks.gauge.AfterSpec; import com.thoughtworks.gauge.BeforeSpec; -import io.github.bonigarcia.wdm.ChromeDriverManager; import io.github.bonigarcia.wdm.WebDriverManager; import org.bahmni.gauge.common.admin.domain.OrderSet; import org.bahmni.gauge.common.formBuilder.domain.Form; @@ -27,36 +26,41 @@ public class DriverFactory { private static WebDriver driver; - //TODO: Remove this static method!!!!! + // TODO: Remove this static method!!!!! public static WebDriver getDriver() { - + return driver; } @BeforeSpec public void setup() { - if("true".equals(System.getenv("RUNS_IN_DOCKER"))){ + if ("true".equals(System.getenv("RUNS_IN_DOCKER"))) { ChromeOptions options = new ChromeOptions(); options.addArguments("--no-sandbox"); - ChromeDriverService service = new ChromeDriverService.Builder() - .usingAnyFreePort() - .withEnvironment(ImmutableMap.of("DISPLAY",":99")) - .usingDriverExecutable(new File("/usr/local/bin/chromedriver")) - .build(); + ChromeDriverService service = new ChromeDriverService.Builder().usingAnyFreePort() + .withEnvironment(ImmutableMap.of("DISPLAY", ":99")) + .usingDriverExecutable(new File("/usr/local/bin/chromedriver")).build(); - try{ + try { service.start(); - }catch(Exception ex){ + } catch (Exception ex) { ex.printStackTrace(); } - driver = new ChromeDriver(service,options); + driver = new ChromeDriver(service, options); } else { - ChromeDriverManager.getInstance().setup(); + System.out.print("Driver about to start"); + // ChromeDriverManager.getInstance().setup(); + WebDriverManager.chromedriver().setup(); + DesiredCapabilities capability = DesiredCapabilities.chrome(); + ChromeOptions options = new ChromeOptions(); + options.addArguments("--ignore-certificate-errors"); capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); - driver = new ChromeDriver(capability); + driver = new ChromeDriver(options); + System.out.print("Driver started successfully"); + } driver.manage().window().setSize(new Dimension(1440, 1200)); diff --git a/bahmni-gauge-commons/src/test/java/org/bahmni/gauge/common/specs/DashboardPageSpec.java b/bahmni-gauge-commons/src/test/java/org/bahmni/gauge/common/specs/DashboardPageSpec.java index a8ae679..cd359cb 100644 --- a/bahmni-gauge-commons/src/test/java/org/bahmni/gauge/common/specs/DashboardPageSpec.java +++ b/bahmni-gauge-commons/src/test/java/org/bahmni/gauge/common/specs/DashboardPageSpec.java @@ -163,12 +163,26 @@ public void verifyPatientDetails() { dashboardPage.verifyPatientDetails(dashboardPage.getPatientFromSpecStore()); } - //Date specification format "MM DD YY" + // Date specification format "MM DD YY" // Ex: "01 Mar 15" @Step("open the visit for date ") - public void openVisitForDate(String date) - { + public void openVisitForDate(String date) { dashboardPage.openRetrospectiveVisit(date); } + @Step("Add chief complaint on template ") + public void addChiefComplaintOnTemplate(Object arg0, Object arg1) { + throw new UnsupportedOperationException("Provide custom implementation"); + } + + @Step("Remove chief complaint on template
") + public void removeChiefComplaintOnTemplate(Object arg0, Object arg1) { + throw new UnsupportedOperationException("Provide custom implementation"); + } + + @Step("Upload consultation images with Notes on
") + public void uploadConsultationImagesWithNotesOn(Object arg0, Object arg1) { + throw new UnsupportedOperationException("Provide custom implementation"); + } + } diff --git a/bahmni-gauge-default/env/default/java.properties b/bahmni-gauge-default/env/default/java.properties index b949a64..5018216 100644 --- a/bahmni-gauge-default/env/default/java.properties +++ b/bahmni-gauge-default/env/default/java.properties @@ -17,7 +17,8 @@ gauge_jvm_args = gauge_custom_compile_dir = #URL of Bahmni env -BAHMNI_GAUGE_APP_URL = https://product-qa04.mybahmni.org/ +# BAHMNI_GAUGE_APP_URL = https://product-qa04.mybahmni.org/ +BAHMNI_GAUGE_APP_URL = https://192.168.33.10/ BAHMNI_GAUGE_APP_USER = superman BAHMNI_GAUGE_APP_PASSWORD = Admin123 BAHMNI_GAUGE_APP_LOCATION= General Ward diff --git a/bahmni-gauge-default/pom.xml b/bahmni-gauge-default/pom.xml index e6e1aa4..89ee444 100644 --- a/bahmni-gauge-default/pom.xml +++ b/bahmni-gauge-default/pom.xml @@ -15,7 +15,7 @@ com.thoughtworks.gauge gauge-java - 0.6.1 + 0.7.10 @@ -38,7 +38,7 @@ com.thoughtworks.gauge.maven gauge-maven-plugin - 1.3.0 + 1.4.3 test diff --git a/bahmni-gauge-default/specs/Registration.spec b/bahmni-gauge-default/specs/Registration.spec index b6f31e7..6814efe 100644 --- a/bahmni-gauge-default/specs/Registration.spec +++ b/bahmni-gauge-default/specs/Registration.spec @@ -65,7 +65,7 @@ Verify BMI display control verification --------------------------------------- Tags: regression, sanity * Create a new patient through API -* On the login page
 +* On the login page * Login to the application * Click on registration app * Search previously created patient with exact identifier @@ -93,21 +93,21 @@ Closing visit for an admitted patient displays error message ------------------------------------------------------------- Tags: regression, sanity -* Create and admit a patient through API
 -* On the login page
 +* Create and admit a patient through API +* On the login page * Login to the application * Click on registration app -
* Search previously created patient with exact identifier
 +* Search previously created patient with exact identifier * Enter Visit Details for Admitted Patient -
* Try close visit -
* Verify Error popup with message "Admitted patient's visit cannot be closed. Discharge the patient and try again" is displayed -
* Discharge the patient through api
 -* Close visit

 +* Try close visit +* Verify Error popup with message "Admitted patient's visit cannot be closed. Discharge the patient and try again" is displayed +* Discharge the patient through api +* Close visit * Search previously created patient with exact identifier -


* Verify "Start OPD visit" button is "displayed"
 -* Navigate to dashboard
 -* Click on inpatient app
 -* Select existing patient from patient listing page under tab "All"
 -* Verify only "Admit Patient" option is displayed in Patient Movement

 -* Navigate to dashboard

 +* Verify "Start OPD visit" button is "displayed" +* Navigate to dashboard +* Click on inpatient app +* Select existing patient from patient listing page under tab "All" +* Verify only "Admit Patient" option is displayed in Patient Movement +* Navigate to dashboard * Logout the user diff --git a/bahmni-gauge-default/src/main/resources/org/bahmni/gauge/rest/admit_patient.ftl b/bahmni-gauge-default/src/main/resources/org/bahmni/gauge/rest/admit_patient.ftl index 5b84c6e..8d3eb95 100644 --- a/bahmni-gauge-default/src/main/resources/org/bahmni/gauge/rest/admit_patient.ftl +++ b/bahmni-gauge-default/src/main/resources/org/bahmni/gauge/rest/admit_patient.ftl @@ -1,6 +1,7 @@ { "patientUuid": "${patient.uuid}", "encounterTypeUuid": "81da9590-3f10-11e4-adec-0800271c1b75", +"encounterType": "REG", "visitTypeUuid": "${patient.visitTypeUuid}", "observations": [], "locationUuid": "${patient.locationUuid}", diff --git a/bahmni-gauge-endtb/pom.xml b/bahmni-gauge-endtb/pom.xml index 1cde2f0..ce5d1c2 100644 --- a/bahmni-gauge-endtb/pom.xml +++ b/bahmni-gauge-endtb/pom.xml @@ -39,8 +39,8 @@ maven-compiler-plugin 3.1 - 1.7 - 1.7 + 11 + 11 diff --git a/bahmni-gauge-possible/pom.xml b/bahmni-gauge-possible/pom.xml index f286abf..2876d5c 100644 --- a/bahmni-gauge-possible/pom.xml +++ b/bahmni-gauge-possible/pom.xml @@ -39,8 +39,8 @@ maven-compiler-plugin 3.1 - 1.7 - 1.7 + 11 + 11 diff --git a/pom.xml b/pom.xml index 70c7fde..a7fa8f3 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,18 @@ io.github.bonigarcia webdrivermanager - 1.4.1 + 3.7.1 + + + org.seleniumhq.selenium + selenium-java + 3.12.0 + test + + + org.reflections + reflections + 0.9.10 junit