Skip to content

Commit

Permalink
test: Add popup and lookingFrontDown tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ShootingKing-AM committed Apr 14, 2024
1 parent ddf8b56 commit 55447c4
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import androidx.test.core.graphics.writeToTestStorage
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.NoMatchingViewException
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.action.ViewActions.pressBack
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.platform.app.InstrumentationRegistry
Expand Down Expand Up @@ -154,6 +156,10 @@ class ALVRActivityTest : PVRInstrumentationBase() {
sendADBCommand("sensor set acceleration 0:0:9.77622")
}

private fun lookFrontDown() {
sendADBCommand("sensor set acceleration 9.3:0:3.8")
}

private fun rotateAVDLandscape() {
// set gravity acceleration g in Y Direction - real Mock
sendADBCommand("sensor set acceleration 9.77622:0:0")
Expand Down Expand Up @@ -189,12 +195,23 @@ class ALVRActivityTest : PVRInstrumentationBase() {
}
takeScreenshot().writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")

lookDown()
onView(withId(R.id.ui_settings_button)).perform(click())
sleep(1000)
takeScreenshot().writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}_Popup")
onView(isRoot()).perform(pressBack()) // Close popup

lookFrontDown()
waitForADBTelnetServer() // Wait for ADBTelnetServer to execute rotation
sleep(1000)
takeScreenshot()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}_LookingFrontDown")

lookDown()
waitForADBTelnetServer() // Wait for ADBTelnetServer to execute rotation
sleep(1000)
takeScreenshot()
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}_LookingDown")

// shutdownADBTelnetServer()
}
/*
Expand Down

0 comments on commit 55447c4

Please sign in to comment.