Skip to content

Commit

Permalink
Fix #3 getAllBootedSimulators
Browse files Browse the repository at this point in the history
  • Loading branch information
SrinivasanTarget committed Aug 28, 2017
1 parent 8acb3a3 commit 0dad1bf
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 128 deletions.
265 changes: 138 additions & 127 deletions .idea/workspace.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions iOSDeviceManager.iml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.5.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.5.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.5.0" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20170516" level="project" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public interface ISimulatorManager {

boolean shutDownAllBootedSimulators() throws IOException, InterruptedException;


List<Device> getAllBootedSimulators(String osType) throws InterruptedException, IOException;
}
8 changes: 8 additions & 0 deletions src/main/java/com/thoughtworks/device/SimulatorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ public boolean shutDownAllBootedSimulators() throws IOException, InterruptedExce
}
}

@Override
public List<Device> getAllBootedSimulators(String osType) throws InterruptedException, IOException {
List<Device> allSimulators = getAllSimulators(osType);
List<Device> 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 {
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/com/thoughtworks/device/SimulatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

0 comments on commit 0dad1bf

Please sign in to comment.