2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Bug 1855489 - Add nimbus homescreen message test - Tap X button (#3822)

* Bug 1855489 - Add nimbus homescreen message test - Tap X button

* Change after test steps.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Benjamin Forehand Jr 2023-09-28 13:34:15 -05:00 committed by GitHub
parent 3ce7aabdd9
commit 1d386b729c
4 changed files with 61 additions and 11 deletions

View File

@ -40,6 +40,15 @@ class SurveyExperimentIntegrationTest {
TestHelper.appContext.settings().showSecretDebugMenuThisSession = false
}
fun checkExperimentExists() {
homeScreen {
}.openThreeDotMenu {
}.openSettings {
}.openExperimentsMenu {
verifyExperimentExists(experimentName)
}
}
@Test
fun checkSurveyNavigatesCorrectly() {
browserScreen {
@ -48,12 +57,7 @@ class SurveyExperimentIntegrationTest {
verifyUrl(surveyURL)
}
homeScreen {
}.openThreeDotMenu {
}.openSettings {
}.openExperimentsMenu {
verifyExperimentExists(experimentName)
}
checkExperimentExists()
}
@Test
@ -64,12 +68,19 @@ class SurveyExperimentIntegrationTest {
verifyTabCounter("0")
}
homeScreen {
}.openThreeDotMenu {
}.openSettings {
}.openExperimentsMenu {
verifyExperimentExists(experimentName)
checkExperimentExists()
}
@Test
fun checkHomescreenSurveyDismissesCorrectly() {
browserScreen {
verifyHomeScreenSurveyCloseButton()
}.clickHomeScreenSurveyCloseButton {
verifyTabCounter("0")
verifySurveyButtonDoesNotExist()
}
checkExperimentExists()
}
@Test
@ -79,5 +90,7 @@ class SurveyExperimentIntegrationTest {
verifySurveyNoThanksButton()
verifySurveyButton()
}
checkExperimentExists()
}
}

View File

@ -64,6 +64,8 @@ def gradlewbuild(gradlewbuild_log):
def fixture_experiment_data(experiment_url):
data = requests.get(experiment_url).json()
for item in data["branches"][0]["features"][0]["value"]["messages"].values():
item["surface"] = "homescreen"
item["style"] = "URGENT"
for count, trigger in enumerate(item["trigger"]):
if "USER_EN_SPEAKER" not in trigger:
del(item["trigger"][count])

View File

@ -11,6 +11,11 @@ def test_survey_no_thanks_navigates_correctly(setup_experiment, gradlewbuild, lo
setup_experiment(load_branches)
gradlewbuild.test("SurveyExperimentIntegrationTest#checkSurveyNoThanksNavigatesCorrectly")
@pytest.mark.parametrize("load_branches", [("branch")], indirect=True)
def test_homescreen_survey_dismisses_correctly(setup_experiment, gradlewbuild, load_branches):
setup_experiment(load_branches)
gradlewbuild.test("SurveyExperimentIntegrationTest#checkHomescreenSurveyDismissesCorrectly")
@pytest.mark.parametrize("load_branches", [("branch")], indirect=True)
def test_survey_landscape_looks_correct(setup_experiment, gradlewbuild, load_branches):
setup_experiment(load_branches)

View File

@ -882,6 +882,17 @@ class BrowserRobot {
assertTrue(button.waitForExists(waitingTime))
}
fun verifySurveyButtonDoesNotExist() {
val button = mDevice.findObject(
UiSelector().text(
getStringResource(
R.string.preferences_take_survey,
),
),
)
assertTrue(button.waitUntilGone(waitingTime))
}
fun verifySurveyNoThanksButton() {
val button = mDevice.findObject(
UiSelector().text(
@ -893,6 +904,15 @@ class BrowserRobot {
assertTrue(button.waitForExists(waitingTime))
}
fun verifyHomeScreenSurveyCloseButton() {
val button = mDevice.findObject(
UiSelector().descriptionContains(
"Close",
),
)
assertTrue(button.waitForExists(waitingTime))
}
fun clickOpenLinksInAppsDismissCFRButton() =
itemWithResIdContainingText(
"$packageName:id/dismiss",
@ -1262,6 +1282,13 @@ class BrowserRobot {
surveyNoThanksButton.waitForExists(waitingTime)
surveyNoThanksButton.click()
BrowserRobot().interact()
return Transition()
}
fun clickHomeScreenSurveyCloseButton(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
homescreenSurveyCloseButton.waitForExists(waitingTime)
homescreenSurveyCloseButton.click()
BrowserRobot().interact()
return Transition()
}
@ -1420,3 +1447,6 @@ private val surveyButton =
private val surveyNoThanksButton =
itemContainingText(getStringResource(R.string.preferences_not_take_survey))
private val homescreenSurveyCloseButton =
itemWithDescription("Close")