diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a057745..4704724 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,8 +3,9 @@
+
-
+
@@ -20,21 +21,11 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -43,21 +34,22 @@
-
-
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -65,28 +57,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
@@ -124,9 +110,11 @@
-
+
+
+
@@ -160,7 +148,7 @@
-
+
@@ -179,8 +167,6 @@
-
-
@@ -193,6 +179,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -295,6 +295,8 @@
+
+
@@ -313,8 +315,8 @@
-
-
+
+
@@ -326,7 +328,7 @@
-
+
@@ -340,7 +342,7 @@
-
+
@@ -352,7 +354,7 @@
-
+
@@ -366,7 +368,7 @@
-
+
@@ -378,7 +380,7 @@
-
+
@@ -392,7 +394,7 @@
-
+
@@ -404,7 +406,7 @@
-
+
@@ -418,7 +420,7 @@
-
+
@@ -430,7 +432,7 @@
-
+
@@ -881,19 +883,19 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -913,9 +915,6 @@
-
-
-
@@ -925,6 +924,9 @@
+
+
+
@@ -945,41 +947,64 @@
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1010,22 +1035,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1037,9 +1046,7 @@
-
-
-
+
@@ -1109,7 +1116,6 @@
-
@@ -1118,9 +1124,7 @@
-
-
-
+
@@ -1128,7 +1132,6 @@
-
@@ -1183,7 +1186,6 @@
-
@@ -1206,9 +1208,7 @@
-
-
-
+
@@ -1263,15 +1263,6 @@
-
-
-
-
-
-
-
-
-
@@ -1279,44 +1270,64 @@
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index a88ad43..72cbe5b 100644
--- a/README.md
+++ b/README.md
@@ -33,3 +33,4 @@ Add following dependency to your pom.xml
* getSimulatorDetailsFromUDID - Retrives simulator details for given UDID
* captureScreenshot - Captures screenshot for given UDID.
* shutDownAllBootedSimulators - Shutdown all booted simulators
+* getAllBootedSimulators - Retrives all booted simulators
diff --git a/iOSDeviceManager.iml b/iOSDeviceManager.iml
index a9500db..aa653b5 100644
--- a/iOSDeviceManager.iml
+++ b/iOSDeviceManager.iml
@@ -16,6 +16,7 @@
+
\ No newline at end of file
diff --git a/src/main/java/com/thoughtworks/device/ISimulatorManager.java b/src/main/java/com/thoughtworks/device/ISimulatorManager.java
index a03df63..b6e0ae8 100644
--- a/src/main/java/com/thoughtworks/device/ISimulatorManager.java
+++ b/src/main/java/com/thoughtworks/device/ISimulatorManager.java
@@ -29,5 +29,5 @@ public interface ISimulatorManager {
boolean shutDownAllBootedSimulators() throws IOException, InterruptedException;
-
+ List getAllBootedSimulators(String osType) throws InterruptedException, IOException;
}
diff --git a/src/main/java/com/thoughtworks/device/SimulatorManager.java b/src/main/java/com/thoughtworks/device/SimulatorManager.java
index dfb6d50..1225ab3 100644
--- a/src/main/java/com/thoughtworks/device/SimulatorManager.java
+++ b/src/main/java/com/thoughtworks/device/SimulatorManager.java
@@ -114,6 +114,14 @@ public boolean shutDownAllBootedSimulators() throws IOException, InterruptedExce
}
}
+ @Override
+ public List getAllBootedSimulators(String osType) throws InterruptedException, IOException {
+ List allSimulators = getAllSimulators(osType);
+ List bootedSim = allSimulators.stream().filter( device ->
+ device.getState().equalsIgnoreCase("Booted")).collect(Collectors.toList());
+ return bootedSim;
+ }
+
@Override
public void installAppOnSimulator(String deviceName, String osVersion,
String osType, String appPath) throws Throwable {
diff --git a/src/test/java/com/thoughtworks/device/SimulatorTest.java b/src/test/java/com/thoughtworks/device/SimulatorTest.java
index e8a5605..dd92f06 100644
--- a/src/test/java/com/thoughtworks/device/SimulatorTest.java
+++ b/src/test/java/com/thoughtworks/device/SimulatorTest.java
@@ -126,4 +126,10 @@ public void simulatorShutDown() throws IOException, InterruptedException {
simulatorManager = new SimulatorManager();
assertTrue(simulatorManager.shutDownAllBootedSimulators());
}
+
+ @Test
+ public void getAllBootedSimulatorsTest() throws IOException, InterruptedException {
+ simulatorManager = new SimulatorManager();
+ assertEquals(simulatorManager.getAllBootedSimulators("iOS").get(0).getState(), "Booted");
+ }
}