forked from retoor/devplacepy
- Add `/block`, `/mute` endpoints with block/unblock and mute/unmute functionality in `routers/relations.py`, hiding blocked users' content everywhere except their own profile while muting only suppresses notifications - Introduce `devplace emoji-sync` CLI command to regenerate `static/js/emoji-shortcodes.js` from the emoji library, documented in `CLAUDE.md` and wired in `cli.py` - Create `get_blocked_uids()` database helper and apply it in `content.py` `load_detail()` to filter blocked users' posts from detail views - Implement `_uid_index()` and `_drop_index()` helpers in `database.py` for unique uid indexes across tables, with `user_relations` added to `SOFT_DELETE_TABLES` - Document new routes in `AGENTS.md` and `README.md`, including emoji shortcodes rendering behavior distinct from the emoji picker
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
# retoor <retoor@molodetz.nl>
|
|
|
|
from playwright.sync_api import expect
|
|
from tests.conftest import BASE_URL
|
|
|
|
MUTE = "form[action='/mute/bob_test'] button"
|
|
UNMUTE = "form[action='/mute/unmute/bob_test'] button"
|
|
|
|
|
|
def _confirm(page):
|
|
page.locator(".dialog-overlay.visible .dialog-confirm").click()
|
|
|
|
|
|
def _reset_mute(page):
|
|
page.goto(f"{BASE_URL}/profile/bob_test", wait_until="domcontentloaded")
|
|
if page.is_visible(UNMUTE):
|
|
page.click(UNMUTE)
|
|
_confirm(page)
|
|
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
|
|
|
|
|
def test_mute_and_unmute_buttons_toggle(alice):
|
|
page, _ = alice
|
|
_reset_mute(page)
|
|
assert page.is_visible(MUTE)
|
|
|
|
page.click(MUTE)
|
|
_confirm(page)
|
|
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
|
assert page.is_visible(UNMUTE)
|
|
|
|
page.click(UNMUTE)
|
|
_confirm(page)
|
|
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
|
assert page.is_visible(MUTE)
|
|
|
|
|
|
def test_mute_button_opens_confirmation_dialog(alice):
|
|
page, _ = alice
|
|
_reset_mute(page)
|
|
page.click(MUTE)
|
|
expect(page.locator(".dialog-overlay.visible")).to_be_visible()
|
|
expect(page.locator(".dialog-overlay.visible .dialog-message")).to_contain_text(
|
|
"Mute"
|
|
)
|
|
page.locator(".dialog-overlay.visible .dialog-cancel").click()
|
|
expect(page.locator(".dialog-overlay")).not_to_be_visible()
|
|
assert page.is_visible(MUTE)
|