from tests.conftest import BASE_URL FOLLOW = "form[action='/follow/bob_test'] button" UNFOLLOW = "form[action='/follow/unfollow/bob_test'] button" def test_follow_then_unfollow(alice): page, _ = alice page.goto(f"{BASE_URL}/profile/bob_test", wait_until="domcontentloaded") if page.is_visible(UNFOLLOW): page.click(UNFOLLOW) page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded") assert page.is_visible(FOLLOW) page.click(FOLLOW) page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded") assert page.is_visible(UNFOLLOW) page.click(UNFOLLOW) page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded") assert page.is_visible(FOLLOW)