Browse Source

Fix topBar button colors on iOS 13 (#5690)

d4vidi 4 years ago
parent
commit
9efd84c54e
4 changed files with 9 additions and 93 deletions
  1. 9
    33
      e2e/AndroidUtils.js
  2. 0
    34
      e2e/DeviceLocked.test.js
  3. 0
    13
      package.json
  4. 0
    13
      scripts/test-e2e-android-locked.js

+ 9
- 33
e2e/AndroidUtils.js View File

@@ -1,37 +1,13 @@
1 1
 const exec = require('shell-utils').exec;
2
-
3
-module.exports = {
4
-  pressBack: () => {
5
-    exec.execSync('adb shell input keyevent 4');
6
-  },
7
-  pressMenu: () => {
8
-    exec.execSync('adb shell input keyevent 82');
9
-  },
10
-  pressEnter: (keyCode) => {
11
-    exec.execSync(`adb shell input keyevent 66`);
12
-  },
13
-  pressLockButton: () => {
14
-    exec.execSync(`adb shell input keyevent 26`);
15
-  },
16
-  pressKeyCode: (keyCode) => {
17
-    exec.execSync(`adb shell input keyevent ${keyCode}`);
18
-  },
19
-  grantPermission: () => {
20
-    exec.execSync('adb shell pm grant com.reactnativenavigation.playground android.permission.READ_PHONE_STATE');
21
-  },
22
-  revokePermission: () => {
23
-    exec.execSync('adb shell pm revoke com.reactnativenavigation.playground android.permission.READ_PHONE_STATE');
24
-  },
25
-  openActivity: () => {
26
-    exec.execSync('adb shell am start -n com.reactnativenavigation.playground/.MainActivity');
27
-  },
2
+const utils = {
3
+  pressBack: () => utils.pressKeyCode(4),
4
+  pressMenu: () => utils.pressKeyCode(82),
5
+  pressKeyCode: (keyCode) => utils.executeShellCommand(`input keyevent ${keyCode}`),
6
+  grantPermission: () => utils.executeShellCommand('pm grant com.reactnativenavigation.playground android.permission.READ_PHONE_STATE'),
7
+  revokePermission: () => utils.executeShellCommand('pm revoke com.reactnativenavigation.playground android.permission.READ_PHONE_STATE'),
28 8
   executeShellCommand: (command) => {
29
-    exec.execSync(`adb shell ${command}`);
9
+    exec.execSync(`adb -s ${device.id} shell ${command}`);
30 10
   },
31
-  enterText: (text) => {
32
-    exec.execSync(`adb shell input text ${text}`);
33
-  },
34
-  swipeUp: () => {
35
-    exec.execSync('adb shell input touchscreen swipe 300 1200 500 0 100');
36
-  }
37 11
 };
12
+
13
+module.exports = utils;

+ 0
- 34
e2e/DeviceLocked.test.js View File

@@ -1,34 +0,0 @@
1
-const Utils = require('./Utils');
2
-const Android = require('./AndroidUtils');
3
-
4
-const { elementByLabel } = Utils;
5
-
6
-xdescribe(':android: Android phone locked tests', () => {
7
-  beforeEach(async () => {
8
-    await device.relaunchApp();
9
-  });
10
-
11
-  test('launch from locked screen', async () => {
12
-    await device.terminateApp();
13
-    await Android.pressLockButton();
14
-    await Android.pressLockButton();
15
-    await device.launchApp();
16
-    await Android.swipeUp();
17
-    // The device should be locked using PIN 1234
18
-    await Android.enterText('1234');
19
-    await Android.pressEnter();
20
-    await expect(elementByLabel('React Native Navigation!')).toBeVisible();
21
-  });
22
-
23
-  test('launch app from unlocked screen', async () => {
24
-    await device.terminateApp();
25
-    await Android.pressLockButton();
26
-    await Android.pressLockButton();
27
-    await Android.swipeUp();
28
-    // The device should be locked using PIN 1234
29
-    await Android.enterText('1234');
30
-    await Android.pressEnter();
31
-    await device.launchApp();
32
-    await expect(elementByLabel('React Native Navigation!')).toBeVisible();
33
-  });
34
-});

+ 0
- 13
package.json View File

@@ -36,7 +36,6 @@
36 36
     "pretest-e2e-android": "npm run build",
37 37
     "test-e2e-android": "node ./scripts/test-e2e --android",
38 38
     "test-e2e-android-multi": "npm run test-e2e-android -- --multi",
39
-    "test-e2e-android-locked": "node ./scripts/test-e2e-android-locked",
40 39
     "pretest-e2e-ios": "npm run build",
41 40
     "test-e2e-ios": "node ./scripts/test-e2e --ios",
42 41
     "test-e2e-ios-multi": "npm run test-e2e-ios -- --multi",
@@ -158,18 +157,6 @@
158 157
         "build": "cd playground/android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release",
159 158
         "type": "android.emulator",
160 159
         "name": "Nexus_5X_API_26"
161
-      },
162
-      "android.emu.debug.locked": {
163
-        "binaryPath": "playground/android/app/build/outputs/apk/debug/app-debug.apk",
164
-        "build": "cd playground/android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug",
165
-        "type": "android.emulator",
166
-        "name": "Nexus_5X_API_23"
167
-      },
168
-      "android.emu.release.locked": {
169
-        "binaryPath": "playground/android/app/build/outputs/apk/release/app-release.apk",
170
-        "build": "cd playground/android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release",
171
-        "type": "android.emulator",
172
-        "name": "Nexus_5X_API_23"
173 160
       }
174 161
     }
175 162
   }

+ 0
- 13
scripts/test-e2e-android-locked.js View File

@@ -1,13 +0,0 @@
1
-const _ = require('lodash');
2
-const exec = require('shell-utils').exec;
3
-
4
-const release = _.includes(process.argv, '--release');
5
-
6
-run();
7
-
8
-function run() {
9
-    const suffix = release ? `release` : `debug`;
10
-    const configuration = `android.emu.${suffix}.locked`;
11
-
12
-    exec.execSync(`detox test --configuration ${configuration} -f "DeviceLocked.test.js"`)
13
-}