Bug 1859489 - Fix tests with redirected SUMO URLs r=ajoltan

Try runs are green https://treeherder.mozilla.org/jobs?repo=try&revision=4510b16a78301e98238674590266256d9f7ae11d&selectedTaskRun=FL2e3Cd6S4OcKmt1at8Dww.0

Differential Revision: https://phabricator.services.mozilla.com/D212415
This commit is contained in:
oana.horvath 2024-06-04 08:15:17 +00:00
parent 662649f8d5
commit 067c567d3a
4 changed files with 47 additions and 13 deletions

View file

@ -9,7 +9,6 @@ import androidx.test.espresso.Espresso.pressBack
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.customannotations.SmokeTest
@ -263,7 +262,6 @@ class SettingsSearchTest : TestSetup() {
}
// TestRail link: https://testrail.stage.mozaws.net/index.php?/cases/view/2203343
@Ignore("Too many requests, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1859489")
@Test
fun verifyLearnMoreLinksFromAddSearchEngineSectionTest() {
homeScreen {
@ -273,18 +271,14 @@ class SettingsSearchTest : TestSetup() {
openDefaultSearchEngineMenu()
openAddSearchEngineMenu()
}.clickCustomSearchStringLearnMoreLink {
verifyUrl(
"support.mozilla.org/en-US/kb/manage-my-default-search-engines-firefox-android?as=u&utm_source=inproduct",
)
verifyCustomSearchEngineLearnMoreURL()
}.openThreeDotMenu {
}.openSettings {
}.openSearchSubMenu {
openDefaultSearchEngineMenu()
openAddSearchEngineMenu()
}.clickCustomSearchSuggestionsLearnMoreLink {
verifyUrl(
"support.mozilla.org/en-US/kb/manage-my-default-search-engines-firefox-android?as=u&utm_source=inproduct",
)
verifyCustomSearchEngineLearnMoreURL()
}
}

View file

@ -72,7 +72,7 @@ class SponsoredShortcutsTest : TestSetup() {
sponsoredShortcutTitle = getSponsoredShortcutTitle(2)
}.openContextMenuOnSponsoredShortcut(sponsoredShortcutTitle) {
}.clickSponsorsAndPrivacyButton {
verifyUrl("support.mozilla.org/en-US/kb/sponsor-privacy")
verifySponsoredShortcutsLearnMoreURL()
}
}

View file

@ -110,28 +110,68 @@ class BrowserRobot {
}
fun verifyHelpUrl() {
verifyUrl("support.mozilla.org/")
try {
verifyUrl("support.mozilla.org/en-US/products/mobile")
} catch (e: AssertionError) {
Log.i(TAG, "verifyHelpUrl: AssertionError caught, checking redirect URL")
verifyUrl(
SupportUtils.getSumoURLForTopic(
appContext,
SupportUtils.SumoTopic.HELP,
).replace("https://", ""),
)
}
}
fun verifyWhatsNewURL() {
verifyUrl("mozilla.org/")
try {
verifyUrl("/releaseNotes")
} catch (e: AssertionError) {
Log.i(TAG, "verifyWhatsNewURL: AssertionError caught, checking redirect URL")
verifyUrl(SupportUtils.WHATS_NEW_URL)
}
}
fun verifyRateOnGooglePlayURL() {
verifyUrl("play.google.com/store/apps/details?id=org.mozilla.fenix")
}
fun verifyCustomSearchEngineLearnMoreURL() {
try {
verifyUrl("support.mozilla.org/en-US/kb/manage-my-default-search-engines-firefox-android")
} catch (e: AssertionError) {
Log.i(TAG, "verifyCustomSearchEngineLearnMoreLink: AssertionError caught, checking redirect URL")
verifyUrl(
SupportUtils.getSumoURLForTopic(
appContext,
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES,
).replace("https://", ""),
)
}
}
fun verifyETPLearnMoreURL() {
try {
verifyUrl("support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-android")
} catch (e: AssertionError) {
Log.i(TAG, "verifyETPURL: AssertionError caught, executing fallback methods")
Log.i(TAG, "verifyETPURL: AssertionError caught, checking redirect URL")
verifyUrl(
SupportUtils.getSumoURLForTopic(appContext, SupportUtils.SumoTopic.TOTAL_COOKIE_PROTECTION).replace("https://", ""),
)
}
}
fun verifySponsoredShortcutsLearnMoreURL() {
try {
verifyUrl("support.mozilla.org/en-US/kb/sponsor-privacy")
} catch (e: AssertionError) {
Log.i(TAG, "verifySponsoredShortcutsURL: AssertionError caught, checking redirect URL")
verifyUrl(
SupportUtils.getSumoURLForTopic(appContext, SupportUtils.SumoTopic.SPONSOR_PRIVACY).replace("https://", ""),
)
}
}
/* Asserts that the text within DOM element with ID="testContent" has the given text, i.e.
* document.querySelector('#testContent').innerText == expectedText
*

View file

@ -129,7 +129,7 @@ class SettingsSubMenuAboutRobot {
Log.i(TAG, "verifySupport: Clicked the \"Support\" link")
browserScreen {
verifyUrl("support.mozilla.org")
verifyHelpUrl()
}
}