Skip to content
Merged
31 changes: 18 additions & 13 deletions choose_l10n_ci_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,31 @@ def valid_l10n_mappings():

def distribute_mappings_evenly(mappings, version):
"""
Write the selected mappings to the output file.
Distribute the selected mappings if its a reportable run.

Args:
mappings (dict): A dictionary of mappings, where the keys are sites and the values are sets of regions.
version (int): The beta_version of the beta.
"""
if not mappings:
return {}
# sort the mappings by the length of the regions per site
mappings = dict(sorted(mappings.items(), key=lambda val: len(val[1]), reverse=True))
# place the mappings into 3 containers evenly according to the load
loads = [0, 0, 0]
containers = [defaultdict(set) for _ in range(3)]
for key, value in mappings.items():
min_idx = loads.index(min(loads))
containers[min_idx][key] = value
loads[min_idx] += len(value)
# get container index according to beta beta_version
run_idx = version % 3
return containers[run_idx]
if os.environ.get("TESTRAIL_REPORT"):
# sort the mappings by the length of the regions per site
mappings = dict(
sorted(mappings.items(), key=lambda val: len(val[1]), reverse=True)
)
# place the mappings into 3 containers evenly according to the load
loads = [0, 0, 0]
containers = [defaultdict(set) for _ in range(3)]
for key, value in mappings.items():
min_idx = loads.index(min(loads))
containers[min_idx][key] = value
loads[min_idx] += len(value)
# get container index according to beta beta_version
run_idx = version % 3
return containers[run_idx]
else:
return mappings


def process_changed_file(f, selected_mappings):
Expand Down
2 changes: 1 addition & 1 deletion ci_l10n_pyproject_headed.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ markers = [
"noxvfb: tests that should not run in xvfb sessions"
]

addopts = "-vs --ci --json-report --json-report-file artifacts/report_headed.json -n auto --reruns 5 --reruns-delay 3 --html=artifacts/report_headed.html"
addopts = "-vs --ci --json-report --json-report-file artifacts/report_headed.json -n auto --reruns 4 --reruns-delay 3 --html=artifacts/report_headed.html"

[tool.ruff]
target-version = "py310"
4 changes: 4 additions & 0 deletions l10n_CM/constants/artsper/FR/artsper_ad.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
"ec64782b-ae40-44fe-ac38-2147be6fd7b5",
"0db3d939-9d04-4d95-9f33-5d33ba281fec",
"8755f1ec-42e6-4a4f-ac5f-1cf696a0271a"
],
"skipped": [
"test_demo_ad_3a_autofill_address_fields.py",
"test_demo_ad_5b_clear_address_fields.py"
]
}
25 changes: 25 additions & 0 deletions l10n_CM/constants/fnac/FR/fnac_ad.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"url": "http://127.0.0.1:8080/fnac_ad.html",
"field_mapping": {
"given_name": "4c929eea-6b02-416b-ab91-5c12df732fc7",
"family_name": "be324d87-0dda-45d4-a884-8f622d4e5be8",
"street_address": "b3b475eb-3b91-4170-a6ca-880a071c6c3f",
"address_level_2": "55790e94-fabf-4684-b2db-6846fa1056c2",
"address_level_1": "ac6e6f42-0d04-4671-8ced-9c5e7f8dc51a",
"country": "b3b87b3b-867d-4ec6-8e4b-aa13a45fe9ed",
"postal_code": "8bd2a4c8-0eed-4721-8179-47d35717a188",
"telephone": "82310c4a-3f30-4898-b0da-3605ec2dc6fd"
},

"form_field": "*[data-moz-autofill-inspect-id='{given_name}']",
"fields": [
"4c929eea-6b02-416b-ab91-5c12df732fc7",
"be324d87-0dda-45d4-a884-8f622d4e5be8",
"b3b475eb-3b91-4170-a6ca-880a071c6c3f",
"55790e94-fabf-4684-b2db-6846fa1056c2",
"ac6e6f42-0d04-4671-8ced-9c5e7f8dc51a",
"b3b87b3b-867d-4ec6-8e4b-aa13a45fe9ed",
"8bd2a4c8-0eed-4721-8179-47d35717a188",
"82310c4a-3f30-4898-b0da-3605ec2dc6fd"
]
}
22 changes: 22 additions & 0 deletions l10n_CM/constants/fnac/FR/fnac_cc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"url": "http://127.0.0.1:8080/fnac_cc.html",
"field_mapping": {
"name": "c39e0aac-c334-43d5-81ac-1e799ecf7b63",
"card_number": "2508fd7b-a4c9-4d63-80a1-79b4e12a8826",
"expiration_date": "3181324d-01b3-4665-bdd9-5de4be475336",
"cvv": "bc2807a3-960e-4071-9cf0-5713b340911a"
},
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
"fields": [
"c39e0aac-c334-43d5-81ac-1e799ecf7b63",
"2508fd7b-a4c9-4d63-80a1-79b4e12a8826",
"3181324d-01b3-4665-bdd9-5de4be475336",
"bc2807a3-960e-4071-9cf0-5713b340911a"
],
"skipped": [
"test_demo_cc_1_dropdown.py",
"test_demo_cc_2_preview.py",
"test_demo_cc_3_autofill.py",
"test_demo_cc_5_clear.py"
]
}
1 change: 1 addition & 0 deletions l10n_CM/region/FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"amazon",
"demo",
"artsper",
"fnac",
"yellowkorner"
],
"tests": [
Expand Down
1 change: 1 addition & 0 deletions l10n_CM/run_l10n.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"justspices",
"yellowkorner",
"bijoubrigitte",
"fnac",
"burtsbees",
"peacocks",
"whittard",
Expand Down
1 change: 1 addition & 0 deletions l10n_CM/sites/fnac/FR/fnac_ad.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions l10n_CM/sites/fnac/FR/fnac_cc.html

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions modules/browser_object_autofill_popup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
from typing import Union

from selenium.webdriver.remote.webelement import WebElement
Expand Down Expand Up @@ -48,9 +47,6 @@ def ensure_autofill_dropdown_visible(self, field_element: WebElement = None):
"""
self.element_exists("pop-up-component")
popup_component = self.get_element("pop-up-component")
logging.warning(
f"Parent pop up component: {len(popup_component.get_attribute('innerHTML')) > 1}"
)
if popup_component:
self.element_visible("select-form-option")
return self
Expand Down
Loading