Skip to content

Commit

Permalink
update gauge and fix registration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shridharkalagi committed Nov 5, 2020
1 parent 4d88ba5 commit ec0b2b1
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 45 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
4 changes: 2 additions & 2 deletions bahmni-gauge-amman/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand Down
32 changes: 30 additions & 2 deletions bahmni-gauge-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand All @@ -46,5 +46,33 @@
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.7.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.12.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.12.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected static WebElement find(Collection<WebElement> elements, String element
}

public void get(String url) {

driver.get(url);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class HomePage extends BahmniPage {
public WebElement formBuilder;

public void clickRegistrationApp(){
registration.click();
waitForElementOnPage(registration).click();
}

public void clickClinicalApp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <date>")
public void openVisitForDate(String date)
{
public void openVisitForDate(String date) {
dashboardPage.openRetrospectiveVisit(date);
}

@Step("Add chief complaint on <History and Examination> template <table>")
public void addChiefComplaintOnTemplate(Object arg0, Object arg1) {
throw new UnsupportedOperationException("Provide custom implementation");
}

@Step("Remove chief complaint on <History and Examination> template <table>")
public void removeChiefComplaintOnTemplate(Object arg0, Object arg1) {
throw new UnsupportedOperationException("Provide custom implementation");
}

@Step("Upload consultation images with Notes on <History and Examination> <table>")
public void uploadConsultationImagesWithNotesOn(Object arg0, Object arg1) {
throw new UnsupportedOperationException("Provide custom implementation");
}

}
3 changes: 2 additions & 1 deletion bahmni-gauge-default/env/default/java.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions bahmni-gauge-default/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<dependency>
<groupId>com.thoughtworks.gauge</groupId>
<artifactId>gauge-java</artifactId>
<version>0.6.1</version>
<version>0.7.10</version>
</dependency>

<dependency>
Expand All @@ -38,7 +38,7 @@
<plugin>
<groupId>com.thoughtworks.gauge.maven</groupId>
<artifactId>gauge-maven-plugin</artifactId>
<version>1.3.0</version>
<version>1.4.3</version>
<executions>
<execution>
<phase>test</phase>
Expand Down
28 changes: 14 additions & 14 deletions bahmni-gauge-default/specs/Registration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"patientUuid": "${patient.uuid}",
"encounterTypeUuid": "81da9590-3f10-11e4-adec-0800271c1b75",
"encounterType": "REG",
"visitTypeUuid": "${patient.visitTypeUuid}",
"observations": [],
"locationUuid": "${patient.locationUuid}",
Expand Down
4 changes: 2 additions & 2 deletions bahmni-gauge-endtb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand Down
4 changes: 2 additions & 2 deletions bahmni-gauge-possible/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand Down
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>1.4.1</version>
<version>3.7.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down

0 comments on commit ec0b2b1

Please sign in to comment.