From 6e813a62c7bdc9946fc30030a079c9d8a7757376 Mon Sep 17 00:00:00 2001 From: Benjamin Forehand Jr Date: Tue, 26 Sep 2023 14:41:50 -0500 Subject: [PATCH] Bug 1854173 - Add nimbus messaging integration test - Landscape UI (#3726) --- .../SurveyExperimentIntegrationTest.kt | 11 +++++++++++ .../mozilla/fenix/experimentintegration/conftest.py | 1 + .../fenix/experimentintegration/test_integration.py | 5 +++++ .../java/org/mozilla/fenix/ui/robots/BrowserRobot.kt | 1 - 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/SurveyExperimentIntegrationTest.kt b/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/SurveyExperimentIntegrationTest.kt index 18fb391051..d916a034a0 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/SurveyExperimentIntegrationTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/SurveyExperimentIntegrationTest.kt @@ -4,6 +4,7 @@ package org.mozilla.fenix.experimentintegration +import android.content.pm.ActivityInfo import org.junit.After import org.junit.Before import org.junit.Rule @@ -26,6 +27,7 @@ class SurveyExperimentIntegrationTest { isJumpBackInCFREnabled = false, isPWAsPromptEnabled = false, isTCPCFREnabled = false, + isDeleteSitePermissionsEnabled = true, ) @Before @@ -69,4 +71,13 @@ class SurveyExperimentIntegrationTest { verifyExperimentExists(experimentName) } } + + @Test + fun checkSurveyLandscapeLooksCorrect() { + activityTestRule.activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE + browserScreen { + verifySurveyNoThanksButton() + verifySurveyButton() + } + } } diff --git a/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/conftest.py b/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/conftest.py index 27b2f2f1f3..602d802fc2 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/conftest.py +++ b/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/conftest.py @@ -160,6 +160,7 @@ def fixture_setup_experiment(experiment_slug, json_data, gradlewbuild_log): def _(branch): logging.info(f"Testing experiment {experiment_slug}, BRANCH: {branch[0]}") command = f"nimbus-cli --app fenix --channel developer enroll {experiment_slug} --branch {branch[0]} --file {json_data} --reset-app" + logging.info(f"Running command {command}") try: out = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: diff --git a/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/test_integration.py b/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/test_integration.py index 9e88c5df69..76ff4e9925 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/test_integration.py +++ b/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/test_integration.py @@ -10,3 +10,8 @@ def test_survey_navigates_correctly(setup_experiment, gradlewbuild, load_branche def test_survey_no_thanks_navigates_correctly(setup_experiment, gradlewbuild, load_branches): setup_experiment(load_branches) gradlewbuild.test("SurveyExperimentIntegrationTest#checkSurveyNoThanksNavigatesCorrectly") + +@pytest.mark.parametrize("load_branches", [("branch")], indirect=True) +def test_survey_landscape_looks_correct(setup_experiment, gradlewbuild, load_branches): + setup_experiment(load_branches) + gradlewbuild.test("SurveyExperimentIntegrationTest#checkSurveyLandscapeLooksCorrect") diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt index ebd6515623..4c0d9fb34b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt @@ -910,7 +910,6 @@ class BrowserRobot { button.waitForExists(waitingTime) button.click() } - fun clickNoThanksSurveyButton() { val button = mDevice.findObject( UiSelector().text(