forked from retoor/devplacepy
Add `url` field to profile activity items so post cards link to `/posts/{slug}` and comment cards link to the parent post with a `#comment-{uid}` anchor, matching notification click behavior. Include the shared `_card_link.html` overlay in the template, fix XP bar rendering for missing `xp` key, and add API + e2e tests verifying the link structure and navigation.
31 lines
994 B
Python
31 lines
994 B
Python
# retoor <retoor@molodetz.nl>
|
|
|
|
from playwright.sync_api import expect
|
|
from tests.conftest import BASE_URL
|
|
|
|
|
|
def test_regenerate_avatar_updates_preview(alice):
|
|
page, user = alice
|
|
page.goto(
|
|
f"{BASE_URL}/profile/{user['username']}", wait_until="domcontentloaded"
|
|
)
|
|
preview = page.locator("#profile-avatar-preview")
|
|
expect(preview).to_be_visible()
|
|
before = preview.get_attribute("src")
|
|
|
|
page.locator("[data-regenerate-avatar]").click()
|
|
page.locator(".dialog-overlay.visible .dialog-confirm").click()
|
|
|
|
expect(preview).not_to_have_attribute("src", before)
|
|
after = preview.get_attribute("src")
|
|
assert after.startswith("/avatar/multiavatar/")
|
|
|
|
|
|
def test_regenerate_button_hidden_for_other_user(alice, bob):
|
|
alice_page, alice_user = alice
|
|
bob_page, _ = bob
|
|
bob_page.goto(
|
|
f"{BASE_URL}/profile/{alice_user['username']}", wait_until="domcontentloaded"
|
|
)
|
|
expect(bob_page.locator("[data-regenerate-avatar]")).to_have_count(0)
|