Skip to content

Commit b7b5b8a

Browse files
authored
Merge pull request #5246 from jdi-testing/update_appium_client_9_0_0
Update appium client 9 0 0
2 parents af9a950 + ec21b8e commit b7b5b8a

File tree

82 files changed

+569
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+569
-317
lines changed

config/checkstyle/checkstyle.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
<property name="id" value="FileLength_Error" />
289289
</module>
290290
<module name="LineLength">
291-
<property name="severity" value="error" />
291+
<property name="severity" value="warning" />
292292
<property name="max" value="180" />
293293
</module>
294294
<module name="RegexpHeader">
@@ -335,7 +335,7 @@
335335
</module>
336336
<module name="RegexpSingleline">
337337
<property name="severity" value="error" />
338-
<property name="format" value="(?&lt;!\.)(css|hasClass|hasAttribute|attr|find|finds)\(" />
338+
<property name="format" value="(?&lt;!\.)(css|hasClass|hasAttribute|attr|find|finds)\((?!@|\)|String)" />
339339
<property name="message" value="core() should be used with these methods" />
340340
<property name="id" value="CoreMethodsUnused_Error" />
341341
</module>

jdi-light-core/src/main/java/com/epam/jdi/light/elements/init/InitActions.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public static DriverBase defaultSetup(SiteInfo info, DriverBase jdi) {
115115
jdi.driverName = isBlank(info.driverName) ? DRIVER.name : info.driverName;
116116
return jdi;
117117
}
118+
118119
public static MapArray<String, AnnotationRule> JDI_ANNOTATIONS = map(
119120
$("Root", aRule(Root.class, (e,a)-> e.base().locator.setRoot())),
120121
$("Frame", aRule(Frame.class, (e,a)-> e.base().setFrames(getFrames(a)))),
@@ -165,13 +166,13 @@ public static DriverBase defaultSetup(SiteInfo info, DriverBase jdi) {
165166
e.base().setLocator(findByToBy(uis[0]));
166167
return;
167168
}
168-
if (any(uis, j -> j.group().equals("") || j.group().equals(TEST_GROUP)))
169+
if (any(uis, j -> j.group().isEmpty() || j.group().equals(TEST_GROUP)))
169170
e.base().setLocator(findByToBy(first(uis, j -> j.group().equals(TEST_GROUP))));
170171
})),
171172
$("FindBy UI", aRule(FindBy.class, (e,a,f)-> {
172173
FindBy[] jfindbys = f.getAnnotationsByType(FindBy.class);
173174
if (jfindbys.length > 0) {
174-
FindBy findBy = first(jfindbys, j -> j.group().equals("") || j.group().equals(TEST_GROUP));
175+
FindBy findBy = first(jfindbys, j -> j.group().isEmpty() || j.group().equals(TEST_GROUP));
175176
if (findBy != null) {
176177
e.base().setLocator(findByToBy(findBy));
177178
}

jdi-light-mobile-selenium3/src/main/java/com/epam/jdi/light/mobile/elements/common/MobileDevice.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public static BatteryInfo getBatteryInfo() {
6767
} else if (driver instanceof AndroidDriver) {
6868
return ((AndroidDriver) driver).getBatteryInfo();
6969
} else {
70-
throw runtimeException("This method is not supported by the driver. The driver needs to be the instance of either Ios or Android driver");
70+
throw runtimeException(
71+
"This method is not supported by the driver. The driver needs to be the instance of either Ios or Android driver");
7172
}
7273
}
7374

@@ -97,12 +98,14 @@ public static void performTouchId(boolean match) {
9798
}
9899

99100
public static void toggleTouchIDEnrollment(boolean enabled) {
100-
executeDriverMethod(PerformsTouchID.class, (PerformsTouchID driver) -> driver.toggleTouchIDEnrollment(enabled));
101+
executeDriverMethod(PerformsTouchID.class,
102+
(PerformsTouchID driver) -> driver.toggleTouchIDEnrollment(enabled));
101103
}
102104

103105
// the next methods are for Android only
104106
public static void fingerPrint(int fingerPrintId) {
105-
executeDriverMethod(AuthenticatesByFinger.class, (AuthenticatesByFinger driver) -> driver.fingerPrint(fingerPrintId));
107+
executeDriverMethod(AuthenticatesByFinger.class,
108+
(AuthenticatesByFinger driver) -> driver.fingerPrint(fingerPrintId));
106109
}
107110

108111
// this method is for Android only
@@ -117,11 +120,13 @@ public static String getClipBoardText() {
117120
}
118121

119122
public static List<String> getPerformanceDataTypes() {
120-
return executeDriverMethod(HasSupportedPerformanceDataType.class, HasSupportedPerformanceDataType::getSupportedPerformanceDataTypes);
123+
return executeDriverMethod(HasSupportedPerformanceDataType.class,
124+
HasSupportedPerformanceDataType::getSupportedPerformanceDataTypes);
121125
}
122126

123127
public static List<List<Object>> getPerformanceData(String packageName, String dataType, int dataReadTimeout) {
124-
return executeDriverMethod(HasSupportedPerformanceDataType.class, (HasSupportedPerformanceDataType driver) -> driver.getPerformanceData(packageName, dataType, dataReadTimeout));
128+
return executeDriverMethod(HasSupportedPerformanceDataType.class,
129+
(HasSupportedPerformanceDataType driver) -> driver.getPerformanceData(packageName, dataType, dataReadTimeout));
125130
}
126131

127132
public static void sendSMS(String phoneNumber, String smsText) {

jdi-light-mobile-selenium3/src/main/java/com/epam/jdi/light/mobile/elements/common/app/ios/InfoButton.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ public class InfoButton extends Button {
77
public void openDetails() {
88
core().tap();
99
}
10-
}
10+
}

jdi-light-mobile-tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## How to launch web tests on Android emulator
44

5-
Stable environment: Java 8, Maven 3.6.3, JDI-Light 1.3.23, TestNG 6.14.3, Aspectj 1.9.*, Appium 1.20.2, Android 10 <br/>
5+
Stable environment: Java 11, Maven 3.6.+, JDI-Light 1.5.2+, TestNG 7.8.+, Aspectj 1.9.20, Appium 1.20.2+, Android 10 <br/>
66

77
1. Launch Android emulator and wait until home screen is ready.
88
1. Launch Appium and find out the listening URL in the console (usually http://0.0.0.0:4723)

jdi-light-mobile-tests/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,23 @@
146146
<artifactId>allure-maven</artifactId>
147147
<version>${allure.maven}</version>
148148
</plugin>
149+
150+
<plugin>
151+
<groupId>org.apache.maven.plugins</groupId>
152+
<artifactId>maven-checkstyle-plugin</artifactId>
153+
<version>3.3.1</version>
154+
<configuration>
155+
<configLocation>../config/checkstyle/checkstyle.xml</configLocation>
156+
<propertyExpansion>samedir=${project.basedir}/../config/checkstyle</propertyExpansion>
157+
</configuration>
158+
<executions>
159+
<execution>
160+
<goals>
161+
<goal>check</goal>
162+
</goals>
163+
</execution>
164+
</executions>
165+
</plugin>
149166
</plugins>
150167

151168
<resources>

jdi-light-mobile-tests/src/main/java/nativeapp/android/apidemos/NotifyPage.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,20 @@ public class NotifyPage {
3737
@MobileFindBy(xpath = "//*[@resource-id='com.android.systemui:id/notification_stack_scroller']/android.widget.FrameLayout[1]//*[@resource-id='android:id/time']")
3838
public static Text timeStamp;
3939

40+
//CHECKSTYLE:OFF
4041
@MobileFindBy(xpath = "//android.widget.Switch[@content-desc=\"Wi-Fi,Wifi signal full.,AndroidWifi\"]/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.ImageView")
4142
public static Button wifiIcon;
43+
//CHECKSTYLE:ON
4244

45+
//CHECKSTYLE:OFF
4346
@MobileFindBy(xpath = "//android.widget.Switch[@content-desc=\"Airplane mode\"]/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ImageView")
4447
public static Button airplaneModeIcon;
48+
//CHECKSTYLE:ON
4549

4650
@MobileFindBy(xpath = "//*[@resource-id='android:id/message_name']")
4751
public static MobileWebList messageNames;
4852

4953
@MobileFindBy(xpath = "//*[@resource-id='android:id/message_text']")
5054
public static MobileWebList messageTexts;
5155

52-
53-
}
56+
}

jdi-light-mobile-tests/src/main/java/nativeapp/android/apidemos/SpinnerPage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ public class SpinnerPage {
1111
@MobileFindBy(id = "spinner2")
1212
public static Spinner planetSpinner;
1313

14-
}
14+
}

jdi-light-mobile-tests/src/main/java/nativeapp/android/apidemos/app/StatusBarPage.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@ public class StatusBarPage {
1212
@MobileFindBy(id = "com.android.systemui:id/no_notifications")
1313
public static StatusBar noNotifications;
1414

15+
//CHECKSTYLE:OFF
1516
@MobileFindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.ScrollView/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/android.widget.TextView")
1617
public static StatusBar appName;
1718

19+
//CHECKSTYLE:OFF
1820
@MobileFindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.ScrollView/android.widget.FrameLayout[2]/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ImageView")
1921
public static StatusBar appIcon;
2022

23+
//CHECKSTYLE:OFF
2124
@MobileFindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.ScrollView/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.TextView")
2225
public static StatusBar title;
2326

27+
//CHECKSTYLE:OFF
2428
@MobileFindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.ScrollView/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.TextView")
2529
public static StatusBar appText;
30+
//CHECKSTYLE:ON
2631

2732
@MobileFindBy(xpath = "//android.widget.Button[@content-desc='Clear notification']")
2833
public static Button clearAllButton;

jdi-light-mobile-tests/src/main/java/nativeapp/android/apidemos/views/GalleryPage.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ public class GalleryPage {
99
@MobileFindBy(accessibilityId = "1. Photos")
1010
public static Button photos;
1111

12+
//CHECKSTYLE:OFF
1213
@MobileFindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.LinearLayout/android.widget.Gallery/android.widget.ImageView[1]")
1314
public static Button photoOne;
1415

16+
//CHECKSTYLE:OFF
1517
@MobileFindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.LinearLayout/android.widget.Gallery/android.widget.ImageView[2]")
1618
public static Button photoTwo;
1719

20+
//CHECKSTYLE:OFF
1821
@MobileFindBy(xpath = "/hierarchy/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.LinearLayout/android.widget.Gallery/android.widget.ImageView[3]")
1922
public static Button photoThree;
23+
//CHECKSTYLE:ON
2024

2125
@MobileFindBy(id = "io.appium.android.apis:id/layout2")
2226
public static UIElement galleryLayout;

0 commit comments

Comments
 (0)