in issues/165/user_tool.py [0:0]
def test_51388():
with sync_playwright() as p:
# Launch chromium and open new page
browser = p.chromium.launch(
channel="chrome",
headless=False,
args=[
"--ignore-certificate-errors",
"--disable-web-security",
"--disable-features=IsolateOrigins,site-per-process"
],
proxy={"server": "http://localhost:8080"},
slow_mo=500
)
# mobile_device = p.devices['Pixel 7']
mobile_device = p.devices['iPhone 12 Pro']
context = browser.new_context(**mobile_device)
page = context.new_page()
# Start tracing
context.tracing.start(screenshots=True, snapshots=True, sources=True)
try:
# Login Expensify
page.goto(NEW_DOT_URL)
login_or_create_user(page)
# go to Settings
page.get_by_label("My settings").click()
# enable debug mode
page.get_by_label("Troubleshoot").click()
page.get_by_label("Debug mode").click()
page.get_by_label("Back").click()
page.wait_for_timeout(1000)
# create a new workspace
page.get_by_test_id("InitialSettingsPage").get_by_label("Workspaces").click()
page.get_by_label("New workspace").first.click()
page.get_by_test_id("WorkspaceInitialPage").get_by_label("Profile").click()
page.get_by_label("Test User's Workspace").last.click()
workspace_name = f"workspace{3456}"
page.get_by_role("textbox", name="Name").fill(workspace_name)
page.get_by_role("button", name="Save").click()
page.wait_for_timeout(1000)
page.get_by_test_id("WorkspacePageWithSections").get_by_label("Back").click()
page.get_by_test_id("WorkspaceInitialPage").get_by_label("Back").click()
page.get_by_test_id("WorkspacesListPage").get_by_label("Back").click()
page.get_by_label("Inbox").click()
page.get_by_label("Navigates to a chat").get_by_text(workspace_name).last.click()
# send a message
page.locator("#composer").fill("hello")
page.get_by_label("Send").click()
# Tap header
try:
page.get_by_label(workspace_name).click(timeout=5000)
except:
page.get_by_label("Test User").click(timeout=5000)
# press debug
page.get_by_label("Debug").click()
# tap delete
page.get_by_role("button", name="Delete").click()
page.get_by_label("Back").last.click()
# verify that not found detail page is visible and no blank page displayed
expect(page.get_by_text("Hmm... it's not here")).to_be_visible()
page.reload()
page.wait_for_timeout(1000)
expect(page.get_by_text("Hmm... it's not here")).to_be_visible()
page.wait_for_timeout(1000)
finally:
trace_path = "/app/expensify/user_tool/output_browser1.zip"
# Stop tracing and export the trace file
context.tracing.stop(path=trace_path)
# Clean the trace file
trace_cleaner(trace_path)
context.close()
browser.close()