Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pytest-repeat = "^0.9.3"
flask = "^3.1.0"
python-dateutil = "^2.9.0.post0"
tox = "^4.31.0"
ruff = "^0.14.4"

[build-system]
requires = ["poetry-core"]
Expand Down
15 changes: 11 additions & 4 deletions tests/android/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def fixture_experiment_feature(request):

@pytest.fixture(name="check_ping_for_experiment")
def fixture_check_ping_for_experiment(experiment_slug, variables):
def _check_ping_for_experiment(branch=None, experiment=experiment_slug, reason=None):
def _check_ping_for_experiment(
branch=None, experiment=experiment_slug, reason=None
):
model = TelemetryModel(branch=branch, experiment=experiment)

timeout = time.time() + 60 * 5
Expand All @@ -142,7 +144,8 @@ def _check_ping_for_experiment(branch=None, experiment=experiment_slug, reason=N
for event in events:
event_name = event.get("name")
if (reason == "enrollment" and event_name == "enrollment") or (
reason == "unenrollment" and event_name in ["unenrollment", "disqualification"]
reason == "unenrollment"
and event_name in ["unenrollment", "disqualification"]
):
telemetry_model = TelemetryModel(
branch=event["extra"]["branch"],
Expand Down Expand Up @@ -278,7 +281,9 @@ def fixture_dismiss_system_dialogs():


@pytest.fixture(name="setup_experiment")
def fixture_setup_experiment(run_nimbus_cli_command, experiment_slug, experiment_branch):
def fixture_setup_experiment(
run_nimbus_cli_command, experiment_slug, experiment_branch
):
def setup_experiment():
logging.info("====== Beginning Test ======")
command = [
Expand All @@ -294,6 +299,8 @@ def setup_experiment():
"--reset-app",
]
run_nimbus_cli_command(" ".join(command))
time.sleep(10) # Wait a while as there's no real way to know when the app has started
time.sleep(
10
) # Wait a while as there's no real way to know when the app has started

return setup_experiment
4 changes: 3 additions & 1 deletion tests/android/generate_smoke_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

parser = argparse.ArgumentParser("Options for android apk downloader")

parser.add_argument("--test-files", nargs="+", help="List of test files to generate tests from")
parser.add_argument(
"--test-files", nargs="+", help="List of test files to generate tests from"
)
args = parser.parse_args()


Expand Down
8 changes: 6 additions & 2 deletions tests/android/tests/test_generic_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@


@pytest.mark.generic_test
def test_experiment_unenrolls_via_studies_toggle(setup_experiment, gradlewbuild, open_app):
def test_experiment_unenrolls_via_studies_toggle(
setup_experiment, gradlewbuild, open_app
):
setup_experiment()
open_app()
gradlewbuild.test("GenericExperimentIntegrationTest#disableStudiesViaStudiesToggle")
Expand All @@ -25,6 +27,8 @@ def test_experiment_unenrolls_via_secret_menu(
):
setup_experiment()
open_app()
gradlewbuild.test("GenericExperimentIntegrationTest#testExperimentUnenrolledViaSecretMenu")
gradlewbuild.test(
"GenericExperimentIntegrationTest#testExperimentUnenrolledViaSecretMenu"
)
gradlewbuild.test("GenericExperimentIntegrationTest#testExperimentUnenrolled")
assert check_ping_for_experiment(reason="unenrollment", branch=load_branches[0])
12 changes: 9 additions & 3 deletions tests/android/tests/test_survey_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ def test_survey_navigates_correctly(setup_experiment, gradlewbuild):
@pytest.mark.messaging_survey
def test_survey_no_thanks_navigates_correctly(setup_experiment, gradlewbuild):
setup_experiment()
gradlewbuild.test("SurveyExperimentIntegrationTest#checkSurveyNoThanksNavigatesCorrectly")
gradlewbuild.test(
"SurveyExperimentIntegrationTest#checkSurveyNoThanksNavigatesCorrectly"
)


@pytest.mark.messaging_homescreen
def test_homescreen_survey_dismisses_correctly(setup_experiment, gradlewbuild):
setup_experiment()
gradlewbuild.test("SurveyExperimentIntegrationTest#checkHomescreenSurveyDismissesCorrectly")
gradlewbuild.test(
"SurveyExperimentIntegrationTest#checkHomescreenSurveyDismissesCorrectly"
)


@pytest.mark.messaging_survey
def test_survey_landscape_looks_correct(setup_experiment, gradlewbuild):
setup_experiment()
gradlewbuild.test("SurveyExperimentIntegrationTest#checkSurveyLandscapeLooksCorrect")
gradlewbuild.test(
"SurveyExperimentIntegrationTest#checkSurveyLandscapeLooksCorrect"
)
Loading