Skip to content

Commit 3ac7579

Browse files
committed
add return value description & put string into res
1 parent ae2335d commit 3ac7579

File tree

7 files changed

+20
-11
lines changed

7 files changed

+20
-11
lines changed

scripts/gha/integration_testing/gameloop_android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
defaultConfig {
99
applicationId "com.google.firebase.gameloop"
1010
minSdkVersion rootProject.minSdk
11-
targetSdkVersion rootProject.targetSDK
11+
targetSdkVersion rootProject.targetSdk
1212
versionCode 1
1313
versionName "1.0"
1414

scripts/gha/integration_testing/gameloop_android/app/src/androidTest/java/com/google/firebase/gameloop/GameLoopUITest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import androidx.test.ext.junit.rules.ActivityScenarioRule
44
import androidx.test.ext.junit.runners.AndroidJUnit4
55
import androidx.test.filters.SdkSuppress
66
import androidx.test.platform.app.InstrumentationRegistry
7+
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
78
import androidx.test.uiautomator.By
89
import androidx.test.uiautomator.UiDevice
910
import androidx.test.uiautomator.Until
@@ -18,7 +19,6 @@ import org.junit.runner.RunWith
1819
class GameLoopUITest {
1920

2021
companion object {
21-
const val COMPLETE_TEST = "Game Loop Complete"
2222
const val GAMELOOP_TIMEOUT = 7 * 60 * 1000L
2323
}
2424

@@ -35,7 +35,9 @@ class GameLoopUITest {
3535

3636
@Test
3737
fun testLaunchGameLoop() {
38-
val element = device.wait(Until.findObject(By.text(COMPLETE_TEST)), GAMELOOP_TIMEOUT)
38+
val element = device.wait(
39+
Until.findObject(By.text(getInstrumentation().targetContext.getString(R.string.test_complete))),
40+
GAMELOOP_TIMEOUT)
3941
assertNotNull(element)
4042
}
4143
}

scripts/gha/integration_testing/gameloop_android/app/src/main/java/com/google/firebase/gameloop/MainActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import java.io.File
1313

1414
class MainActivity : AppCompatActivity(R.layout.activity_main) {
1515
companion object {
16-
const val COMPLETE_TEST = "Game Loop Complete"
1716
const val GAMELOOP_INTENT = "com.google.intent.action.TEST_LOOP"
1817
const val TEST_LOOP_REQUEST_CODE = 1
1918
}
@@ -49,7 +48,7 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) {
4948
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
5049
super.onActivityResult(requestCode, resultCode, data)
5150
when (requestCode) {
52-
TEST_LOOP_REQUEST_CODE -> testingTV.text = COMPLETE_TEST
51+
TEST_LOOP_REQUEST_CODE -> testingTV.text = getString(R.string.test_complete)
5352
}
5453
}
5554
}

scripts/gha/integration_testing/gameloop_android/app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<TextView
99
android:layout_width="wrap_content"
1010
android:layout_height="wrap_content"
11-
android:text="Testing"
11+
android:text="@string/testing"
1212
android:id="@+id/test"
1313
app:layout_constraintBottom_toBottomOf="parent"
1414
app:layout_constraintLeft_toLeftOf="parent"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<resources>
22
<string name="app_name">gameloop</string>
3+
<string name="testing">Testing</string>
4+
<string name="test_complete">Game Loop Complete</string>
35
</resources>

scripts/gha/integration_testing/gameloop_android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ext {
2525
compileSdk = 28
2626
buildTools = '28.0.3'
2727
minSdk = 16
28-
targetSDK = 28
28+
targetSdk = 28
2929
}
3030

3131
task clean(type: Delete) {

scripts/gha/test_simulator.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@
5656
sdk id "system-images;android-29;google_apis", build tool version "29.0.3":
5757
--android_device "system-images;android-29;google_apis;x86;29.0.3"
5858
59+
Returns:
60+
1: No iOS/Android integration_test apps found
61+
21: iOS Simulator created fail
62+
22: iOS gameloop app not found
63+
23: build_testapps.json file not found
64+
31: For android test, JAVA_HOME is not set to java 8
5965
"""
6066

6167
import json
@@ -131,21 +137,21 @@ def main(argv):
131137
device_id = _boot_simulator(device_name, device_os)
132138
if not device_id:
133139
logging.error("simulator created fail")
134-
return 1
140+
return 21
135141

136142
# A tool that enable game-loop test. This is a XCode project
137143
ios_gameloop_project = os.path.join(current_dir, "integration_testing", "gameloop")
138144
ios_gameloop_app = _build_ios_gameloop(ios_gameloop_project, device_name, device_os)
139145
if not ios_gameloop_app:
140146
logging.error("gameloop app not found")
141-
return 2
147+
return 22
142148

143149
config_path = os.path.join(current_dir, "integration_testing", "build_testapps.json")
144150
with open(config_path, "r") as configFile:
145151
config = json.load(configFile)
146152
if not config:
147153
logging.error("No config file found")
148-
return 3
154+
return 23
149155

150156
for app_path in ios_testapps:
151157
bundle_id = _get_bundle_id(app_path, config)
@@ -164,7 +170,7 @@ def main(argv):
164170

165171
if not _check_java_version():
166172
logging.error("Please set JAVA_HOME to java 8")
167-
return 1
173+
return 31
168174

169175
_setup_android(platforms_version, build_tools_version, sdk_id)
170176

0 commit comments

Comments
 (0)