|
|
|
@ -12,21 +12,24 @@ import androidx.core.content.pm.PackageInfoCompat
|
|
|
|
|
import androidx.test.espresso.Espresso
|
|
|
|
|
import androidx.test.espresso.Espresso.onView
|
|
|
|
|
import androidx.test.espresso.ViewAssertion
|
|
|
|
|
import androidx.test.platform.app.InstrumentationRegistry
|
|
|
|
|
import androidx.test.uiautomator.UiDevice
|
|
|
|
|
import org.hamcrest.CoreMatchers
|
|
|
|
|
import androidx.test.espresso.action.ViewActions
|
|
|
|
|
import androidx.test.espresso.action.ViewActions.click
|
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
|
|
|
|
import androidx.test.platform.app.InstrumentationRegistry
|
|
|
|
|
import androidx.test.uiautomator.UiDevice
|
|
|
|
|
import org.hamcrest.CoreMatchers
|
|
|
|
|
import org.hamcrest.CoreMatchers.containsString
|
|
|
|
|
import org.mozilla.fenix.BuildConfig
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper
|
|
|
|
|
import org.mozilla.fenix.helpers.isVisibleForUser
|
|
|
|
|
import org.mozilla.fenix.settings.SupportUtils
|
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
|
import java.time.LocalDateTime
|
|
|
|
|
import java.time.format.DateTimeFormatterBuilder
|
|
|
|
@ -57,12 +60,25 @@ private fun assertFirefoxPreviewPage() {
|
|
|
|
|
assertVersionNumber()
|
|
|
|
|
assertProductCompany()
|
|
|
|
|
assertCurrentTimestamp()
|
|
|
|
|
verifyListElements()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun navigateBackToAboutPage(itemToInteract: () -> Unit) {
|
|
|
|
|
homeScreen {
|
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
|
}.openSettings {
|
|
|
|
|
}.openAboutFirefoxPreview {
|
|
|
|
|
itemToInteract()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun verifyListElements() {
|
|
|
|
|
assertWhatIsNewInFirefoxPreview()
|
|
|
|
|
assertSupport()
|
|
|
|
|
assertPrivacyNotice()
|
|
|
|
|
assertKnowYourRights()
|
|
|
|
|
assertLicensingInformation()
|
|
|
|
|
assertLibrariesUsed()
|
|
|
|
|
navigateBackToAboutPage(::assertSupport)
|
|
|
|
|
navigateBackToAboutPage(::assertPrivacyNotice)
|
|
|
|
|
navigateBackToAboutPage(::assertKnowYourRights)
|
|
|
|
|
navigateBackToAboutPage(::assertLicensingInformation)
|
|
|
|
|
navigateBackToAboutPage(::assertLibrariesUsed)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun assertVersionNumber() {
|
|
|
|
@ -100,106 +116,102 @@ private fun assertCurrentTimestamp() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun assertWhatIsNewInFirefoxPreview() {
|
|
|
|
|
TestHelper.scrollToElementByText("What’s new in Firefox Preview")
|
|
|
|
|
if (!onView(withText("What’s new in Firefox Preview")).isVisibleForUser()) {
|
|
|
|
|
onView(withId(R.id.about_layout)).perform(ViewActions.swipeUp())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onView(withText("What’s new in Firefox Preview"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
// This is used to wait for the webpage to fully load
|
|
|
|
|
TestHelper.waitUntilObjectIsFound("org.mozilla.fenix.debug:id/mozac_browser_toolbar_title_view")
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.mozac_browser_toolbar_title_view)).check(
|
|
|
|
|
matches(
|
|
|
|
|
withText(
|
|
|
|
|
containsString("What's new in Firefox Preview")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
TestHelper.verifyUrl(
|
|
|
|
|
SupportUtils.SumoTopic.WHATS_NEW.topicStr,
|
|
|
|
|
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
|
|
|
|
R.id.mozac_browser_toolbar_url_view
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Espresso.pressBack()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun assertSupport() {
|
|
|
|
|
TestHelper.scrollToElementByText("Support")
|
|
|
|
|
if (!onView(withText("Support")).isVisibleForUser()) {
|
|
|
|
|
onView(withId(R.id.about_layout)).perform(ViewActions.swipeUp())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onView(withText("Support"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
// This is used to wait for the webpage to fully load
|
|
|
|
|
TestHelper.waitUntilObjectIsFound("org.mozilla.fenix.debug:id/mozac_browser_toolbar_title_view")
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.mozac_browser_toolbar_title_view)).check(
|
|
|
|
|
matches(
|
|
|
|
|
withText(
|
|
|
|
|
containsString("Firefox Preview Help")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
TestHelper.verifyUrl(
|
|
|
|
|
"support.mozilla.org",
|
|
|
|
|
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
|
|
|
|
R.id.mozac_browser_toolbar_url_view
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Espresso.pressBack()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun assertPrivacyNotice() {
|
|
|
|
|
TestHelper.scrollToElementByText("Privacy Notice")
|
|
|
|
|
if (!onView(withText("Privacy notice")).isVisibleForUser()) {
|
|
|
|
|
onView(withId(R.id.about_layout)).perform(ViewActions.swipeUp())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onView(withText("Privacy notice"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
// This is used to wait for the webpage to fully load
|
|
|
|
|
TestHelper.waitUntilObjectIsFound("org.mozilla.fenix.debug:id/mozac_browser_toolbar_title_view")
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.mozac_browser_toolbar_title_view)).check(
|
|
|
|
|
matches(
|
|
|
|
|
withText(
|
|
|
|
|
containsString("Firefox Privacy Notice")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
TestHelper.verifyUrl(
|
|
|
|
|
"/privacy/firefox",
|
|
|
|
|
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
|
|
|
|
R.id.mozac_browser_toolbar_url_view
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Espresso.pressBack()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun assertKnowYourRights() {
|
|
|
|
|
TestHelper.scrollToElementByText("Know your rights")
|
|
|
|
|
if (!onView(withText("Know your rights")).isVisibleForUser()) {
|
|
|
|
|
onView(withId(R.id.about_layout)).perform(ViewActions.swipeUp())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onView(withText("Know your rights"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
// This is used to wait for the webpage to fully load
|
|
|
|
|
TestHelper.waitUntilObjectIsFound("org.mozilla.fenix.debug:id/mozac_browser_toolbar_title_view")
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.mozac_browser_toolbar_title_view)).check(
|
|
|
|
|
matches(
|
|
|
|
|
withText(
|
|
|
|
|
containsString("Firefox Preview - Your Rights | Firefox Preview Help")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
TestHelper.verifyUrl(
|
|
|
|
|
SupportUtils.SumoTopic.YOUR_RIGHTS.topicStr,
|
|
|
|
|
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
|
|
|
|
R.id.mozac_browser_toolbar_url_view
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Espresso.pressBack()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun assertLicensingInformation() {
|
|
|
|
|
TestHelper.scrollToElementByText("Libraries that we use")
|
|
|
|
|
if (!onView(withText("Licensing information")).isVisibleForUser()) {
|
|
|
|
|
onView(withId(R.id.about_layout)).perform(ViewActions.swipeUp())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onView(withText("Licensing information"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
// This is used to wait for the webpage to fully load
|
|
|
|
|
TestHelper.waitUntilObjectIsFound("org.mozilla.fenix.debug:id/mozac_browser_toolbar_title_view")
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.mozac_browser_toolbar_title_view)).check(
|
|
|
|
|
matches(
|
|
|
|
|
withText(
|
|
|
|
|
containsString("Licenses")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
TestHelper.verifyUrl(
|
|
|
|
|
"about:license",
|
|
|
|
|
"org.mozilla.fenix.debug:id/mozac_browser_toolbar_url_view",
|
|
|
|
|
R.id.mozac_browser_toolbar_url_view
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Espresso.pressBack()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun assertLibrariesUsed() {
|
|
|
|
|
TestHelper.scrollToElementByText("Libraries that we use")
|
|
|
|
|
if (!onView(withText("Libraries that we use")).isVisibleForUser()) {
|
|
|
|
|
onView(withId(R.id.about_layout)).perform(ViewActions.swipeUp())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onView(withText("Libraries that we use"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.action_bar)).check(matches(hasDescendant(withText(containsString("Firefox Preview | OSS Libraries")))))
|
|
|
|
|