forked from mozilla-mobile/fenix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For mozilla-mobile#21002: improves the share tabs smoke tests coverage
- Loading branch information
1 parent
cb0b9d3
commit c86683f
Showing
9 changed files
with
177 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
app/src/androidTest/java/org/mozilla/fenix/ui/ShareButtonTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
app/src/androidTest/java/org/mozilla/fenix/ui/robots/ShareOverlayRobot.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package org.mozilla.fenix.ui.robots | ||
|
||
import android.content.Intent | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.intent.Intents | ||
import androidx.test.espresso.intent.matcher.IntentMatchers | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import androidx.test.espresso.matcher.ViewMatchers.hasSibling | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import androidx.test.espresso.matcher.ViewMatchers.withId | ||
import androidx.test.espresso.matcher.ViewMatchers.withResourceName | ||
import androidx.test.espresso.matcher.ViewMatchers.withText | ||
import androidx.test.uiautomator.By | ||
import androidx.test.uiautomator.UiSelector | ||
import androidx.test.uiautomator.Until | ||
import org.hamcrest.Matchers.allOf | ||
import org.mozilla.fenix.R | ||
import org.mozilla.fenix.helpers.ext.waitNotNull | ||
|
||
class ShareOverlayRobot { | ||
|
||
// This function verifies the share layout when more than one tab is shared - a list of tabs is shown | ||
fun verifyShareTabsOverlay(vararg tabsTitles: String) { | ||
onView(withId(R.id.shared_site_list)) | ||
.check(matches(isDisplayed())) | ||
for (tabs in tabsTitles) { | ||
onView(withText(tabs)) | ||
.check( | ||
matches( | ||
allOf( | ||
hasSibling(withId(R.id.share_tab_favicon)), | ||
hasSibling(withId(R.id.share_tab_url)) | ||
) | ||
) | ||
) | ||
} | ||
} | ||
|
||
// This function verifies the share layout when a single tab is shared - no tab info shown | ||
fun verifyShareTabLayout() = assertShareTabLayout() | ||
|
||
// this verifies the Android sharing layout - not customized for sharing tabs | ||
fun verifyAndroidShareLayout() { | ||
mDevice.waitNotNull(Until.findObject(By.res("android:id/resolver_list"))) | ||
} | ||
|
||
fun selectAppToShareWith(appName: String) = | ||
mDevice.findObject(UiSelector().text(appName)).clickAndWaitForNewWindow() | ||
|
||
fun verifySendToDeviceTitle() = assertSendToDeviceTitle() | ||
|
||
fun verifyShareALinkTitle() = assertShareALinkTitle() | ||
|
||
fun verifySharedTabsIntent(text: String, subject: String) { | ||
Intents.intended( | ||
allOf( | ||
IntentMatchers.hasExtra(Intent.EXTRA_TEXT, text), | ||
IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, subject) | ||
) | ||
) | ||
} | ||
|
||
class Transition | ||
} | ||
|
||
private fun shareTabsLayout() = onView(withResourceName("shareWrapper")) | ||
|
||
private fun assertShareTabLayout() = | ||
shareTabsLayout().check(matches(isDisplayed())) | ||
|
||
private fun sendToDeviceTitle() = | ||
onView( | ||
allOf( | ||
withText("SEND TO DEVICE"), | ||
withResourceName("accountHeaderText") | ||
) | ||
) | ||
|
||
private fun assertSendToDeviceTitle() = sendToDeviceTitle() | ||
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) | ||
|
||
private fun shareALinkTitle() = | ||
onView( | ||
allOf( | ||
withText("ALL ACTIONS"), | ||
withResourceName("apps_link_header") | ||
) | ||
) | ||
|
||
private fun assertShareALinkTitle() = shareALinkTitle() |
Oops, something went wrong.