Bug 1825116 - Resolve many black, isort, and file-whitespace lint issues

fenix/114.1.0
Geoff Brown 1 year ago committed by mergify[bot]
parent b83d16558d
commit 5692b4b13b

@ -1,8 +1,8 @@
# Community Participation Guidelines
This repository is governed by Mozilla's code of conduct and etiquette guidelines.
This repository is governed by Mozilla's code of conduct and etiquette guidelines.
For more details, please read the
[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/).
[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/).
## How to Report
For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page.

@ -10,4 +10,4 @@
</audio>
</div>
</body>
</html>
</html>

@ -7,4 +7,4 @@
<p id="testContent">Page content: 1</p>
</h1>
</body>
</html>
</html>

@ -7,4 +7,4 @@
<p id="testContent">Page content: 2</p>
</h1>
</body>
</html>
</html>

@ -10,4 +10,4 @@
</p>
</h1>
</body>
</html>
</html>

@ -20,4 +20,4 @@
</script>
</body>
</html>
</html>

@ -25,4 +25,4 @@
</script>
</body>
</html>
</html>

@ -11,4 +11,4 @@
</video>
</div>
</body>
</html>
</html>

@ -1,16 +1,17 @@
import logging
import subprocess
import os
logging.getLogger(__name__).addHandler(logging.NullHandler())
class ADBrun(object):
binary = 'adbrun'
binary = "adbrun"
logger = logging.getLogger()
def launch(self):
# First close sim if any then launch
os.system('~/Library/Android/sdk/platform-tools/adb devices | grep emulator | cut -f1 | while read line; do ~/Library/Android/sdk/platform-tools/adb -s $line emu kill; done')
os.system(
"~/Library/Android/sdk/platform-tools/adb devices | grep emulator | cut -f1 | while read line; do ~/Library/Android/sdk/platform-tools/adb -s $line emu kill; done"
)
# Then launch sim
os.system("sh launchSimScript.sh")

@ -2,89 +2,92 @@ import io
import json
import os
import time
import os.path as path
from mozdownload import DirectScraper, FactoryScraper
from mozprofile import Profile
import mozinstall
import mozversion
import pytest
import requests
from mozdownload import DirectScraper, FactoryScraper
from mozprofile import Profile
from .tps import TPS
from .gradlewbuild import GradlewBuild
from .tps import TPS
here = os.path.dirname(__file__)
@pytest.fixture(scope='session')
@pytest.fixture(scope="session")
def firefox(pytestconfig, tmpdir_factory):
binary = os.getenv('MOZREGRESSION_BINARY',
pytestconfig.getoption('firefox'))
binary = os.getenv("MOZREGRESSION_BINARY", pytestconfig.getoption("firefox"))
if binary is None:
cache_dir = str(pytestconfig.cache.makedir('firefox'))
scraper = FactoryScraper('daily', destination=cache_dir)
cache_dir = str(pytestconfig.cache.makedir("firefox"))
scraper = FactoryScraper("daily", destination=cache_dir)
build_path = scraper.download()
install_path = str(tmpdir_factory.mktemp('firefox'))
install_path = str(tmpdir_factory.mktemp("firefox"))
install_dir = mozinstall.install(src=build_path, dest=install_path)
binary = mozinstall.get_binary(install_dir, 'firefox')
binary = mozinstall.get_binary(install_dir, "firefox")
version = mozversion.get_version(binary)
if hasattr(pytestconfig, '_metadata'):
if hasattr(pytestconfig, "_metadata"):
pytestconfig._metadata.update(version)
return binary
@pytest.fixture
def firefox_log(pytestconfig, tmpdir):
firefox_log = str(tmpdir.join('firefox.log'))
firefox_log = str(tmpdir.join("firefox.log"))
pytestconfig._firefox_log = firefox_log
yield firefox_log
@pytest.fixture(scope='session')
@pytest.fixture(scope="session")
def tps_addon(pytestconfig, tmpdir_factory):
path = pytestconfig.getoption('tps')
path = pytestconfig.getoption("tps")
if path is not None:
return path
task_url = 'https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/' \
'gecko.v2.mozilla-central.latest.firefox.addons.tps'
task_id = requests.get(task_url).json().get('taskId')
cache_dir = str(pytestconfig.cache.makedir('tps-{}'.format(task_id)))
addon_url = 'https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/' \
'{}/artifacts/public/tps.xpi'.format(task_id)
task_url = (
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
"gecko.v2.mozilla-central.latest.firefox.addons.tps"
)
task_id = requests.get(task_url).json().get("taskId")
cache_dir = str(pytestconfig.cache.makedir("tps-{}".format(task_id)))
addon_url = (
"https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/"
"{}/artifacts/public/tps.xpi".format(task_id)
)
scraper = DirectScraper(addon_url, destination=cache_dir)
return scraper.download()
@pytest.fixture
def tps_config(fxa_account, monkeypatch):
monkeypatch.setenv('FXA_EMAIL', fxa_account.email)
monkeypatch.setenv('FXA_PASSWORD', fxa_account.password)
monkeypatch.setenv("FXA_EMAIL", fxa_account.email)
monkeypatch.setenv("FXA_PASSWORD", fxa_account.password)
# Go to resources folder
os.chdir('../../../../..')
resources = r'resources'
os.chdir("../../../../..")
resources = r"resources"
resourcesDir = os.path.join(os.getcwd(), resources)
with open (os.path.join(resourcesDir, 'email.txt'), "w") as f:
with open(os.path.join(resourcesDir, "email.txt"), "w") as f:
f.write(fxa_account.email)
with open (os.path.join(resourcesDir, 'password.txt'), "w") as f:
with open(os.path.join(resourcesDir, "password.txt"), "w") as f:
f.write(fxa_account.password)
# Set the path where tests are
os.chdir('../')
os.chdir("../")
currentDir = os.getcwd()
testsDir = currentDir + "/androidTest/java/org/mozilla/fenix/syncintegration"
os.chdir(testsDir)
yield {'fx_account': {
'username': fxa_account.email,
'password': fxa_account.password}
yield {
"fx_account": {"username": fxa_account.email, "password": fxa_account.password}
}
@pytest.fixture
def tps_log(pytestconfig, tmpdir):
tps_log = str(tmpdir.join('tps.log'))
tps_log = str(tmpdir.join("tps.log"))
pytestconfig._tps_log = tps_log
yield tps_log
@ -92,89 +95,98 @@ def tps_log(pytestconfig, tmpdir):
@pytest.fixture
def tps_profile(pytestconfig, tps_addon, tps_config, tps_log, fxa_urls):
preferences = {
'app.update.enabled': False,
'browser.dom.window.dump.enabled': True,
'browser.onboarding.enabled': False,
'browser.sessionstore.resume_from_crash': False,
'browser.shell.checkDefaultBrowser': False,
'browser.startup.homepage_override.mstone': 'ignore',
'browser.startup.page': 0,
'browser.tabs.warnOnClose': False,
'browser.warnOnQuit': False,
'datareporting.policy.dataSubmissionEnabled': False,
"app.update.enabled": False,
"browser.dom.window.dump.enabled": True,
"browser.onboarding.enabled": False,
"browser.sessionstore.resume_from_crash": False,
"browser.shell.checkDefaultBrowser": False,
"browser.startup.homepage_override.mstone": "ignore",
"browser.startup.page": 0,
"browser.tabs.warnOnClose": False,
"browser.warnOnQuit": False,
"datareporting.policy.dataSubmissionEnabled": False,
# 'devtools.chrome.enabled': True,
# 'devtools.debugger.remote-enabled': True,
'engine.bookmarks.repair.enabled': False,
'extensions.autoDisableScopes': 10,
'extensions.experiments.enabled': True,
'extensions.update.enabled': False,
'extensions.update.notifyUser': False,
"engine.bookmarks.repair.enabled": False,
"extensions.autoDisableScopes": 10,
"extensions.experiments.enabled": True,
"extensions.update.enabled": False,
"extensions.update.notifyUser": False,
# While this line is commented prod is launched instead of stage
'identity.fxaccounts.autoconfig.uri': fxa_urls['content'],
'testing.tps.skipPingValidation': True,
'services.sync.firstSync': 'notReady',
'services.sync.lastversion': '1.0',
'services.sync.log.appender.console': 'Trace',
'services.sync.log.appender.dump': 'Trace',
'services.sync.log.appender.file.level': 'Trace',
'services.sync.log.appender.file.logOnSuccess': True,
'services.sync.log.logger': 'Trace',
'services.sync.log.logger.engine': 'Trace',
'services.sync.testing.tps': True,
'testing.tps.logFile': tps_log,
'toolkit.startup.max_resumed_crashes': -1,
'tps.config': json.dumps(tps_config),
'tps.seconds_since_epoch': int(time.time()),
'xpinstall.signatures.required': False
"identity.fxaccounts.autoconfig.uri": fxa_urls["content"],
"testing.tps.skipPingValidation": True,
"services.sync.firstSync": "notReady",
"services.sync.lastversion": "1.0",
"services.sync.log.appender.console": "Trace",
"services.sync.log.appender.dump": "Trace",
"services.sync.log.appender.file.level": "Trace",
"services.sync.log.appender.file.logOnSuccess": True,
"services.sync.log.logger": "Trace",
"services.sync.log.logger.engine": "Trace",
"services.sync.testing.tps": True,
"testing.tps.logFile": tps_log,
"toolkit.startup.max_resumed_crashes": -1,
"tps.config": json.dumps(tps_config),
"tps.seconds_since_epoch": int(time.time()),
"xpinstall.signatures.required": False,
}
profile = Profile(addons=[tps_addon], preferences=preferences)
pytestconfig._profile = profile.profile
yield profile
@pytest.fixture
def tps(firefox, firefox_log, monkeypatch, pytestconfig, tps_log, tps_profile):
yield TPS(firefox, firefox_log, tps_log, tps_profile)
@pytest.fixture
def gradlewbuild_log(pytestconfig, tmpdir):
gradlewbuild_log = str(tmpdir.join('gradlewbuild.log'))
gradlewbuild_log = str(tmpdir.join("gradlewbuild.log"))
pytestconfig._gradlewbuild_log = gradlewbuild_log
yield gradlewbuild_log
@pytest.fixture
def gradlewbuild(fxa_account, monkeypatch, gradlewbuild_log):
monkeypatch.setenv('FXA_EMAIL', fxa_account.email)
monkeypatch.setenv('FXA_PASSWORD', fxa_account.password)
monkeypatch.setenv("FXA_EMAIL", fxa_account.email)
monkeypatch.setenv("FXA_PASSWORD", fxa_account.password)
yield GradlewBuild(gradlewbuild_log)
def pytest_addoption(parser):
parser.addoption('--firefox', help='path to firefox binary (defaults to '
'downloading latest nightly build)')
parser.addoption('--tps', help='path to tps add-on (defaults to '
'downloading latest nightly build)')
parser.addoption(
"--firefox",
help="path to firefox binary (defaults to " "downloading latest nightly build)",
)
parser.addoption(
"--tps",
help="path to tps add-on (defaults to " "downloading latest nightly build)",
)
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
extra = getattr(report, 'extra', [])
pytest_html = item.config.pluginmanager.getplugin('html')
profile = getattr(item.config, '_profile', None)
extra = getattr(report, "extra", [])
pytest_html = item.config.pluginmanager.getplugin("html")
profile = getattr(item.config, "_profile", None)
if profile is not None and os.path.exists(profile):
# add sync logs to HTML report
for root, _, files in os.walk(os.path.join(profile, 'weave', 'logs')):
for root, _, files in os.walk(os.path.join(profile, "weave", "logs")):
for f in files:
path = os.path.join(root, f)
if pytest_html is not None:
with io.open(path, 'r', encoding='utf8') as f:
extra.append(pytest_html.extras.text(f.read(), 'Sync'))
report.sections.append(('Sync', 'Log: {}'.format(path)))
for log in ('Firefox', 'TPS', 'GradlewBuild'):
attr = '_{}_log'.format(log.lower())
with io.open(path, "r", encoding="utf8") as f:
extra.append(pytest_html.extras.text(f.read(), "Sync"))
report.sections.append(("Sync", "Log: {}".format(path)))
for log in ("Firefox", "TPS", "GradlewBuild"):
attr = "_{}_log".format(log.lower())
path = getattr(item.config, attr, None)
if path is not None and os.path.exists(path):
if pytest_html is not None:
with io.open(path, 'r', encoding='utf8') as f:
with io.open(path, "r", encoding="utf8") as f:
extra.append(pytest_html.extras.text(f.read(), log))
report.sections.append((log, 'Log: {}'.format(path)))
report.sections.append((log, "Log: {}".format(path)))
report.extra = extra

@ -1,13 +1,13 @@
import os
import sys
def test_sync_account_settings(tps, gradlewbuild):
gradlewbuild.test('checkAccountSettings')
gradlewbuild.test("checkAccountSettings")
def test_sync_history_from_desktop(tps, gradlewbuild):
tps.run('test_history.js')
gradlewbuild.test('checkHistoryFromDesktopTest')
'''
tps.run("test_history.js")
gradlewbuild.test("checkHistoryFromDesktopTest")
"""
def test_sync_bookmark_from_desktop(tps, gradlewbuild):
tps.run('test_bookmark.js')
gradlewbuild.test('checkBookmarkFromDesktopTest')
@ -23,4 +23,4 @@ def test_sync_bookmark_from_device(tps, gradlewbuild):
def test_sync_history_from_device(tps, gradlewbuild):
gradlewbuild.test('checkHistoryFromDeviceTest')
tps.run('test_history_desktop.js')
'''
"""

@ -6,7 +6,7 @@ The main tests are:
Simulates a COLD MAIN (app icon launch) launch to report FullyDrawn, e.g when the user sees the app fully drawn after launching it.
* COLD VIEW Nav start:
An app link launch to load a page. It measures until "navigation starts" which is an internal Gecko event that indicates we're starting to load a page.
An app link launch to load a page. It measures until "navigation starts" which is an internal Gecko event that indicates we're starting to load a page.
### What to do after a performance regression is reported.
@ -27,7 +27,7 @@ On the reported [ticket](https://github.com/mozilla-mobile/fenix/issues/25253),
![image](https://user-images.githubusercontent.com/773158/174879320-ace21f51-2892-4b1c-8c25-a10ee8d0174e.png)
We can find each commit hash date by downloading the APKs, from Task Cluster and going to the about page.
We can find each commit hash date by downloading the APKs, from Task Cluster and going to the about page.
For example:
@ -51,7 +51,7 @@ https://github.com/mozilla-mobile/fenix/compare/98455c01eeba7c63775f18817cd079f5
With it we can see each commit that could introduced the regression.
With it we can see each commit that could introduced the regression.
### Using backfill.py
@ -62,8 +62,8 @@ perf-tools-main % python3 backfill.py --tests cold_main_first_frame --startcommi
```
Where:
* **cold_main_first_frame**: it's the test we would like to run, we could also pass `cold_view_nav_start` depending on the regression type.
* **--startcommit**: it's the commit before the regression.
* **cold_main_first_frame**: it's the test we would like to run, we could also pass `cold_view_nav_start` depending on the regression type.
* **--startcommit**: it's the commit before the regression.
* **--endcommit** it's the commit where the regression appears.
* **--repository_to_test_path** is the path where your local Fenix repository is.
@ -89,7 +89,7 @@ These files are the output of the script:
* **Cold_main_first_frame-durations.txt**: Will contain the raw information of each repetition of the test.
With these files, we can identify which commit, introduced the regression by checking file by file which results are closer to the ones reported one the regression ticket.
With these files, we can identify which commit, introduced the regression by checking file by file which results are closer to the ones reported one the regression ticket.
After we found the regressing commit, we just have to update the ticket, posting our finding and tagging the person that introduced to research how to optimize the patch. Normally if the regression is significant we will ask to undo the commit until the patch is optimized.
@ -98,7 +98,7 @@ After we found the regressing commit, we just have to update the ticket, posting
* If you would like to graph the results you can use `python3 analyze_durations.py --graph results.txt`.
*Just keep in mind, the results provide from the Performance team are from running the tests on a Moto G 5. Running on a more powerful device could cause the results to diverge.
* In case, you need to start recording a profile in startup https://profiler.firefox.com/docs/#/./guide-startup-shutdown?id=firefox-for-android.
### Identifying the source of the regression.
Our main task, when looking for a performance regression is just to identify the faulty commit, but if we would like to figure out what is the exact cause, we will need to take [profile](https://wiki.mozilla.org/Performance/Fenix/Performance_reviews#Profile) from regressing version, and the version before to try to identify what could be causing the issue, checking the code path of the regressing commit could give us some hints to where to look.
Our main task, when looking for a performance regression is just to identify the faulty commit, but if we would like to figure out what is the exact cause, we will need to take [profile](https://wiki.mozilla.org/Performance/Fenix/Performance_reviews#Profile) from regressing version, and the version before to try to identify what could be causing the issue, checking the code path of the regressing commit could give us some hints to where to look.

@ -1,6 +1,6 @@
For an overview of our current architecture, please see [this document](https://github.com/mozilla-mobile/fenix/blob/master/docs/architecture-overview.md)
---
---
These are some of the major architecture decisions we've made so far in Fenix. [Why?](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions)
@ -90,4 +90,3 @@ We will experiment with writing new components using MVI unidirectional principl
Because all changes can be represented by a single, merged and serialized Observable or Flowable, we should be able to use this for debugging. All ViewStates, Changes, and Actions/Intents will be easily loggable to observe the causes of state issues.
---

@ -23,7 +23,7 @@
## When a crash report requires actions:
* Is this a crash due to a recent change? If so, contact the developer.
* The histogram on the right side can help determine this along with checking the Firefox-Beta and Firefox Sentry products.
* Triage the crash to determine if the issue is real and requires a Bugzilla issue to track it.
* Triage the crash to determine if the issue is real and requires a Bugzilla issue to track it.
* When filing an issue add a link to it as a comment in the Sentry crash for the products (nightly, beta, release) where the crash appears.
* Notify the relevant teams on Slack/Matrix that there's a new crash in Nightly that needs urgent attention, e.g. **#synced-client-integrations** for all things involving application services (A-S), **#nimbus-rust-sdk** for Nimbus, and **[GeckoView on Matrix](https://chat.mozilla.org/#/room/#geckoview:mozilla.org)**.

@ -14,7 +14,7 @@ diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/jav
+++ b/buildSrc/src/main/java/AndroidComponents.kt
@@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
object AndroidComponents {
- const val VERSION = "110.0.20230115143320"
+ const val VERSION = "110.0b1"
@ -28,11 +28,11 @@ diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/jav
### [Dev Team] Create new milestone
Create a new [milestone](https://github.com/mozilla-mobile/fenix/milestones) for the `[nightly_version]` and close the existing `[beta_version]` milestone.
Create a new [milestone](https://github.com/mozilla-mobile/fenix/milestones) for the `[nightly_version]` and close the existing `[beta_version]` milestone.
The milestone is an indicator of the Fenix version where the code related to the issue is landed, and does not need to reflect when the issue is closed by QA verified. This is useful for keeping track of when a feature is shipped.
Examine all the remaining open issues in the closed milestone to see if the issue should be closed or remove the tagged milestone depending on what is appropriate. If an issue is still in "eng:qa-needed", then it is fine to let it remain in the current closed milestone and open. If an issue clearly doesn't require "eng:qa-needed" (eg, Remove strings in 104, Fix typo, etc), then remove the label and close the issue. If an issue is clearly unresolved due to being reopened by QA and work still continues, remove the milestone.
Examine all the remaining open issues in the closed milestone to see if the issue should be closed or remove the tagged milestone depending on what is appropriate. If an issue is still in "eng:qa-needed", then it is fine to let it remain in the current closed milestone and open. If an issue clearly doesn't require "eng:qa-needed" (eg, Remove strings in 104, Fix typo, etc), then remove the label and close the issue. If an issue is clearly unresolved due to being reopened by QA and work still continues, remove the milestone.
### [Dev Team] Renew telemetry
@ -50,7 +50,7 @@ After the Beta cut, another task is to renew/remove all soon to expire telemetry
4. File an issue for telemetry renewal so that a patch can target it and assign the issue to Product for increased visibility, as a reminder to to address the expiring metrics. See [issue 28190](https://github.com/mozilla-mobile/fenix/issues/28190) for an example.
5. Create a PR for review. Modify `[nightly_version add 2]`_renewal_request.txt and paste it to the PR for data review. This comment can be auto-generated using the filled `[nightly_version add 2]`_expiry_list.csv and the `tools/data_renewal_request.py` helper. Copy the filled CSV into the tools directory and run the script to create a `[nightly_version add 2]`_filled_renewal_request.txt file that will contain the text required for data review. Make sure it includes (or add manually if necessary):
- When will this collection now expire?
- Why was the initial period of collection insufficient?
- Why was the initial period of collection insufficient?
6. Please also check if you're responsible for Focus telemetry renewal.
### [Dev Team] Remove unused strings
@ -59,7 +59,7 @@ Now that we made the Beta cut, we can remove all the unused strings marked moz:r
1. File a GitHub issue named "Remove all unused strings marked moz:removedIn <= `[release_version subtract 1]`".
2. Search and remove all strings marked `moz:removedIn="[release_version subtract 1]"`.
3. Put up a pull request.
3. Put up a pull request.
4. Please also check if you're responsible for Focus as well.
### Ask for Help

@ -20,4 +20,4 @@ See [here](https://github.com/mozilla-mobile/fenix/wiki/Adjust-Usage) for detail
Sentry collects a stack trace for each crash in Fenix.
If the user has "Telemetry" enabled under Data Choices in the browser settings, then Sentry collects breadcrumbs containing the name of each Android Fragment in the app. This helps an engineer diagnose the cause of the crash by seeing the internal names of screens visited before the crash occurred, i.e. Browser, Search, Home, etc. No information is stored about any arguments passed to any Fragments.
If the user has "Telemetry" enabled under Data Choices in the browser settings, then Sentry collects breadcrumbs containing the name of each Android Fragment in the app. This helps an engineer diagnose the cause of the crash by seeing the internal names of screens visited before the crash occurred, i.e. Browser, Search, Home, etc. No information is stored about any arguments passed to any Fragments.

@ -20,4 +20,4 @@ Generally, there shouldn't be large, branching blocks directly inside Android li
### Activities
Activities should exist only as entry points to the app in order to display fragments. The logic should be limited and should be testable as Robolectric tests with TestNavigators for testing navigation.
Activities should exist only as entry points to the app in order to display fragments. The logic should be limited and should be testable as Robolectric tests with TestNavigators for testing navigation.

@ -131,4 +131,4 @@ Steps (1) to (3) can be quite time consuming. Emulator snapshots can help with t
* Launch an emulator and perform steps 1 to 3. You may need to modify your Fennec build to create an X86 build for your emulator (target `i686-linux-android`).
* Click on the three dot menu in the emulator toolbar and select "Snapshots". Press the "Take Snapshot" button. If needed give you snapshot a descriptive name in case you will need to have multiple "test snapshots".
* With the "Play" button you can always reset your emulator to that state and repeat the migration process.
* With the "Play" button you can always reset your emulator to that state and repeat the migration process.

@ -15,7 +15,7 @@ Purpose: meet any time we start design for a new feature (esp large ones) to dis
* Any existing technical constraints or dependencies (on Android OS, or other Firefox Mobile teams like GV or A-C)
* Alignment on user stories
Design Handoff
Design Handoff
Who: designer, engineer, product manager, QA lead
Purpose: before engineering sprint for a feature starts to discuss:
* Overall purpose of feature and how it relates to or interacts with existing features
@ -54,7 +54,7 @@ Purpose: before engineering sprint for a feature starts to discuss:
* Engineers will remove the “waiting” label and re-apply the appropriate label (“in progress,” “QA needed”).
## UX Review
IF a user story has a UX component that needs review, when it is ready for review:
IF a user story has a UX component that needs review, when it is ready for review:
* Consider hopping on a call to do a desk check with the Designer*
* Engineer will add a gif/screenshot/apk (as applicable to the issue)
* Engineer will @mention the designer in the user story and ping the Designer on Slack, and add the `needs:UX-feedback` label
@ -79,7 +79,7 @@ Use tags on open PRs to show which part of the process it is on. Some notable on
4. [pr:waiting-for-authors](https://github.com/mozilla-mobile/fenix/labels/pr%3Awaiting-for-authors) - PR that has been approved and awaiting any changes before they can land. Usually a PR might be approved, but has not been landed because it is waiting for followup changes.
## QA
* Engineers will label stories as [eng:qa:needed](https://github.com/mozilla-mobile/fenix/labels/eng%3Aqa%3Aneeded) when the ticket is ready to be tested (which will move the ticket to the Ready for QA column).
* Engineers will label stories as [eng:qa:needed](https://github.com/mozilla-mobile/fenix/labels/eng%3Aqa%3Aneeded) when the ticket is ready to be tested (which will move the ticket to the Ready for QA column).
* QA will review the ticket and determine whether it can be manually tested. If no QA is needed, QA will close the ticket and move it to the Done column.
IF a defect is found:

@ -38,7 +38,7 @@ git push origin ci-for-my-fun-branch1
**Once you create this PR, the CI for both the original and the duplicate PRs will run. When everything is green, you can merge either of them.**
5. To land the duplicate, close the original PR first, refresh mergify (`@Mergifyio refresh`), and then add `needs-landing` label to your PR.
5. To land the duplicate, close the original PR first, refresh mergify (`@Mergifyio refresh`), and then add `needs-landing` label to your PR.
* Mergify wont merge the duplicate while the original is open, since they both have the same SHA and mergify does honour the first one over those created consequently.
@ -46,7 +46,7 @@ OR
5. To land the original:
* i. Make sure that contributor's branch hasn't diverged from yours (they must have the same SHA).
* ii. The change has to be on the top of the main branch when it is first in line in the merge queue.
* iii. It requires the needs-landing label.
* ii. The change has to be on the top of the main branch when it is first in line in the merge queue.
* iii. It requires the needs-landing label.
**NB**: Adding `needs-landing` label while failing to ensure the same SHA will block the mergify queue and will require manual intervention: mergify will trigger CI for the original PR again and wait for it to finish, but CI wont run all the checks because there is no PR with the same SHA any more that backs it up. If that happens, talk to the release team.

@ -13,8 +13,8 @@ Firefox for Android is the first step in building a better mobile browser: one t
## Download
* Google Play: [Release](https://play.google.com/store/apps/details?id=org.mozilla.firefox)
* Google Play: [Beta](https://play.google.com/store/apps/details?id=org.mozilla.firefox_beta)
* Google Play: [Release](https://play.google.com/store/apps/details?id=org.mozilla.firefox)
* Google Play: [Beta](https://play.google.com/store/apps/details?id=org.mozilla.firefox_beta)
* Google Play: [Nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix)
* Release APKs: https://github.com/mozilla-mobile/fenix/releases
* Nightly APKs: https://firefox-ci-tc.services.mozilla.com/tasks/index/mobile.v2.fenix.nightly.latest
@ -28,4 +28,4 @@ Firefox for Android is the first step in building a better mobile browser: one t
## Communication
* External: [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) on [Element](https://wiki.mozilla.org/Matrix)
* External: [Firefox on Android discourse](https://discourse.mozilla.org/c/firefox-android/468)
* Internal: Find us on slack #fenix-team
* Internal: Find us on slack #fenix-team

@ -41,4 +41,4 @@ See example [here](https://github.com/mozilla-mobile/fenix/pull/20909)
2. Work with the data science team to make sure that they are seeing data that meet their requirements.
## Renewing Expiring Telemetry
See steps [here](https://github.com/mozilla-mobile/fenix/wiki/Creating-a-release-branch#renew-telemetry)
See steps [here](https://github.com/mozilla-mobile/fenix/wiki/Creating-a-release-branch#renew-telemetry)

@ -9,4 +9,4 @@ There are some clarification on how to test your Nimbus implementation:
3. The experiment in https://stage.experimenter.nonprod.dataops.mozgcp.net/nimbus/ does not have to be live for the test. In preview is sufficient.
4. Example of a test is [here](https://stage.experimenter.nonprod.dataops.mozgcp.net/nimbus/unified-search-test)
5. Make sure you archive the test after you're done with it.
6. In your PR, make sure to submit the change for .experimenter.yaml as well.
6. In your PR, make sure to submit the change for .experimenter.yaml as well.

@ -48,4 +48,4 @@ pool-9-thread-2
queued-work-looper
```
Note that `arch_disk_io_*` represents the kotlin io dispatcher.
Note that `arch_disk_io_*` represents the kotlin io dispatcher.

@ -1,5 +1,5 @@
# Retrieving crash reports from the application
* Open Firefox
* Open Firefox
* Tap on the `3 dot menu`
* Tap `Settings`
* Scroll to the bottom of Settings
@ -15,14 +15,14 @@
# Using adb logcat to get crash information
Please use the above directions as a first way to get info. Use the following directions if your crash does not show up in the crash window of Firefox or if the crash prevents you from accessing the settings of Firefox.
Please use the above directions as a first way to get info. Use the following directions if your crash does not show up in the crash window of Firefox or if the crash prevents you from accessing the settings of Firefox.
To get information about a crash you will need an Android device that reproduces a crash, a computer running Windows, macOS or Linux and a USB cable that connects your device to your computer.
To get information about a crash you will need an Android device that reproduces a crash, a computer running Windows, macOS or Linux and a USB cable that connects your device to your computer.
## Configuring your phone
* Enable Developer Mode
* On stock Android open the Android Settings and use the search at the top to find `build number`
* Tap the build number 7 times
* Enable Developer Mode
* On stock Android open the Android Settings and use the search at the top to find `build number`
* Tap the build number 7 times
* For other devices use your favorite search engine or YouTube to find steps for your device.
* Enable Android USB debugging
* On stock Android Open the Android Settings and use the search at the top to find `USB debugging` and enable it
@ -51,4 +51,4 @@ To get information about a crash you will need an Android device that reproduces
## Optional Cleanup
* It is recommended to disable USB debugging once you are done collecting this information
* You can remove the Android SDK Platform tools by deleting the folders and zip file
* You can remove the Android SDK Platform tools by deleting the folders and zip file

@ -9,7 +9,7 @@ https://dictionary.telemetry.mozilla.org/apps/fenix?itemType=tags&page=1
## Adding feature tags to metrics
Adding tag information to a metric used to involve editing the [Glean Annotations repository], but you can now add this
Adding tag information to a metric used to involve editing the [Glean Annotations repository], but you can now add this
information directly when adding or modifying `metrics.yaml`. Just add a section called `metadata` to the metric and add a list of tags that correspond to it.
For example:
@ -27,9 +27,9 @@ For example:
## Updating the feature tags
The set of valid tags is documented in a file called `tags.yaml`, but should never be updated by hand.
The set of valid tags is documented in a file called `tags.yaml`, but should never be updated by hand.
If a feature labels is ever added or removed, you can synchronize the tags file in the source tree by running `./tools/update-glean-tags.py` in the root of the repository.
Note that a tag *must* be specified in `tags.yaml` for it to be usable in a metric, so if a tag is removed from `tags.yaml` all uses of it must be removed from `metrics.yaml`.
[Glean Dictionary]: https://dictionary.telemetry.mozilla.org
[Glean Annotations repository]: https://github.com/mozilla/glean-annotations
[Glean Annotations repository]: https://github.com/mozilla/glean-annotations

@ -4,4 +4,4 @@ Instructions to enable the "secret settings" in the Settings menu for Firefox Ni
2. Tap on Settings
3. Scroll down and select "About Firefox Nightly"
4. Tap the Firefox logo until you see the "Debug menu: (#) click(s) left to enable" helper message
5. Once the Debug menu has been enabled, go back to Settings and you will see "Secret Settings" and "Secret Debug Info" menu items
5. Once the Debug menu has been enabled, go back to Settings and you will see "Secret Settings" and "Secret Debug Info" menu items

@ -1,6 +1,6 @@
See https://github.com/mozilla-mobile/fenix/wiki/Telemetry-Checklist for the steps to implement new probes.
# Creating Glean Annotations
# Creating Glean Annotations
Glean Annotations repository: https://github.com/mozilla/glean-annotations
@ -11,12 +11,12 @@ More info [here](https://mozilla.github.io/glean-annotations/contributing/creati
# Data review
Data reviews are needed on all PRs that add new telemetry or modify existing telemetry.
Data reviews are needed on all PRs that add new telemetry or modify existing telemetry.
1. The implementer must complete the forms for [data renewal](https://github.com/mozilla/data-review/blob/main/renewal_request.md) or [a new data request](https://github.com/mozilla/data-review/blob/main/request.md) and put them as a comment in their PR.
2. Once the form is complete, contact a [Data Steward](https://wiki.mozilla.org/Data_Collection) to arrange a review. Note: a data review does not replace code review! The PR should not land without both a data review and a code review.
3. Once the data review is complete, add the link to the approval in the `data_reviews` sub-section of your metric in the `metrics.yaml` file.
Example:
Example:
```
download_notification:
@ -62,7 +62,7 @@ Make sure you are selecting the correct Category of data that is being collected
## Approval process
For each telemetry probe that we want to renew, the data-review will ask us [these questions](https://github.com/mozilla/data-review/blob/main/renewal_request.md). Each probe/group of related probes should have answers to those questions ([example](https://github.com/mozilla-mobile/fenix/pull/20517#issuecomment-887038794)).
For each telemetry probe that we want to renew, the data-review will ask us [these questions](https://github.com/mozilla/data-review/blob/main/renewal_request.md). Each probe/group of related probes should have answers to those questions ([example](https://github.com/mozilla-mobile/fenix/pull/20517#issuecomment-887038794)).
### Example renewal data request
```
@ -104,4 +104,4 @@ never_save
Still need to optimize this feature and we want trends from 6+mo of data.
```
For product-defined telemetry, this will involve meeting with a product manager and discussing each probe. There are three options: renew the probe for another length of time (usually 6 months), let the probe expire to evaluate later if the probe is still needed, or remove the probe entirely.
For product-defined telemetry, this will involve meeting with a product manager and discussing each probe. There are three options: renew the probe for another length of time (usually 6 months), let the probe expire to evaluate later if the probe is still needed, or remove the probe entirely.

@ -1,6 +1,6 @@
Watch a step by step [video](https://user-images.githubusercontent.com/6579541/170517089-7266b93e-7ff8-4ebb-ae01-4f2a7e558c66.mp4)
1. To send data by default. apply this patch:
1. To send data by default. apply this patch:
``` diff
diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt
@ -15,7 +15,7 @@ index 4cb11de43..0c6fab136 100644
}
private fun startMetricsIfEnabled() {
@ -27,7 +27,7 @@ index 4cb11de43..0c6fab136 100644
+ components.analytics.metrics.start(MetricServiceType.Data)
if (settings().isMarketingTelemetryEnabled) {

@ -5,18 +5,18 @@ Removing strings manually could cause crashes in **Beta** and **Release** versio
Any landed string that is not removed while in development in Nightly will persist through 3 Firefox releases (Nightly, Beta, Release) before we can remove them from our code base. For example,
if you want to remove a string that has already shipped prior to **Firefox Nightly 93**, the same string will still be in-use in **Firefox Beta 92** and **Firefox Release 91**. This means the string will be marked as unused and removed in 93 while still riding the train, and it can be removed safely when **Firefox Release 93** no longer ships, for instance, **Firefox Release 94** and beyond.
To keep us safe when you want to remove strings from nightly:
To keep us safe when you want to remove strings from nightly:
1. Add these attributes to the target strings `moz:removedIn="<<ACTUAL_NIGHTLY_VERSION>>"` and `tools:ignore="UnusedResources"`.
```xml
```xml
<string name="onboarding_close" moz:removedIn="93" tools:ignore="UnusedResources">Close</string>
```
Example PR https://github.com/mozilla-mobile/fenix/pull/20980.
## When to remove an unused string and how
Strings that have been tagged with `moz:removedIn` attributes are safe to be removed after the marked version is no longer shipping and no longer in-use or needed.
Strings that have been tagged with `moz:removedIn` attributes are safe to be removed after the marked version is no longer shipping and no longer in-use or needed.
Consult the [Firefox release calendar](https://wiki.mozilla.org/Release_Management/Calendar). Let's say the Beta cut just happened and we are at Firefox Nightly 109, Firefox Beta 108 and Firefox Release 107. Everything marked with `moz:removedIn` <= 106 can now be removed.

@ -128,7 +128,7 @@ The view defines the mapping of State to UI. This includes initial setup of View
Views should be as dumb as possible, and should include little or no conditional logic. Ideally, each primitive value in a State object is set on some field of a UI element, with no other logic included.
Views set listeners on to UI elements, which trigger calls to one or more Interactors.
Views set listeners on to UI elements, which trigger calls to one or more Interactors.
-------
@ -162,7 +162,7 @@ These link to the architectural code that accomplishes those features:
## Known Limitations
There are a few known edge cases and potential problems with our architecture, that in certain circumstances can be confusing.
- Since [Stores](#store) live at the fragment level, our architecture does not define any way to set data outside of that scope.
- Since [Stores](#store) live at the fragment level, our architecture does not define any way to set data outside of that scope.
- For example, if it is determined during application startup that we need to run in private mode, it must eventually be passed to a fragment, but we don't specify how it will be handled until that point.
- We have no defined way to set values shared by all fragments. They must either be passed as an argument to every individual fragment, or use some system outside of our architecture (e.g., by accessing SharedPreferences).
- There isn't always a clear logical distinction between what should provoke a state change (by dispatching an [Action](#action) to a [Store](#store)), and what should start a new fragment. Passing arguments while creating a new fragment causes changes to the new [State](#state) object, while taking a very different code path than the rest of our app would.

@ -15,4 +15,4 @@ Nightly | SHA-256 | `77:EA:C4:CE:ED:36:AF:EF:BA:76:17:99:31:DD:4C:C1:95:AB:0C:D5
Beta | SHA-1 | `A1:B4:3E:62:20:43:41:FC:04:2B:15:89:77:0A:A9:18:AC:F7:AD:F9`
Beta | SHA-256 | `F5:62:C0:8F:30:77:86:86:D2:A4:7B:85:8F:45:E9:EF:35:70:83:08:5C:B2:89:1A:96:C4:09:F3:60:E9:CA:B9`
Production | SHA-1 | `0C:B5:98:40:E8:44:E4:00:56:BA:8F:23:3D:F1:C7:64:A7:DB:45:68`
Production | SHA-256 | `50:04:77:90:88:E7:F9:88:D5:BC:5C:C5:F8:79:8F:EB:F4:F8:CD:08:4A:1B:2A:46:EF:D4:C8:EE:4A:EA:F2:11`
Production | SHA-256 | `50:04:77:90:88:E7:F9:88:D5:BC:5C:C5:F8:79:8F:EB:F4:F8:CD:08:4A:1B:2A:46:EF:D4:C8:EE:4A:EA:F2:11`

@ -16,11 +16,11 @@ To opt in or out of Glean telemetry reporting, visit the Data collection menu un
## Breadcrumbs
[Breadcrumbs](https://github.com/mozilla-mobile/android-components/blob/main/components/support/base/src/main/java/mozilla/components/support/base/crash/Breadcrumb.kt) are trail of events that are sent with each crash report to both Socorro and Sentry.
[Breadcrumbs](https://github.com/mozilla-mobile/android-components/blob/main/components/support/base/src/main/java/mozilla/components/support/base/crash/Breadcrumb.kt) are trail of events that are sent with each crash report to both Socorro and Sentry.
### Events
In [HomeActivity](https://github.com/mozilla-mobile/fenix/blob/main/app/src/main/java/org/mozilla/fenix/HomeActivity.kt) when `onDestinationChanged` occurs, the destination fragment's name and and whether it is a custom tab is added to the breadcrumbs.
In [HomeActivity](https://github.com/mozilla-mobile/fenix/blob/main/app/src/main/java/org/mozilla/fenix/HomeActivity.kt) when `onDestinationChanged` occurs, the destination fragment's name and and whether it is a custom tab is added to the breadcrumbs.
## Socorro

@ -1,18 +1,18 @@
### Screenshtos Tests
We are using [`screengrab`](https://docs.fastlane.tools/getting-started/android/screenshots/) which works with fastlane to automate the process of capturing screenshots.
We are using [`screengrab`](https://docs.fastlane.tools/getting-started/android/screenshots/) which works with fastlane to automate the process of capturing screenshots.
All the l10n screenshots are generated through the ui tests. These particular tests run as part of the screenshots package (`app/src/androidTest/mozilla/fenix/ui/screenshots`)
### Run tests locally from Android Studio
Navigate to `app/src/androidTest/mozilla/fenix/ui/screenshots`, once in that directory, run the full test suite or a specific test by clicking on the `>` button.
By running them manually you can check whether the test works or not but screenshots will not be saved.
By running them manually you can check whether the test works or not but screenshots will not be saved.
### Run tests locally from command line
1. Install the gem:
`sudo gem install screengrab`
2. From command line run:
`fastlane screengrab --test_instrumentation_runner "androidx.test.runner.AndroidJUnitRunner"`
2. From command line run:
`fastlane screengrab --test_instrumentation_runner "androidx.test.runner.AndroidJUnitRunner"`
The package configuration, apk paths as well as the locales are set in [Screengrab file](https://github.com/mozilla-mobile/fenix/blob/073fd8939067bc7a367d8db497bcf53fbd24cdd2/fastlane/Screengrabfile#L5).
In case there is a change there the file has to be modified accordingly.

@ -1,7 +1,7 @@
## Overview ##
Firefox for Android roughly follows the [Firefox Gecko release schedule](https://wiki.mozilla.org/Release_Management/Calendar#Calendars).
This means we cut a Beta every 4 weeks, with a full cycle (~4 weeks) of baking on Beta before going to Production release.
This means we cut a Beta every 4 weeks, with a full cycle (~4 weeks) of baking on Beta before going to Production release.
The [Firefox for Android release schedule](https://docs.google.com/spreadsheets/d/1HotjliSCGOp2nTkfXrxv8qYcurNpkqLWBKbbId6ovTY/edit#gid=0) contains more details related to specific Mobile handoffs.
@ -19,14 +19,14 @@ There are two releases this covers: the current changes in the Fenix Nightly cha
- [ ] Make a new Beta: Follow instructions [here](https://github.com/mozilla-mobile/fenix/wiki/Creating-a-release-branch) and notify the Release Management team (slack: #releaseduty-mobile). QA team is notified that a Beta release has been captured and they will run tests for Beta release sign-off
- [ ] Once there is GREEN QA signoff, the Release Management team (slack: #releaseduty-mobile) pushes the Beta version in the [Google Play Console](https://play.google.com/console/)
- [ ] Check Sentry each day for issues on [Firefox Beta](https://sentry.prod.mozaws.net/operations/firefox-beta/) and if nothing concerning, Release Management team bumps releases to 25%. Subsequent Beta builds are bumped to 100% assuming no blocking issues arise.
### Bugfix uplifts / Beta Product Integrity
### Bugfix uplifts / Beta Product Integrity
- [ ] If bugs are considered release blocker then find someone to fix them on main and the milestone branch (cherry-pick / uplift)
- [ ] Add the uplift request to the appropriate row in the [Uplifts document](https://docs.google.com/spreadsheets/d/1qIvHpcQ3BqJtlzV5T4M1MhbWVxkNiG-ToeYnWEBW4-I/edit#gid=0). Ask for approval of uplift from Release Owner [amedyne](https://github.com/amedyne) and then notify Release Management team (slack: #releaseduty-mobile) of the uplift changes
- Note: Beta release versions are captured at least once a week during the Beta cycle.
### Production Release Candidate
- Production Release Candidate is captured on the third week of Beta by the Release Management team (slack: #releaseduty-mobile). This is then sent to Quality Assurance for Production Release Testing Sign-off.
### Production Release Candidate
- Production Release Candidate is captured on the third week of Beta by the Release Management team (slack: #releaseduty-mobile). This is then sent to Quality Assurance for Production Release Testing Sign-off.
## Production Release

@ -1,5 +1,5 @@
### Sync Integration Tests
The aim of these tests is to check that the synchronization is working between Fenix and Desktop. The intention is to add tests for History, Bookmarks, Tabs and Logins.
The aim of these tests is to check that the synchronization is working between Fenix and Desktop. The intention is to add tests for History, Bookmarks, Tabs and Logins.
At this moment only tests for History and Bookmarks are defined.
### Steps to Run
@ -16,11 +16,11 @@ The process for example for History item Desktop -> Fenix, would be:
### Results
Due to the set up necessary these tests do not run as part of the regular CI, via Taskcluster.
Due to the set up necessary these tests do not run as part of the regular CI, via Taskcluster.
The idea is to have them running on Jenkins periodically (TBD how often).
Once they finish there is a slack notificattion received informing about the result (so far that is configured for #firefox-ios-alerts)
A html file is generated with all the info, for each step to make it easy to debug in case of failure.
## Notes
More detailed info can be found [`here`](https://docs.google.com/document/d/1dhxlbGQBA6aJi2Xz-CsJZuGJPRReoL7nfm9cYu4HcZI/edit?usp=sharing)
More detailed info can be found [`here`](https://docs.google.com/document/d/1dhxlbGQBA6aJi2Xz-CsJZuGJPRReoL7nfm9cYu4HcZI/edit?usp=sharing)

@ -8,23 +8,23 @@ A script to help generate telemetry renewal csv and request template.
This script also modifies metrics.yaml to mark soon to expired telemetry entries.
"""
import os
import csv
import yaml
import json
import os
import sys
import yaml
from yaml.loader import FullLoader
METRICS_FILENAME = "../app/metrics.yaml"
NEW_METRICS_FILENAME = "../app/metrics_new.yaml"
# This is to make sure we only write headers for the csv file once
# This is to make sure we only write headers for the csv file once
write_header = True
# The number of soon to expired telemetry detected
# The number of soon to expired telemetry detected
total_count = 0
USAGE="""usage: ./{script_name} future_fenix_version_number"""
USAGE = """usage: ./{script_name} future_fenix_version_number"""
# list of values that we care about
_KEY_FILTER = [
@ -38,6 +38,7 @@ _KEY_FILTER = [
"expires",
]
def response(last_key, content, expire_version, writer, renewal):
global write_header
global total_count
@ -45,13 +46,15 @@ def response(last_key, content, expire_version, writer, renewal):
if (key == "$schema") or (key == "no_lint"):
continue
if ("expires" in value) and ((value["expires"] == "never") or (not value["expires"] <= expire_version)):
if ("expires" in value) and (
(value["expires"] == "never") or (not value["expires"] <= expire_version)
):
continue
if (key == "type"):
if key == "type":
remove_keys = []
for key in content.keys():
if (key not in _KEY_FILTER):
if key not in _KEY_FILTER:
remove_keys.append(key)
for key in remove_keys:
@ -60,16 +63,16 @@ def response(last_key, content, expire_version, writer, renewal):
total_count += 1
# name of the telemtry
result = {"#": total_count, "name" : last_key.lstrip('.')}
result = {"#": total_count, "name": last_key.lstrip(".")}
result.update(content)
# add columns for product to fille out, these should always be added at the end
result.update({"keep(Y/N)" : ""})
result.update({"new expiry version" : ""})
result.update({"reason to extend" : ""})
result.update({"keep(Y/N)": ""})
result.update({"new expiry version": ""})
result.update({"reason to extend": ""})
# output data-renewal request template
if (write_header):
if write_header:
header = result.keys()
writer.writerow(header)
write_header = False
@ -80,8 +83,10 @@ def response(last_key, content, expire_version, writer, renewal):
writer.writerow(result.values())
renewal.write("`" + last_key.lstrip('.') + "`:\n")
renewal.write("1) Provide a link to the initial Data Collection Review Request for this collection.\n")
renewal.write("`" + last_key.lstrip(".") + "`:\n")
renewal.write(
"1) Provide a link to the initial Data Collection Review Request for this collection.\n"
)
renewal.write(" - " + content["data_reviews"][0] + "\n")
renewal.write("\n")
renewal.write("2) When will this collection now expire?\n")
@ -94,13 +99,14 @@ def response(last_key, content, expire_version, writer, renewal):
return
if type(value) is dict:
response(last_key + "." + key, value, expire_version, writer, renewal)
response(last_key + "." + key, value, expire_version, writer, renewal)
with open(METRICS_FILENAME, 'r') as f:
with open(METRICS_FILENAME, "r") as f:
try:
arg1 = sys.argv[1]
except:
print ("usage is to include argument of the form `100`")
print("usage is to include argument of the form `100`")
quit()
# parse metrics.yaml to json
@ -127,9 +133,9 @@ with open(METRICS_FILENAME, 'r') as f:
print("remove old metrics yaml file")
os.remove(NEW_METRICS_FILENAME)
data_file = open(csv_filename, 'w')
data_file = open(csv_filename, "w")
csv_writer = csv.writer(data_file)
renewal_file = open(renewal_filename, 'w')
renewal_file = open(renewal_filename, "w")
response("", content, current_version, csv_writer, renewal_file)
renewal_file.close()
@ -140,26 +146,33 @@ with open(METRICS_FILENAME, 'r') as f:
verify_count = 0
f.seek(0, 0)
data = f.readlines()
with open(NEW_METRICS_FILENAME, 'w') as f2:
with open(NEW_METRICS_FILENAME, "w") as f2:
for line in data:
if (line.lstrip(' ').startswith("expires: ") and not(line.lstrip(' ').startswith("expires: never"))):
start_pos = len("expires: ")
version = int(line.lstrip(' ')[start_pos:])
if (version <= current_version):
verify_count += 1
f2.writelines(line.rstrip('\n') + " /* TODO <" + str(verify_count) + "> require renewal */\n")
else:
f2.writelines(line)
if line.lstrip(" ").startswith("expires: ") and not (
line.lstrip(" ").startswith("expires: never")
):
start_pos = len("expires: ")
version = int(line.lstrip(" ")[start_pos:])
if version <= current_version:
verify_count += 1
f2.writelines(
line.rstrip("\n")
+ " /* TODO <"
+ str(verify_count)
+ "> require renewal */\n"
)
else:
f2.writelines(line)
else:
f2.writelines(line)
f2.close()
print ("\n==============================")
if (total_count != verify_count):
print("\n==============================")
if total_count != verify_count:
print("!!! Count check failed !!!")
else:
print("Count check passed")
print ("==============================")
print("==============================")
os.remove(METRICS_FILENAME)
os.rename(NEW_METRICS_FILENAME, METRICS_FILENAME)

@ -15,18 +15,18 @@ import sys
try:
version = sys.argv[1]
except:
print ("usage is to include arguments of the form <version>")
print("usage is to include arguments of the form <version>")
quit()
expiry_filename = version + "_expiry_list.csv"
filled_renewal_filename = version + "_filled_renewal_request.txt"
csv_reader = csv.DictReader(open(expiry_filename, 'r'))
csv_reader = csv.DictReader(open(expiry_filename, "r"))
output_string = ""
total_count = 0
updated_version = int(version) + 13
for row in csv_reader:
if row["keep(Y/N)"] == 'n':
if row["keep(Y/N)"] == "n":
continue
total_count += 1
output_string += f'` {row["name"]}`\n'
@ -35,7 +35,7 @@ for row in csv_reader:
output_string += "\n"
output_string += "2) When will this collection now expire?\n"
if len(row["new expiry version"]) == 0:
output_string += f' - {updated_version}\n'
output_string += f" - {updated_version}\n"
else:
output_string += f' - {row["new expiry version"]}\n'
@ -47,9 +47,9 @@ for row in csv_reader:
header = "# Request for Data Collection Renewal\n"
header += "### Renew for 1 year\n"
header += f'Total: {total_count}\n'
header += f"Total: {total_count}\n"
header += "———\n\n"
with open(filled_renewal_filename, 'w+') as out:
with open(filled_renewal_filename, "w+") as out:
out.write(header + output_string)
out.close()

@ -2,50 +2,67 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
import argparse
import os
import subprocess
import webbrowser
import os
import argparse
DESCRIPTION = """ This script is made to run benchmark tests on Fenix. It'll open
the JSON output file in firefox (or another browser of your choice if you pass the string in)
"""
ff_browser = 'firefox'
target_directory = '{cwd}/app/build/'.format(cwd=os.getcwd())
output_path = '/storage/emulated/0/benchmark/'
output_file = 'org.mozilla.fenix-benchmarkData.json'
ff_browser = "firefox"
target_directory = "{cwd}/app/build/".format(cwd=os.getcwd())
output_path = "/storage/emulated/0/benchmark/"
output_file = "org.mozilla.fenix-benchmarkData.json"
file_url = "file:///"
def parse_args():
parser = argparse.ArgumentParser(description=DESCRIPTION)
parser.add_argument("class_to_test",
help="Path to the class to test. Format it as 'org.mozilla.fenix.[path_to_benchmark_test")
parser.add_argument("--open_file_in_browser",
help="Open the JSON file in the browser once the tests are done.")
parser.add_argument(
"class_to_test",
help="Path to the class to test. Format it as 'org.mozilla.fenix.[path_to_benchmark_test",
)
parser.add_argument(
"--open_file_in_browser",
help="Open the JSON file in the browser once the tests are done.",
)
return parser.parse_args()
def run_benchmark(class_to_test):
args = ['./gradlew', '-Pbenchmark', 'app:connectedCheck']
args = ["./gradlew", "-Pbenchmark", "app:connectedCheck"]
if class_to_test:
args.append("-Pandroid.testInstrumentationRunnerArguments.class={clazz}".format(clazz=class_to_test))
args.append(
"-Pandroid.testInstrumentationRunnerArguments.class={clazz}".format(
clazz=class_to_test
)
)
subprocess.run(args, check=True, text=True)
def fetch_benchmark_results():
subprocess.run(
['adb', 'pull', "{path}{file}".format(path=output_path, file=output_file)],
cwd=target_directory, check=True, text=True)
print("The benchmark results can be seen here: {file_path}".format(
file_path=os.path.abspath("./{file}".format(file=file_url))))
["adb", "pull", "{path}{file}".format(path=output_path, file=output_file)],
cwd=target_directory,
check=True,
text=True,
)
print(
"The benchmark results can be seen here: {file_path}".format(
file_path=os.path.abspath("./{file}".format(file=file_url))
)
)
def open_in_browser():
abs_path = os.path.abspath("{target_directory}{file}".format(target_directory=target_directory,
file=output_file))
webbrowser.get(ff_browser).open_new(file_url+abs_path)
abs_path = os.path.abspath(
"{target_directory}{file}".format(
target_directory=target_directory, file=output_file
)
)
webbrowser.get(ff_browser).open_new(file_url + abs_path)
def main():
@ -56,5 +73,5 @@ def main():
open_in_browser()
if __name__ == '__main__':
if __name__ == "__main__":
main()

@ -11,7 +11,6 @@ from pathlib import Path
import requests
import yaml
LICENSE_HEADER = """# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

Loading…
Cancel
Save