This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oana Horvath
committed
Nov 24, 2021
1 parent
693a1dd
commit 302b07e
Showing
7 changed files
with
144 additions
and
62 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
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
80 changes: 80 additions & 0 deletions
80
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,80 @@ | ||
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.withText | ||
import androidx.test.uiautomator.UiSelector | ||
import org.hamcrest.Matchers.allOf | ||
import org.mozilla.fenix.R | ||
import org.mozilla.fenix.share.ShareFragment | ||
|
||
class ShareOverlayRobot { | ||
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)) | ||
) | ||
) | ||
) | ||
} | ||
} | ||
|
||
fun selectAppToShareWith(appName: String) = | ||
mDevice.findObject(UiSelector().text(appName)).click() | ||
|
||
fun verifyShareScrim() = assertShareScrim() | ||
|
||
fun verifySendToDeviceTitle() = assertSendToDeviceTitle() | ||
|
||
fun verifyShareALinkTitle() = assertShareALinkTitle() | ||
|
||
fun verifyShareIntent(text: String, subject: String) { | ||
Intents.intended( | ||
allOf( | ||
IntentMatchers.hasExtra(Intent.EXTRA_TEXT, text), | ||
IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, subject) | ||
) | ||
) | ||
} | ||
|
||
class Transition | ||
} | ||
|
||
private fun shareScrim() = onView(ViewMatchers.withResourceName("closeSharingScrim")) | ||
|
||
private fun assertShareScrim() = | ||
shareScrim().check(matches(ViewMatchers.withAlpha(ShareFragment.SHOW_PAGE_ALPHA))) | ||
|
||
private fun SendToDeviceTitle() = | ||
onView( | ||
allOf( | ||
ViewMatchers.withText("SEND TO DEVICE"), | ||
ViewMatchers.withResourceName("accountHeaderText") | ||
) | ||
) | ||
|
||
private fun assertSendToDeviceTitle() = SendToDeviceTitle() | ||
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) | ||
|
||
private fun shareALinkTitle() = | ||
onView( | ||
allOf( | ||
ViewMatchers.withText("ALL ACTIONS"), | ||
ViewMatchers.withResourceName("apps_link_header") | ||
) | ||
) | ||
|
||
private fun assertShareALinkTitle() = shareALinkTitle() |
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