Skip to content

Commit

Permalink
fetch_configs, launchers: add focus support (bug 1852620)
Browse files Browse the repository at this point in the history
- add "focus" as an app option
- add FocusNightlyConfigMixin and FocusConfig classes
- add FocusLauncher class
- add "fenix" to parametrized tests
  • Loading branch information
zzzeid committed Sep 20, 2023
1 parent 350f960 commit 4626c11
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
10 changes: 8 additions & 2 deletions mozregression/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def create_parser(defaults):
"x86_64",
),
default=None,
help=("Force alternate build (applies to GVE and Fenix)."),
help=("Force alternate build (applies to GVE, Fenix, and Focus)."),
)

parser.add_argument(
Expand Down Expand Up @@ -573,12 +573,18 @@ def validate(self):
"x86",
"x86_64",
],
"focus": [
"arm64-v8a",
"armeabi-v7a",
"x86",
"x86_64",
],
}

user_defined_bits = options.bits is not None
options.bits = parse_bits(options.bits or mozinfo.bits)
if options.arch is not None:
if options.app not in ("gve", "fenix"):
if options.app not in ("gve", "fenix", "focus"):
self.logger.warning("--arch ignored for non Android apps.")
options.arch = None
else:
Expand Down
15 changes: 14 additions & 1 deletion mozregression/fetch_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ def get_nightly_repo_regex(self, date):
return self._get_nightly_repo_regex(date, repo)


class FocusNightlyConfigMixin(FenixNightlyConfigMixin):
nightly_base_repo_name = "focus"

def _get_nightly_repo(self, date):
return "focus"


class IntegrationConfigMixin(metaclass=ABCMeta):
"""
Define the integration-related required configuration.
Expand Down Expand Up @@ -623,7 +630,7 @@ def available_bits(self):
@REGISTRY.register("fenix")
class FenixConfig(CommonConfig, FenixNightlyConfigMixin):
def build_regex(self):
return r"fenix-.*\.apk"
return r"fenix-.+\.apk"

def available_bits(self):
return ()
Expand All @@ -650,6 +657,12 @@ def should_use_archive(self):
return True


@REGISTRY.register("focus")
class FocusConfig(FenixConfig, FocusNightlyConfigMixin):
def build_regex(self):
return r"focus-.+\.apk"


@REGISTRY.register("gve")
class GeckoViewExampleConfig(CommonConfig, FennecNightlyConfigMixin, FennecIntegrationConfigMixin):
BUILD_TYPES = ("shippable", "opt", "debug")
Expand Down
13 changes: 13 additions & 0 deletions mozregression/launchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,19 @@ def _launch(self):
self.launch_browser(self.package_name, ".IntentReceiverActivity")


@REGISTRY.register("focus")
class FocusLauncher(AndroidLauncher):
def _get_package_name(self):
return "org.mozilla.focus.nightly"

def _launch(self):
LOG.debug("Launching focus")
self.launch_browser(
self.package_name,
"org.mozilla.focus.activity.IntentReceiverActivity",
)


@REGISTRY.register("gve")
class GeckoViewExampleLauncher(AndroidLauncher):
def _get_package_name(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_fetch_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_nightly_repo_regex_before_2009_01_09(self):
TestThunderbirdConfig.test_nightly_repo_regex_before_2009_01_09(self)


@pytest.mark.parametrize("app_name", ["fennec", "fenix"])
@pytest.mark.parametrize("app_name", ["fennec", "fenix", "focus"])
class TestExtendedAndroidConfig:
def test_get_nightly_repo_regex(self, app_name):
if app_name == "fennec":
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_launchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ def test_firefox_install(
[
(launchers.FennecLauncher, "org.mozilla.fennec", "org.mozilla.gecko.BrowserApp"),
(launchers.FenixLauncher, "org.mozilla.fenix", ".IntentReceiverActivity"),
(
launchers.FocusLauncher,
"org.mozilla.focus.nightly",
"org.mozilla.focus.activity.IntentReceiverActivity",
),
],
)
class TestExtendedAndroidLauncher:
Expand Down

0 comments on commit 4626c11

Please sign in to comment.