Merge "Increase version number." into oc-dev
diff --git a/libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/test/AbstractTestCase.java b/libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/test/AbstractTestCase.java
index 7117db2..2b4a58f 100644
--- a/libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/test/AbstractTestCase.java
+++ b/libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/test/AbstractTestCase.java
@@ -16,6 +16,7 @@
package com.android.afwtest.uiautomator.test;
+import android.app.Instrumentation;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
@@ -42,6 +43,15 @@
* @return current {@link UiDevice}
*/
protected UiDevice getUiDevice() {
- return UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+ return UiDevice.getInstance(getInstrumentation());
+ }
+
+ /**
+ * Gets current instance of {@link Instrumentation}.
+ *
+ * @return current {@link Instrumentation}
+ */
+ public Instrumentation getInstrumentation() {
+ return InstrumentationRegistry.getInstrumentation();
}
}
diff --git a/tests/QRCodeProvisioning/src/com/android/afwtest/qrcodeprovisioning/QRCodeProvisioningTest.java b/tests/QRCodeProvisioning/src/com/android/afwtest/qrcodeprovisioning/QRCodeProvisioningTest.java
index 9fa958f..2cbe953 100644
--- a/tests/QRCodeProvisioning/src/com/android/afwtest/qrcodeprovisioning/QRCodeProvisioningTest.java
+++ b/tests/QRCodeProvisioning/src/com/android/afwtest/qrcodeprovisioning/QRCodeProvisioningTest.java
@@ -53,12 +53,15 @@
private static final int TAP_COUNT = 6;
private static final int TAP_INTERVAL = 300;
+ private static final int QR_READER_INSTALL_TIMEOUT = 30000;
+ private static final int QR_READER_INSTALL_ATTEMPTS = 6;
+
private static final BySelector NEXT_BUTTON_SELECTOR =
By.text(Pattern.compile("next", Pattern.CASE_INSENSITIVE)).clickable(true);
private static final BySelector SWITCH_CAMERA_BUTTON_SELECTOR =
By.res(SUW_PACKAGE_NAME, "switch_camera_button");
private static final BySelector WELCOME_TITLE_SELECTOR =
- By.text(Pattern.compile("welcome", Pattern.CASE_INSENSITIVE));
+ By.text(Pattern.compile("welcome|hi there", Pattern.CASE_INSENSITIVE));
/**
* {@inheritDoc}
@@ -88,7 +91,8 @@
}
WidgetUtils.waitAndClick(getUiDevice(), NEXT_BUTTON_SELECTOR);
UiObject2 frontCameraButton =
- WidgetUtils.safeWait(getUiDevice(), SWITCH_CAMERA_BUTTON_SELECTOR);
+ WidgetUtils.safeWait(getUiDevice(), SWITCH_CAMERA_BUTTON_SELECTOR,
+ QR_READER_INSTALL_TIMEOUT, QR_READER_INSTALL_ATTEMPTS);
if (frontCameraButton == null) {
throw new UiObjectNotFoundException("Cannot identify QR reader");
}
diff --git a/tests/TestPlanDef.xml b/tests/TestPlanDef.xml
deleted file mode 100644
index bea0fac..0000000
--- a/tests/TestPlanDef.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<configuration description="Test plan definitions">
- <!-- For user debug build-->
- <plan name="afw-userdebug-build">
- <package name="AfwTestNfcProvisioningTestCases"/>
- <package name="AfwTestQRCodeProvisioningTestCases"/>
- <package name="AfwTestSuwDoProvisioningTestCases"/>
- </plan>
-
- <!-- For user build-->
- <plan name="afw-user-build">
- <package name="AfwTestNonSuwPoProvisioningTestCases"/>
- </plan>
-
-</configuration>
-