Skip to content

Commit e92acd0

Browse files
author
Denys Zaiats
committed
[1.4.2-updated-unique-json-names] - fix for collecting results
1 parent ede4aa8 commit e92acd0

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

src/main/java/util/general/SystemHelper.java

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,55 @@
33
import java.awt.*;
44
import java.io.File;
55
import java.lang.reflect.Field;
6+
import java.util.Arrays;
67

8+
import static environment.EnvironmentFactory.*;
79
import static util.validator.Constants.TARGET_AUTOMOTION_JSON;
810

911
public class SystemHelper {
1012

13+
public final static String[] iOS_RETINA_DEVICES = {
14+
"iPhone 4", "iPhone 4s",
15+
"iPhone 5", "iPhone 5s",
16+
"iPhone 6", "iPhone 6s",
17+
"iPad Mini 2",
18+
"iPad Mini 4",
19+
"iPad Air 2",
20+
"iPad Pro"
21+
};
22+
1123
/**
1224
* Verify is display is retina
1325
*
1426
* @return
1527
*/
1628
public static boolean isRetinaDisplay() {
1729
boolean isRetina = false;
18-
try {
19-
GraphicsDevice graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
20-
30+
if (isMobile()) {
31+
if (isIOS()) {
32+
if (Arrays.asList(iOS_RETINA_DEVICES).contains(getDevice())) {
33+
isRetina = true;
34+
}
35+
}
36+
} else {
2137
try {
22-
Field field = graphicsDevice.getClass().getDeclaredField("scale");
23-
if (field != null) {
24-
field.setAccessible(true);
25-
Object scale = field.get(graphicsDevice);
26-
if (scale instanceof Integer && (Integer) scale == 2) {
27-
isRetina = true;
38+
GraphicsDevice graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
39+
40+
try {
41+
Field field = graphicsDevice.getClass().getDeclaredField("scale");
42+
if (field != null) {
43+
field.setAccessible(true);
44+
Object scale = field.get(graphicsDevice);
45+
if (scale instanceof Integer && (Integer) scale == 2) {
46+
isRetina = true;
47+
}
2848
}
49+
} catch (Exception e) {
50+
e.printStackTrace();
2951
}
3052
} catch (Exception e) {
3153
e.printStackTrace();
3254
}
33-
} catch (Exception e) {
34-
e.printStackTrace();
3555
}
3656
return isRetina;
3757
}

src/main/java/util/validator/ResponsiveUIValidator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import static util.validator.ResponsiveUIValidator.Units.PX;
3030

3131
public class ResponsiveUIValidator {
32-
3332
static final int MIN_OFFSET = -10000;
3433
private final static Logger LOG = Logger.getLogger(ResponsiveUIValidator.class);
3534
protected static WebDriver driver;

0 commit comments

Comments
 (0)