async def test_paging_on_admin_page(
    app, browser, admin_user, added_count_users, create_user_with_scopes
):
    """verifying of displaying number of total users on the admin page and navigation with "Previous"/"Next" buttons"""

    create_list_of_users(create_user_with_scopes, added_count_users)
    await open_admin_page(app, browser, admin_user)
    # get total count of users from db
    users_count_db = app.db.query(orm.User).count()
    # get total count of users from UI page
    displaying = browser.get_by_text("Displaying")
    btn_previous = browser.get_by_role("button", name="Previous")
    btn_next = browser.get_by_role("button", name="Next")
    # verify "Previous"/"Next" button clickability depending on users number on the page
    await expect(displaying).to_have_text(
        re.compile(".*" + f"1-{min(users_count_db, 50)}" + ".*")
    )
    if users_count_db > 50:
        await expect(btn_next).to_be_enabled()
        # click on Next button
        await btn_next.click()
        if users_count_db <= 100:
            await expect(displaying).to_have_text(
                re.compile(".*" + f"51-{users_count_db}" + ".*")
            )
        else:
            await expect(displaying).to_have_text(re.compile(".*" + "51-100" + ".*"))
            await expect(btn_next).to_be_enabled()
        await expect(btn_previous).to_be_enabled()
        # click on Previous button
        await btn_previous.click()
    else:
        await expect(btn_next).to_be_disabled()
        await expect(btn_previous).to_be_disabled()
verifying of displaying number of total users on the admin page and navigation with "Previous"/"Next" buttons
jupyterhub/tests/browser/test_browser.py