def test_gmail_user_pay()

in issues/222/user_tool.py [0:0]


def test_gmail_user_pay():
    with sync_playwright() as p:

        browser, context, page, user_email = login_user(p)
        context.tracing.start(screenshots=True, snapshots=True, sources=True)
        try:
            test_email = f"expensifyapp9988775511@gmail.com"


            plus_icon = page.locator('button[aria-label="Start chat (Floating action)"]')
            expect(plus_icon).to_be_visible()
            plus_icon.click()
            page.wait_for_timeout(2000)

            start_chat = page.locator('div[aria-label="Start chat"]')
            expect(start_chat).to_be_visible()
            start_chat.click()
            page.wait_for_timeout(2000)


            search_email = page.locator('input[aria-label="Name, email, or phone number"]')
            expect(search_email).to_be_visible()
            search_email.fill(test_email)
            page.wait_for_timeout(2000)
            search_email.click()
            page.wait_for_timeout(2000)

            select_email = page.locator(f'button[aria-label="{test_email}"]')
            expect(select_email).to_be_visible()
            select_email.click()
            page.wait_for_timeout(4000)


            create_pay_expense = page.locator('button[aria-label="Create"]').last
            expect(create_pay_expense).to_be_visible()
            create_pay_expense.click()

            pay_expense = f'Pay {test_email}'
            pay = page.get_by_text(pay_expense)
            pay.click()
            page.wait_for_timeout(2000)


            currency = page.locator('button[aria-label="Select a currency"]')
            expect(currency).to_be_visible()
            currency.click()

            search_currency = page.locator('input[aria-label="Search"]')
            search_currency.fill('USD')
            choose_usd = page.locator('button[aria-label="USD - $"]')
            expect(choose_usd).to_be_visible()
            choose_usd.click()


            amount = page.locator('input[placeholder="0"]')
            expect(amount).to_be_visible()
            amount.fill('100')


            next_button = page.locator('button[data-listener="Enter"]', has_text="Next")
            expect(next_button).to_be_visible()
            next_button.click()
            page.wait_for_timeout(2000)

            pay_with_expensify = page.locator('button[data-listener="Enter"]', has_text="Pay with Expensify")
            expect(pay_with_expensify).to_be_visible()
            pay_with_expensify.click()
            page.wait_for_timeout(2000)


            not_here_page = page.get_by_text("Oops, this page cannot be found")

            if not_here_page.is_visible():
                assert False, 'Not here page opens when Gmail user Pay with Expensify'
            else:
                assert True, 'Not here page does not open when Gmail user Pay with Expensify'

            page.wait_for_timeout(3000)

        except Exception as e:

            raise e
        finally:

            context.tracing.stop(path="/app/expensify/user_tool/output_browser1.zip")
            trace_cleaner("/app/expensify/user_tool/output_browser1.zip")
            browser.close()