@@ -17,6 +17,13 @@ const TESTS = {
1717 renderdeep : / R e n d e r D e e p R e s u l t : ( \d + ) /
1818} ;
1919
20+ const density = getDensity ( ) ;
21+ console . log ( `Device density: ${ density } ` ) ;
22+ const scale = density / 120 ;
23+ const [ width , height ] = getScreenSize ( ) ;
24+ console . log ( `Device width: ${ width } ` ) ;
25+ console . log ( `Device height: ${ height } ` ) ;
26+
2027run ( ) ;
2128
2229function run ( ) {
@@ -97,18 +104,33 @@ function killProfiler() {
97104
98105function clickOnJsTest ( ) {
99106 console . log ( `js test` ) ;
100- exec . execSyncSilent ( `adb shell input tap 720 1008` ) ; // TODO replace with non-magical values
107+ const x = width / 2 ;
108+ const y = height / 2 - ( 60 * scale )
109+ exec . execSyncSilent ( `adb shell input tap ${ x } ${ y } ` ) ;
101110 waitForLogcatMsg ( `${ LOGCAT_TAG } :JSProfile:Done` ) ;
102111}
103112
104113function clickOnFlatRenderTest ( ) {
105114 console . log ( `flat render test` ) ;
106- exec . execSyncSilent ( `adb shell input tap 720 1240` ) ; // TODO replace with non-magical values
115+ const x = width / 2 ;
116+ const y = height / 2 ;
117+ exec . execSyncSilent ( `adb shell input tap ${ x } ${ y } ` ) ;
107118 waitForLogcatMsg ( `${ LOGCAT_TAG } :RenderFlatResult:` ) ;
108119}
109120
110121function clickOnDeepRenderTest ( ) {
111122 console . log ( `deep render test` ) ;
112- exec . execSyncSilent ( `adb shell input tap 720 1470` ) ; // TODO replace with non-magical values
123+ const x = width / 2 ;
124+ const y = height / 2 + ( 40 * scale ) ;
125+ exec . execSyncSilent ( `adb shell input tap ${ x } ${ y } ` ) ;
113126 waitForLogcatMsg ( `${ LOGCAT_TAG } :RenderDeepResult:` ) ;
114127}
128+
129+ function getDensity ( ) {
130+ return exec . execSyncRead ( `adb shell wm density | grep -Eo "[0-9]+"` , true )
131+ }
132+
133+ function getScreenSize ( ) {
134+ const size = exec . execSyncRead ( `adb shell wm size | grep -Eo "\\d+x\\d+"` , true ) ;
135+ return size . split ( 'x' ) ;
136+ }
0 commit comments