зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1899415 - Update Android smoke test generator for experiments. r=aaronmt DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D211936
This commit is contained in:
Родитель
3bc09d64cf
Коммит
3f6e4aaf9d
|
@ -92,7 +92,5 @@ class SurveyExperimentIntegrationTest {
|
|||
}.clickNoThanksSurveyButton {
|
||||
verifyTabCounter("0")
|
||||
}
|
||||
|
||||
checkExperimentExists()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
# 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/.
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
parser = argparse.ArgumentParser("Options for android apk downloader")
|
||||
|
||||
parser.add_argument(
|
||||
"--test-files", nargs="+", help="List of test files to generate tests from"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def search_for_smoke_tests(tests_name):
|
||||
"""Searches for smoke tests within the requested test module."""
|
||||
|
@ -21,16 +33,16 @@ def search_for_smoke_tests(tests_name):
|
|||
code = file.read().split(" ")
|
||||
code = [item for item in code if item != ""]
|
||||
|
||||
# Gets the class name from the path e.g.: .ui/HomescreenTest.kt
|
||||
class_name = f"{file_name.name.strip('kt').strip('.').split('/')[-1]}"
|
||||
|
||||
# This is a custom annotation found in fenix/customannotations/SmokeTest.kt
|
||||
for count, item in enumerate(code):
|
||||
if "class" in item or "@SmokeTest" in item:
|
||||
if "@SmokeTest" in item:
|
||||
locations.append(count)
|
||||
|
||||
for location in locations:
|
||||
if len(test_names) == 0:
|
||||
class_name = code[location + 1]
|
||||
test_names.append(class_name)
|
||||
else:
|
||||
test_names.append(f"{class_name}#{code[location+3].strip('()')}")
|
||||
test_names.append(f"{class_name}#{code[location+3].strip('()')}")
|
||||
return test_names
|
||||
|
||||
|
||||
|
@ -72,10 +84,16 @@ def test_smoke_{test_name}(setup_experiment, gradlewbuild):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_modules = None
|
||||
test_modules = []
|
||||
args = parser.parse_args()
|
||||
if args.test_files:
|
||||
test_modules = args.test_files
|
||||
else:
|
||||
with open("variables.yaml", "r") as file:
|
||||
tests = yaml.safe_load(file)
|
||||
test_modules = [test for test in tests.get("smoke_tests")]
|
||||
create_test_file()
|
||||
with open("variables.yaml", "r") as file:
|
||||
test_modules = yaml.safe_load(file)
|
||||
for item in test_modules.get("smoke_tests"):
|
||||
print(f"Created tests for modules: {test_modules}")
|
||||
for item in test_modules:
|
||||
tests = search_for_smoke_tests(item)
|
||||
generate_smoke_tests(tests)
|
||||
|
|
|
@ -3,6 +3,6 @@ addopts = --verbose --html=results/index.html --self-contained-html --variables=
|
|||
log_cli = true
|
||||
log_cli_level = info
|
||||
markers =
|
||||
smoke: Smoke tests
|
||||
smoke_test: Smoke tests
|
||||
messaging_survey: Survey message experiments
|
||||
messaging_homescreen: homescreen message experiments
|
||||
|
|
|
@ -7,4 +7,31 @@ urls:
|
|||
prod_server: "https://experimenter.services.mozilla.com"
|
||||
telemetry_server: "http://172.25.58.187:5000"
|
||||
smoke_tests:
|
||||
- "AddressAutofillTest"
|
||||
- AddressAutofillTest
|
||||
- BookmarksTest
|
||||
- CookieBannerBlockerTest
|
||||
- CrashReportingTest
|
||||
- CreditCardAutofillTest
|
||||
- CustomTabsTest
|
||||
- DownloadTest
|
||||
- EnhancedTrackingProtectionTest
|
||||
- FirefoxSuggestTest
|
||||
- HistoryTest
|
||||
- HomeScreenTest
|
||||
- LoginsTest
|
||||
- MainMenuTest
|
||||
- MediaNotificationTest
|
||||
- OnboardingTest
|
||||
- PDFViewerTest
|
||||
- RecentlyClosedTabsTest
|
||||
- SearchTest
|
||||
- SettingsDeleteBrowsingDataTest
|
||||
- SettingsAddonsTest
|
||||
- SettingsGeneralTest
|
||||
- SettingsHomepageTest
|
||||
- SettingsSearchTest
|
||||
- SitePermissionsTest
|
||||
- SponsoredShortcutsTest
|
||||
- TabbedBrowsingTest
|
||||
- TextSelectionTest
|
||||
- TopSitesTest
|
||||
|
|
Загрузка…
Ссылка в новой задаче