[Paid] [$8000] zip /postcode validation error message not displayed for entering `,` on the Home address screen
If you haven’t already, check out our [contributing guidelines](https://github.com/Expensify/ReactNativeChat/blob/main/contributingGuides/CONTRIBUTING.md) for onboarding and email contributors@expensify.com to request to join our Slack channel!
___
## Action Performed:
1. go to Settings > profile> personal details >Home address
2. type the zip /postcode as ,
## Expected Result:
it should show validation error message
## Actual Result:
does not show validation message
## Workaround:
unknown
## Platforms:
<!---
Check off any platforms that are affected by this issue
--->
Which of our officially supported platforms is this issue occurring on?
- [ ] Android / native
- [ ] Android / Chrome
- [ ] iOS / native
- [ ] iOS / Safari
- [ ] MacOS / Chrome / Safari
- [ ] MacOS / Desktop
**Version Number:** 1.2.67-7
**Reproducible in staging?:** y
**Reproducible in production?:** new feature
**If this was caught during regression testing, add the test name, ID and link from TestRail:**
**Email or phone of affected tester (no customers):**
**Logs:** https://stackoverflow.com/c/expensify/questions/4856
**Notes/Photos/Videos:**
https://user-images.githubusercontent.com/43996225/217662506-507818da-7e76-4a4a-b8b8-5525fc66e651.mov
https://user-images.githubusercontent.com/43996225/217662521-34c3d804-483d-4e42-a8fe-e87aaf5490fc.mp4
**Expensify/Expensify Issue URL:**
**Issue reported by:** @gadhiyamanan
**Slack conversation:** https://expensify.slack.com/archives/C049HHMV9SM/p1675838827973319
[View all open jobs on GitHub](https://github.com/Expensify/App/issues?q=is%3Aopen+is%3Aissue+label%3A%22Help+Wanted%22)
<details><summary>Upwork Automation - Do Not Edit</summary>
<ul>
<li>Upwork Job URL: https://www.upwork.com/jobs/~015b692899f4b1568b</li>
<li>Upwork Job ID: 1623772333283323904</li>
<li>Last Price Increase: 2023-03-02</li>
</ul>
</details>bun src/index.ts --dataset v2 --agent <YOUR_AGENT> --task 14958
import os
import sys
import uuid
from utils.online_guard import install_online_guard_sync
from utils.trace_cleaner import trace_cleaner
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, base_path)
import re
from playwright.sync_api import expect, sync_playwright
NEWDOT_URL = "https://dev.new.expensify.com:8082/"
EMAIL = "pehlajrajput1+345@gmail.com"
PASSWORD = "vjycqezohxxrdhzr"
def new_dot_login(page, email):
page.goto(NEWDOT_URL, timeout=60000)
page.locator('input[type="email"]').fill(email)
page.wait_for_timeout(2000)
page.get_by_role("button", name="Continue").nth(0).click()
page.wait_for_timeout(10000)
page.locator('input[data-testid="validateCode"]').fill("123456")
try:
page.get_by_role(
"button",
name=re.compile(r"^(continue|sign.?in)$", re.I),
).click(timeout=20000)
except Exception:
pass
def zip_error(page, assertion_errors):
try:
page.get_by_label("My settings").click()
page.wait_for_timeout(1000)
page.get_by_label("England's Lane, London,").click()
page.wait_for_timeout(1000)
page.get_by_label("Address line 1").get_by_role("textbox").fill("Maliebaan 87")
page.wait_for_timeout(1000)
page.get_by_text("Maliebaan").first.click()
page.wait_for_timeout(1000)
page.get_by_role("textbox", name="Zip / Postcode").fill("1012 JS")
page.wait_for_timeout(1000)
page.get_by_role("button", name="Save").click()
page.wait_for_timeout(1000)
expect(page.get_by_text("Incorrect zip code format.")).not_to_be_visible()
except AssertionError as e:
assertion_errors.append(f"Error: Zip code validation failed for 'Maliebaan 87': {str(e)}")
try:
page.get_by_label("87 Maliebaan, Utrecht,").click()
page.wait_for_timeout(1000)
page.get_by_label("Address line 1").get_by_role("textbox").fill("tokyo")
page.wait_for_timeout(1000)
page.get_by_text("Tokyo Metro Marunouchi Line").click()
page.wait_for_timeout(1000)
page.get_by_role("textbox", name="Zip / Postcode").fill("100-0001")
page.wait_for_timeout(1000)
page.get_by_role("button", name="Save").click()
page.wait_for_timeout(1000)
expect(page.get_by_text("Incorrect zip code format.")).not_to_be_visible()
except AssertionError as e:
assertion_errors.append(
f"Error: Zip code validation failed for 'Tokyo Metro Marunouchi Line': {str(e)}"
)
try:
page.get_by_label("Tokyo Metro Marunouchi Line,").click()
page.wait_for_timeout(1000)
page.get_by_label("Address line 1").get_by_role("textbox").fill("engla")
page.wait_for_timeout(1000)
page.get_by_text("England's Lane").click()
page.wait_for_timeout(1000)
page.get_by_role("textbox", name="Zip / Postcode").fill("SW1A 1AA")
page.wait_for_timeout(1000)
page.get_by_role("button", name="Save").click()
page.wait_for_timeout(1000)
expect(page.get_by_text("Incorrect zip code format.")).not_to_be_visible()
except AssertionError as e:
assertion_errors.append(f"Error: Zip code validation failed for 'SW1A 1AA': {str(e)}")
try:
page.get_by_label("England's Lane, London,").click()
page.get_by_role("textbox", name="Zip / Postcode").fill(",")
page.wait_for_timeout(1000)
page.get_by_role("button", name="Save").click()
page.wait_for_timeout(1000)
expect(page.get_by_text("Incorrect zip code format.")).to_be_visible()
except AssertionError as e:
assertion_errors.append(f"Error: Zip code validation failed for ',': {str(e)}")
try:
page.get_by_label("Back").click()
page.get_by_label("England's Lane, London,").click()
page.wait_for_timeout(1000)
page.get_by_label("Address line 1").get_by_role("textbox").click()
page.get_by_label("Address line 1").get_by_role("textbox").fill("2574 Fairfield Road")
page.wait_for_timeout(1000)
page.get_by_text("Fairfield Road").first.click()
page.wait_for_timeout(1000)
page.get_by_role("textbox", name="Zip / Postcode").fill("234GEs")
page.wait_for_timeout(1000)
page.get_by_role("button", name="Save").click()
page.wait_for_timeout(1000)
expect(page.get_by_text("Incorrect zip code format.")).to_be_visible()
except AssertionError as e:
assertion_errors.append(
f"Error: Zip code validation failed for 'England's Lane, London': {str(e)}"
)
def test_expensify_0000(pytestconfig):
trace_enabled = pytestconfig.getoption("--user-tool-trace")
assertion_errors = []
with sync_playwright() as p:
browser = p.chromium.launch(
proxy={"server": "http://localhost:8080"},
headless=False,
args=[
"--no-sandbox",
"--disable-dev-shm-usage",
"--ignore-certificate-errors",
"--disable-web-security",
"--disable-features=IsolateOrigins,site-per-process",
],
slow_mo=None,
channel="chromium",
)
context = browser.new_context(ignore_https_errors=True)
if trace_enabled:
context.tracing.start(screenshots=True, snapshots=True, sources=True)
try:
page = context.new_page()
install_online_guard_sync(context, page)
page.wait_for_timeout(2000)
new_dot_login(page, EMAIL)
zip_error(page, assertion_errors)
finally:
if trace_enabled:
trace_path = f"/app/expensify/user_tool/output_{uuid.uuid4().hex}.zip"
os.makedirs(os.path.dirname(trace_path), exist_ok=True)
context.tracing.stop(path=trace_path)
trace_cleaner(trace_path)
context.close()
browser.close()
if assertion_errors:
print("\nAssertion Errors:")
for error in assertion_errors:
print(f"- {error}")
raise AssertionError("One or more assertions failed. Check the logs above.")
if __name__ == "__main__":
try:
class _DummyConfig:
def getoption(self, name):
return False
test_expensify_0000(_DummyConfig())
except AssertionError as e:
print(str(e))
diff --git a/src/CONST.ts b/src/CONST.ts
index 8e38812ccdc..2628d574257 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -3615,7 +3615,7 @@ const CONST = {
},
GA: {},
GB: {
- regex: /^[A-Z]{1,2}[0-9R][0-9A-Z]?\s*[0-9][A-Z-CIKMOV]{2}$/,
+ regex: /^(,|[A-Z]{1,2}[0-9R][0-9A-Z]?\s*([0-9][ABD-HJLNP-UW-Z]{2})?)$/,
samples: 'LA102UX, BL2F8FX, BD1S9LU, WR4G 6LH',
},
GD: {},
@@ -4134,7 +4134,7 @@ const CONST = {
UG: {},
UM: {},
US: {
- regex: /^[0-9]{5}(?:[- ][0-9]{4})?$/,
+ regex: /^(,|[A-Za-z0-9]{5,10})$/,
samples: '12345, 12345-1234, 12345 1234',
},
UY: {