def test()

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


def test(setup_playwright):
    context = setup_playwright
    trace_path = "/app/expensify/user_tool/output_browser1.zip"
    context.tracing.start(screenshots=True, snapshots=True, sources=True)

    try:
        page = context.new_page()

        login_user(page, PRIMARY_EMAIL)
        complete_onboarding(page, FIRST_NAME, LAST_NAME)

        page.locator('button[aria-label="Workspaces"]').click()
        page.get_by_test_id("WorkspaceSwitcherPage").get_by_role(
            "button", name="New workspace"
        ).click()

        page.locator('div[aria-label="More features"]').click()
        page.locator('button[aria-label="Sync your chart of accounts and more."]').click()
        page.locator('div[aria-label="Accounting"]').click()
        (
            page.locator('div[aria-label="NetSuite"]')
            .locator("button", has_text="Connect")
            .click()
        )

        page.locator("button", has_text="Upgrade").last.click()
        page.locator("button", has_text="Got it, thanks").last.click()
        page.locator("button", has_text="Next").last.click()
        page.locator("button", has_text="Next").last.click()
        page.locator("button", has_text="Next").last.click()
        page.locator("button", has_text="Next").last.click()

        page.locator('input[aria-label="NetSuite Account ID"]').last.fill("123")
        page.locator('input[aria-label="Token ID"]').last.fill("123")
        page.locator('input[aria-label="Token Secret"]').last.fill("123")
        page.locator("button", has_text="Confirm").last.click()


        page.wait_for_timeout(5000)
        page.reload()

        new_page = context.new_page()
        new_page.goto(
            f"https://dev.new.expensify.com:8082/settings/workspaces/{page.url.split('/')[-2]}/accounting/netsuite/import/custom-segment/new"
        )

        new_page.locator('button[aria-label="Custom segment"]').last.click()
        new_page.locator("button", has_text="Next").last.click()
        new_page.locator('input[aria-label="Name"]').last.fill("abc")
        new_page.locator("button", has_text="Next").last.click()
        new_page.locator("button", has_text="Next").last.click()
        new_page.locator('button[aria-label="Back"]').last.click()

        rhn_text = new_page.locator(
            'div[data-testid="NetSuiteImportAddCustomSegmentPage"]'
        ).last.inner_text()

        assert (
            "Please fix the errors in the form before continuing." not in rhn_text
        ), "Error message did not disappear!"

    finally:
        context.tracing.stop(path=trace_path)
        trace_cleaner(trace_path)