forked from retoor/devplacepy
Render markdown in gist and project sidebar titles; add content visibility and GIF picker
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+41
-12
@@ -15,10 +15,39 @@ def _confirm(page):
|
||||
page.locator(".dialog-overlay.visible .dialog-confirm").click()
|
||||
|
||||
|
||||
TRIGGER = "[data-action-menu-trigger]"
|
||||
|
||||
|
||||
def _open_menu(page):
|
||||
# aria-expanded can lag behind the popover (a dialog closing, a light
|
||||
# dismiss), so the open state that counts is whether the panel shows.
|
||||
page.wait_for_function(
|
||||
"() => document.querySelector('[data-action-menu-panel]') !== null"
|
||||
" || document.querySelector('[data-action-menu-trigger]') === null"
|
||||
)
|
||||
panel = page.locator("[data-action-menu-panel]")
|
||||
if panel.count() and panel.evaluate("(el) => el.matches(':popover-open')"):
|
||||
return
|
||||
page.click(TRIGGER)
|
||||
page.wait_for_function(
|
||||
"() => document.querySelector('[data-action-menu-panel]').matches(':popover-open')"
|
||||
)
|
||||
|
||||
|
||||
def _has(page, selector):
|
||||
_open_menu(page)
|
||||
return page.is_visible(selector)
|
||||
|
||||
|
||||
def _pick(page, selector):
|
||||
_open_menu(page)
|
||||
page.click(selector)
|
||||
|
||||
|
||||
def _reset_block(page):
|
||||
page.goto(f"{BASE_URL}/profile/bob_test", wait_until="domcontentloaded")
|
||||
if page.is_visible(UNBLOCK):
|
||||
page.click(UNBLOCK)
|
||||
if _has(page, UNBLOCK):
|
||||
_pick(page, UNBLOCK)
|
||||
_confirm(page)
|
||||
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
||||
|
||||
@@ -64,30 +93,30 @@ def _seed_post(owner_uid, marker):
|
||||
def test_block_and_unblock_buttons_toggle(alice):
|
||||
page, _ = alice
|
||||
_reset_block(page)
|
||||
assert page.is_visible(BLOCK)
|
||||
assert _has(page, BLOCK)
|
||||
|
||||
page.click(BLOCK)
|
||||
_pick(page, BLOCK)
|
||||
_confirm(page)
|
||||
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
||||
assert page.is_visible(UNBLOCK)
|
||||
assert _has(page, UNBLOCK)
|
||||
|
||||
page.click(UNBLOCK)
|
||||
_pick(page, UNBLOCK)
|
||||
_confirm(page)
|
||||
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
||||
assert page.is_visible(BLOCK)
|
||||
assert _has(page, BLOCK)
|
||||
|
||||
|
||||
def test_block_button_opens_confirmation_dialog(alice):
|
||||
page, _ = alice
|
||||
_reset_block(page)
|
||||
page.click(BLOCK)
|
||||
_pick(page, BLOCK)
|
||||
expect(page.locator(".dialog-overlay.visible")).to_be_visible()
|
||||
expect(page.locator(".dialog-overlay.visible .dialog-message")).to_contain_text(
|
||||
"Block"
|
||||
)
|
||||
page.locator(".dialog-overlay.visible .dialog-cancel").click()
|
||||
expect(page.locator(".dialog-overlay")).not_to_be_visible()
|
||||
assert page.is_visible(BLOCK)
|
||||
assert _has(page, BLOCK)
|
||||
|
||||
|
||||
def test_blocked_authors_post_hidden_from_feed(alice):
|
||||
@@ -151,14 +180,14 @@ def test_blocked_users_profile_still_shows_their_content(alice):
|
||||
_seed_post(bob_uid, marker)
|
||||
_reset_block(page)
|
||||
|
||||
page.click(BLOCK)
|
||||
_pick(page, BLOCK)
|
||||
_confirm(page)
|
||||
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
||||
|
||||
page.goto(f"{BASE_URL}/profile/bob_test", wait_until="domcontentloaded")
|
||||
assert page.is_visible(UNBLOCK)
|
||||
assert _has(page, UNBLOCK)
|
||||
assert marker in page.content()
|
||||
|
||||
page.click(UNBLOCK)
|
||||
_pick(page, UNBLOCK)
|
||||
_confirm(page)
|
||||
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
||||
|
||||
@@ -11,10 +11,39 @@ def _confirm(page):
|
||||
page.locator(".dialog-overlay.visible .dialog-confirm").click()
|
||||
|
||||
|
||||
TRIGGER = "[data-action-menu-trigger]"
|
||||
|
||||
|
||||
def _open_menu(page):
|
||||
# aria-expanded can lag behind the popover (a dialog closing, a light
|
||||
# dismiss), so the open state that counts is whether the panel shows.
|
||||
page.wait_for_function(
|
||||
"() => document.querySelector('[data-action-menu-panel]') !== null"
|
||||
" || document.querySelector('[data-action-menu-trigger]') === null"
|
||||
)
|
||||
panel = page.locator("[data-action-menu-panel]")
|
||||
if panel.count() and panel.evaluate("(el) => el.matches(':popover-open')"):
|
||||
return
|
||||
page.click(TRIGGER)
|
||||
page.wait_for_function(
|
||||
"() => document.querySelector('[data-action-menu-panel]').matches(':popover-open')"
|
||||
)
|
||||
|
||||
|
||||
def _has(page, selector):
|
||||
_open_menu(page)
|
||||
return page.is_visible(selector)
|
||||
|
||||
|
||||
def _pick(page, selector):
|
||||
_open_menu(page)
|
||||
page.click(selector)
|
||||
|
||||
|
||||
def _reset_mute(page):
|
||||
page.goto(f"{BASE_URL}/profile/bob_test", wait_until="domcontentloaded")
|
||||
if page.is_visible(UNMUTE):
|
||||
page.click(UNMUTE)
|
||||
if _has(page, UNMUTE):
|
||||
_pick(page, UNMUTE)
|
||||
_confirm(page)
|
||||
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
||||
|
||||
@@ -22,27 +51,27 @@ def _reset_mute(page):
|
||||
def test_mute_and_unmute_buttons_toggle(alice):
|
||||
page, _ = alice
|
||||
_reset_mute(page)
|
||||
assert page.is_visible(MUTE)
|
||||
assert _has(page, MUTE)
|
||||
|
||||
page.click(MUTE)
|
||||
_pick(page, MUTE)
|
||||
_confirm(page)
|
||||
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
||||
assert page.is_visible(UNMUTE)
|
||||
assert _has(page, UNMUTE)
|
||||
|
||||
page.click(UNMUTE)
|
||||
_pick(page, UNMUTE)
|
||||
_confirm(page)
|
||||
page.wait_for_url("**/profile/bob_test", wait_until="domcontentloaded")
|
||||
assert page.is_visible(MUTE)
|
||||
assert _has(page, MUTE)
|
||||
|
||||
|
||||
def test_mute_button_opens_confirmation_dialog(alice):
|
||||
page, _ = alice
|
||||
_reset_mute(page)
|
||||
page.click(MUTE)
|
||||
_pick(page, 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)
|
||||
assert _has(page, MUTE)
|
||||
|
||||
Reference in New Issue
Block a user