File tree 2 files changed +63
-0
lines changed
src/test/java/io/appium/java_client
2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .appium .java_client .android ;
2
+
3
+ import org .junit .Before ;
4
+ import org .junit .Test ;
5
+ import org .openqa .selenium .WebDriverException ;
6
+
7
+ import java .time .Duration ;
8
+
9
+ import static org .hamcrest .MatcherAssert .assertThat ;
10
+ import static org .hamcrest .Matchers .isEmptyString ;
11
+ import static org .hamcrest .Matchers .not ;
12
+
13
+ public class AndroidScreenRecordTest extends BaseAndroidTest {
14
+
15
+ @ Before
16
+ public void setUp () {
17
+ Activity activity = new Activity ("io.appium.android.apis" , ".ApiDemos" );
18
+ driver .startActivity (activity );
19
+ }
20
+
21
+ @ Test
22
+ public void verifyBasicScreenRecordingWorks () throws InterruptedException {
23
+ try {
24
+ driver .startRecordingScreen (
25
+ new AndroidStartScreenRecordingOptions ()
26
+ .withTimeLimit (Duration .ofSeconds (5 ))
27
+ );
28
+ } catch (WebDriverException e ) {
29
+ if (e .getMessage ().toLowerCase ().contains ("emulator" )) {
30
+ // screen recording only works on real devices
31
+ return ;
32
+ }
33
+ }
34
+ Thread .sleep (5000 );
35
+ String result = driver .stopRecordingScreen ();
36
+ assertThat (result , not (isEmptyString ()));
37
+ }
38
+
39
+ }
Original file line number Diff line number Diff line change
1
+ package io .appium .java_client .ios ;
2
+
3
+ import org .junit .Test ;
4
+
5
+ import java .time .Duration ;
6
+
7
+ import static org .hamcrest .MatcherAssert .assertThat ;
8
+ import static org .hamcrest .Matchers .isEmptyString ;
9
+ import static org .hamcrest .Matchers .not ;
10
+
11
+ public class IOSScreenRecordTest extends AppIOSTest {
12
+
13
+ @ Test
14
+ public void verifyBasicScreenRecordingWorks () throws InterruptedException {
15
+ driver .startRecordingScreen (
16
+ new IOSStartScreenRecordingOptions ()
17
+ .withTimeLimit (Duration .ofSeconds (10 ))
18
+ );
19
+ Thread .sleep (5000 );
20
+ String result = driver .stopRecordingScreen ();
21
+ assertThat (result , not (isEmptyString ()));
22
+ }
23
+
24
+ }
You can’t perform that action at this time.
0 commit comments