@@ -7,9 +7,7 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
77import androidx.test.espresso.matcher.RootMatchers
88import androidx.test.espresso.matcher.ViewMatchers.isClickable
99import androidx.test.espresso.matcher.ViewMatchers.isEnabled
10- import androidx.test.espresso.matcher.ViewMatchers.isJavascriptEnabled
1110import androidx.test.espresso.matcher.ViewMatchers.withText
12- import androidx.test.espresso.web.sugar.Web.onWebView
1311import androidx.test.espresso.web.webdriver.DriverAtoms.findElement
1412import androidx.test.espresso.web.webdriver.DriverAtoms.webClick
1513import androidx.test.espresso.web.webdriver.Locator
@@ -18,8 +16,6 @@ import androidx.test.uiautomator.By
1816import androidx.test.uiautomator.UiSelector
1917import androidx.test.uiautomator.Until
2018import com.metamask.ui.base.BaseBrowserUiTest
21- import com.metamask.ui.base.CustomMatchers
22- import org.hamcrest.Matchers.allOf
2319import org.hamcrest.Matchers.not
2420import org.junit.After
2521import org.junit.Assert
@@ -47,17 +43,9 @@ class BrowserDownloadFileTests : BaseBrowserUiTest() {
4743
4844 @Test
4945 fun downloadFile () {
50- device.findObject(UiSelector ().resourceId(" url-input" )).click()
51- device.findObject(UiSelector ().resourceId(" browser-modal-url-input" ))
52- .setText(" https://tyschenko.github.io/download_file.html" )
53- device.pressEnter()
54-
55- onWebView(
56- allOf(
57- isJavascriptEnabled(),
58- CustomMatchers .withMinimumWidth(1 ), // There are multiple webviews in the layout, we choose one that has width and height not equal to 0
59- )
60- )
46+ openUrl(" https://tyschenko.github.io/download_file.html" )
47+
48+ onMetaMaskWebView()
6149 .withElement(findElement(Locator .ID , " download_button" ))
6250 .perform(webClick())
6351
@@ -83,17 +71,9 @@ class BrowserDownloadFileTests : BaseBrowserUiTest() {
8371
8472 @Test
8573 fun downloadBlobFile () {
86- device.findObject(UiSelector ().resourceId(" url-input" )).click()
87- device.findObject(UiSelector ().resourceId(" browser-modal-url-input" ))
88- .setText(" https://tyschenko.github.io/download_blob_file.html" )
89- device.pressEnter()
90-
91- onWebView(
92- allOf(
93- isJavascriptEnabled(),
94- CustomMatchers .withMinimumWidth(1 ), // There are multiple webviews in the layout, we choose one that has width and height not equal to 0
95- )
96- )
74+ openUrl(" https://tyschenko.github.io/download_blob_file.html" )
75+
76+ onMetaMaskWebView()
9777 .withElement(findElement(Locator .ID , " download_button" ))
9878 .perform(webClick())
9979
@@ -117,17 +97,9 @@ class BrowserDownloadFileTests : BaseBrowserUiTest() {
11797
11898 @Test
11999 fun downloadBase64File () {
120- device.findObject(UiSelector ().resourceId(" url-input" )).click()
121- device.findObject(UiSelector ().resourceId(" browser-modal-url-input" ))
122- .setText(" https://tyschenko.github.io/download_base64_file.html" )
123- device.pressEnter()
124-
125- onWebView(
126- allOf(
127- isJavascriptEnabled(),
128- CustomMatchers .withMinimumWidth(1 ), // There are multiple webviews in the layout, we choose one that has width and height not equal to 0
129- )
130- )
100+ openUrl(" https://tyschenko.github.io/download_base64_file.html" )
101+
102+ onMetaMaskWebView()
131103 .withElement(findElement(Locator .ID , " download_button" ))
132104 .perform(webClick())
133105
0 commit comments