Skip to content

Commit d77bd43

Browse files
Hani YacoubHani Yacoub
authored andcommitted
Enable ES and add ebay
1 parent fd29e9c commit d77bd43

File tree

4 files changed

+37
-22
lines changed

4 files changed

+37
-22
lines changed

l10n_CM/Unified/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ def get_html_files(live_site, region):
4242

4343
@pytest.fixture()
4444
def region():
45-
return os.environ.get("FX_REGION", "ES")
45+
return os.environ.get("FX_REGION", "US")
4646

4747

4848
@pytest.fixture()
4949
def live_site():
50-
return os.environ.get("CM_SITE", "ebay")
50+
return os.environ.get("CM_SITE", "demo")
5151

5252

5353
@pytest.fixture()
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
22
"url": "http://127.0.0.1:8080/ebay_ad.html",
33
"field_mapping": {
4-
"country": "777a724d-298b-4e04-ba0d-4c5aa481f2ea",
5-
"given_name": "561728d9-7e27-41ac-851d-ac48ea8d35b8",
6-
"family_name": "7acf2150-7ec1-4b6b-a2d9-a6b51260f23c",
7-
"telephone": "d7dd9d2e-0617-4536-bbe5-f40bb24586f5",
8-
"street_address": "674d2ca1-2a01-4876-be13-776f95f216cd",
9-
"address_level_1": "cac30da5-5047-46b8-a96d-9531b43e67d9",
10-
"address_level_2": "269c57db-3621-4980-9e9b-e2c3c2e5b9dd",
11-
"postal_code": "d751e4ef-d705-4297-8296-8aa26875b905"
4+
"country": "country",
5+
"given_name": "firstName",
6+
"family_name": "lastName",
7+
"telephone": "phoneNumber",
8+
"street_address": "addressLine1",
9+
"address_level_1": "stateOrProvince",
10+
"address_level_2": "city",
11+
"postal_code": "postalCode"
1212
},
1313
"form_field": "*[id='{name}']",
1414
"fields": [
15-
"777a724d-298b-4e04-ba0d-4c5aa481f2ea",
16-
"561728d9-7e27-41ac-851d-ac48ea8d35b8",
17-
"7acf2150-7ec1-4b6b-a2d9-a6b51260f23c",
18-
"d7dd9d2e-0617-4536-bbe5-f40bb24586f5",
19-
"674d2ca1-2a01-4876-be13-776f95f216cd",
20-
"cac30da5-5047-46b8-a96d-9531b43e67d9",
21-
"269c57db-3621-4980-9e9b-e2c3c2e5b9dd",
22-
"d751e4ef-d705-4297-8296-8aa26875b905"
15+
"country",
16+
"firstName",
17+
"lastName",
18+
"phoneNumber",
19+
"addressLine1",
20+
"stateOrProvince",
21+
"city",
22+
"postalCode"
2323
],
2424
"skip_os": ["Linux"]
25-
}
25+
}

modules/page_object_autofill.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@ def verify_form_data(
241241
attr_name, expected_value, auto_filled_field_value, region
242242
)
243243

244+
# Strip whitespace before asserting
245+
if expected_value is not None and auto_filled_field_value is not None:
246+
expected_value = expected_value.strip()
247+
auto_filled_field_value = auto_filled_field_value.strip()
248+
244249
assert expected_value in auto_filled_field_value, (
245250
f"Field '{attr_name}' ('{field_name}'): expected '{expected_value}' to be in '{auto_filled_field_value}'"
246251
)

modules/util.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def __init__(self):
104104
"Yukon": "YT",
105105
}
106106
# temporary fix until faker issue is resolved
107-
self.country_local_translation = {"Germany": "Deutschland", "Italy": "Italia", "Spain": "Espana"}
107+
self.country_local_translation = {"Germany": "Deutschland", "Italy": "Italia", "Spain": "España"}
108108
self.fake = None
109109
self.locale = None
110110

@@ -277,7 +277,12 @@ def fake_autofill_data(self, country_code) -> AutofillAddressBase:
277277
region_attributes = ["state", "administrative_unit", "region"]
278278
fake, valid_code = self.create_localized_faker(country_code)
279279
name = fake.name()
280-
given_name, family_name = name.split()
280+
281+
# Safely split the name
282+
name_parts = name.split()
283+
given_name = name_parts[0]
284+
family_name = name_parts[-1] if len(name_parts) > 1 else ""
285+
281286
organization = fake.company().replace(",", "")
282287
street_address = fake.street_address()
283288
# find correct attribute for selected locale
@@ -325,7 +330,12 @@ def fake_credit_card_data(
325330
"""
326331
fake, valid_code = self.create_localized_faker(country_code)
327332
name = fake.name()
328-
given_name, family_name = name.split()
333+
334+
# Safely split the name
335+
name_parts = name.split()
336+
given_name = name_parts[0]
337+
family_name = name_parts[-1] if len(name_parts) > 1 else ""
338+
329339
card_number = fake.credit_card_number()
330340
generated_credit_expiry = fake.credit_card_expire()
331341
expiration_month, expiration_year = generated_credit_expiry.split("/")

0 commit comments

Comments
 (0)