-
-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mykola Mokhnach
committed
Jan 30, 2018
1 parent
52dd573
commit 96d8eff
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/test/java/io/appium/java_client/android/AndroidScreenRecordTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.appium.java_client.android; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.openqa.selenium.WebDriverException; | ||
|
||
import java.time.Duration; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.isEmptyString; | ||
import static org.hamcrest.Matchers.not; | ||
|
||
public class AndroidScreenRecordTest extends BaseAndroidTest { | ||
|
||
@Before | ||
public void setUp() { | ||
Activity activity = new Activity("io.appium.android.apis", ".ApiDemos"); | ||
driver.startActivity(activity); | ||
} | ||
|
||
@Test | ||
public void verifyBasicScreenRecordingWorks() throws InterruptedException { | ||
try { | ||
driver.startRecordingScreen( | ||
new AndroidStartScreenRecordingOptions() | ||
.withTimeLimit(Duration.ofSeconds(5)) | ||
); | ||
} catch (WebDriverException e) { | ||
if (e.getMessage().toLowerCase().contains("emulator")) { | ||
// screen recording only works on real devices | ||
return; | ||
} | ||
} | ||
Thread.sleep(5000); | ||
String result = driver.stopRecordingScreen(); | ||
assertThat(result, not(isEmptyString())); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/test/java/io/appium/java_client/ios/IOSScreenRecordTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.appium.java_client.ios; | ||
|
||
import org.junit.Test; | ||
|
||
import java.time.Duration; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.isEmptyString; | ||
import static org.hamcrest.Matchers.not; | ||
|
||
public class IOSScreenRecordTest extends AppIOSTest { | ||
|
||
@Test | ||
public void verifyBasicScreenRecordingWorks() throws InterruptedException { | ||
driver.startRecordingScreen( | ||
new IOSStartScreenRecordingOptions() | ||
.withTimeLimit(Duration.ofSeconds(10)) | ||
); | ||
Thread.sleep(5000); | ||
String result = driver.stopRecordingScreen(); | ||
assertThat(result, not(isEmptyString())); | ||
} | ||
|
||
} |