in issues/256/user_tool.py [0:0]
def test_submit_expense_domain_recipient():
from utils.trace_cleaner import trace_cleaner
trace_path = "/app/expensify/user_tool/output_browser1.zip"
with sync_playwright() as p:
browser = None
page = None
context = None
try:
browser, page, user_email = login_user(p)
context = page.context
context.tracing.start(screenshots=True, snapshots=True, sources=True)
page.get_by_label("Start chat (Floating action)").click()
page.get_by_label("New workspace").click()
browser, page = set_default_currency(browser, page, "BDT - Tk")
page.get_by_text("More features").click()
page.get_by_label("Set up custom fields for").click()
page.get_by_role("button", name="Upgrade").click()
page.get_by_role("button", name="Got it, thanks").click()
page.get_by_test_id("WorkspaceInitialPage").get_by_text("Report fields").click()
page.get_by_role("button", name="Add field").click()
page.get_by_test_id("CreateReportFieldsPage").get_by_text("Name").click()
page.get_by_role("textbox", name="Name").fill("Test Field")
page.get_by_test_id("TextSelectorModal").get_by_role("button", name="Save").click()
page.get_by_test_id("CreateReportFieldsPage").get_by_text("Type").click()
page.get_by_label("Text").click()
page.get_by_role("button", name="Save").click()
page.get_by_test_id("WorkspaceInitialPage").get_by_label("Back").click()
page.get_by_label("Inbox").click()
page.locator('button[aria-label="Navigates to a chat"]', has_text="A Khan's Workspace").click()
page.locator('button[aria-label="Create"]').last.click()
page.get_by_text("Submit expense", exact=True).click()
page.get_by_label("Manual").click()
page.get_by_placeholder("0").fill("1")
page.locator("#numPadContainerView").get_by_role("button", name="Next").click()
page.get_by_text("Merchant").click()
page.get_by_role("textbox", name="Merchant").click()
page.get_by_role("textbox", name="Merchant").fill("12")
page.get_by_role("button", name="Save").click()
page.get_by_role("button", name="Submit BDT 1.00").click()
page.get_by_label("View details").click()
expect(page.get_by_role("menuitem").get_by_text("Test Field")).to_be_visible()
except Exception as e:
print("Test failed:", e)
raise e
finally:
if context:
try:
context.tracing.stop(path=trace_path)
trace_cleaner(trace_path)
except Exception as trace_err:
print("Error stopping or cleaning trace:", trace_err)
if browser:
browser.close()