Skip to content

Commit 1ab05d8

Browse files
David Gonzalezclaude
authored andcommitted
Fix RequestBlocklistTest on native input builds
The Internal Privacy Tests job runs RequestBlocklistTest on the internal build, where native input is now enabled by default (#8588). With native input on, the omnibar disables the legacy omnibarTextInput and routes taps through a click-catcher overlay, so Espresso's typeText() failed with a PerformException on the disabled, input-connection-less view. Drive the unified input flow instead: after the warm-up page loads, tap the omnibar click-catcher to open the input screen and type the URL into the native inputField, mirroring the e2e tests. Loading the warm-up page first also gives the privacy config time to load before the request-blocklist page fires its requests, which avoids a content-level race that a direct page load hit. Verified on a Pixel 8 Pro emulator (API 34, same level as CI): the test passes 4/4 runs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b14c2ab commit 1ab05d8

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

app/src/androidTest/java/com/duckduckgo/espresso/RequestBlocklistTest.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ import androidx.test.espresso.IdlingResource
2424
import androidx.test.espresso.UiController
2525
import androidx.test.espresso.ViewAction
2626
import androidx.test.espresso.action.ViewActions.clearText
27+
import androidx.test.espresso.action.ViewActions.click
2728
import androidx.test.espresso.action.ViewActions.pressImeActionButton
2829
import androidx.test.espresso.action.ViewActions.typeText
30+
import androidx.test.espresso.matcher.ViewMatchers.isRoot
2931
import androidx.test.espresso.matcher.ViewMatchers.withId
3032
import androidx.test.espresso.web.model.Atoms
3133
import androidx.test.espresso.web.sugar.Web
@@ -44,6 +46,7 @@ import org.junit.After
4446
import org.junit.Assert.assertEquals
4547
import org.junit.Rule
4648
import org.junit.Test
49+
import com.duckduckgo.duckchat.impl.R as DuckChatR
4750

4851
class RequestBlocklistTest {
4952

@@ -73,15 +76,23 @@ class RequestBlocklistTest {
7376

7477
WebViewIdlingResource(webView).track()
7578

76-
onView(withId(R.id.omnibarTextInput)).perform(
79+
// On internal builds native input is enabled, which disables the legacy omnibar field
80+
// and routes a tap to the unified input screen. Drive that flow — open the input screen
81+
// and type the URL into the native input field — instead of typing into the disabled
82+
// omnibar. Loading the warm-up page first also gives the privacy config time to load
83+
// before the test page fires its requests.
84+
onView(withId(R.id.omnibarTextInputClickCatcher)).perform(click())
85+
onView(isRoot()).perform(waitFor(1000))
86+
onView(isRoot()).perform(waitForView(withId(DuckChatR.id.inputField)))
87+
onView(withId(DuckChatR.id.inputField)).perform(
7788
clearText(),
7889
typeText("https://privacy-test-pages.site/privacy-protections/request-blocklist/"),
7990
pressImeActionButton(),
8091
)
8192

8293
WebViewIdlingResource(webView).track()
8394

84-
// Now register — window.results won't exist until the new page's finished() fires
95+
// window.results won't exist until the request-blocklist page's finished() fires
8596
JsObjectIdlingResource(webView, "window.results").track()
8697

8798
val results = Web.onWebView()

0 commit comments

Comments
 (0)