File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed
src/test/java/io/appium/java_client Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -102,10 +102,13 @@ public class AndroidDriverTest extends BaseAndroidTest {
102102 }
103103
104104 @ Test public void lockTest () {
105- driver .lockDevice ();
106- assertEquals (true , driver .isLocked ());
107- driver .unlockDevice ();
108- assertEquals (false , driver .isLocked ());
105+ try {
106+ driver .lockDevice ();
107+ assertTrue (driver .isDeviceLocked ());
108+ } finally {
109+ driver .unlockDevice ();
110+ assertFalse (driver .isDeviceLocked ());
111+ }
109112 }
110113
111114 @ Test public void runAppInBackgroundTest () {
Original file line number Diff line number Diff line change 1717package io .appium .java_client .ios ;
1818
1919import static org .junit .Assert .assertEquals ;
20+ import static org .junit .Assert .assertFalse ;
2021import static org .junit .Assert .assertTrue ;
2122
2223import io .appium .java_client .MobileElement ;
2728import org .openqa .selenium .ScreenOrientation ;
2829import org .openqa .selenium .html5 .Location ;
2930
30- import java .time .Duration ;
31- import java .util .function .Supplier ;
32-
3331public class IOSDriverTest extends AppIOSTest {
3432
3533 //TODO There is no ability to check this function usibg simulators.
@@ -62,11 +60,13 @@ public void getDeviceTimeTest() {
6260 }
6361
6462 @ Test public void lockTest () {
65- Supplier <Boolean > lock = () -> {
66- driver .lockDevice (Duration .ofSeconds (20 ));
67- return true ;
68- };
69- assertTrue (lock .get ());
63+ try {
64+ driver .lockDevice ();
65+ assertTrue (driver .isDeviceLocked ());
66+ } finally {
67+ driver .unlockDevice ();
68+ assertFalse (driver .isDeviceLocked ());
69+ }
7070 }
7171
7272 @ Test public void pullFileTest () {
You can’t perform that action at this time.
0 commit comments