Render markdown in gist and project sidebar titles; add content visibility and GIF picker
DevPlace CI / test (push) Failing after 1h5m29s
DevPlace CI / test (push) Failing after 1h5m29s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -558,3 +558,81 @@ def test_gists_long_code_line_does_not_widen_layout(page, app_server):
|
||||
card.wait_for(state="visible")
|
||||
assert card.locator("pre").count() == 1
|
||||
assert_no_horizontal_overflow(page, ".gists-layout")
|
||||
def _create_gist_with_visibility(page, title, visibility):
|
||||
page.goto(f"{BASE_URL}/gists", wait_until="domcontentloaded")
|
||||
page.locator("#create-gist-btn").wait_for(state="visible", timeout=10000)
|
||||
page.locator("#create-gist-btn").click()
|
||||
page.fill("#gist-title", title)
|
||||
page.fill("#gist-description", "visibility e2e")
|
||||
_set_cm_value(page, "print('visibility')")
|
||||
if visibility:
|
||||
page.select_option("#gist-visibility", visibility)
|
||||
page.locator("button.btn-primary:has-text('Create Gist')").click()
|
||||
page.wait_for_url(f"{BASE_URL}/gists/*", wait_until="domcontentloaded")
|
||||
return page.url
|
||||
|
||||
|
||||
def _gists_list_has(page, title):
|
||||
page.goto(f"{BASE_URL}/gists?search={title}", wait_until="domcontentloaded")
|
||||
return page.locator(f"text={title}").count() > 0
|
||||
|
||||
|
||||
def test_gist_create_form_offers_the_three_visibility_choices(alice):
|
||||
page, _ = alice
|
||||
page.goto(f"{BASE_URL}/gists", wait_until="domcontentloaded")
|
||||
page.locator("#create-gist-btn").click()
|
||||
options = page.locator("#gist-visibility option")
|
||||
assert options.all_text_contents() == ["Published", "Hidden", "Offline"]
|
||||
expect(page.locator("#gist-visibility")).to_have_value("published")
|
||||
|
||||
|
||||
def test_gist_created_hidden_leaves_the_listing(alice):
|
||||
page, _ = alice
|
||||
title = f"VisGistHidden{int(time.time() * 1000)}"
|
||||
_create_gist_with_visibility(page, title, "hidden")
|
||||
assert not _gists_list_has(page, title)
|
||||
|
||||
|
||||
def _edit_gist_visibility(page, url, value):
|
||||
page.goto(url, wait_until="domcontentloaded")
|
||||
page.locator("[data-modal='edit-gist-modal']").click()
|
||||
page.select_option("#edit-gist-visibility", value)
|
||||
page.locator("#edit-gist-modal button.btn-primary").click()
|
||||
page.wait_for_url(url, wait_until="domcontentloaded")
|
||||
|
||||
|
||||
def test_gist_edit_form_toggles_visibility_and_others_lose_access(alice, bob):
|
||||
page, _ = alice
|
||||
other, _ = bob
|
||||
title = f"VisGistToggle{int(time.time() * 1000)}"
|
||||
url = _create_gist_with_visibility(page, title, None)
|
||||
assert _gists_list_has(page, title)
|
||||
_edit_gist_visibility(page, url, "offline")
|
||||
assert not _gists_list_has(page, title)
|
||||
other.goto(url, wait_until="domcontentloaded")
|
||||
assert other.locator(f"text={title}").count() == 0
|
||||
_edit_gist_visibility(page, url, "published")
|
||||
assert _gists_list_has(page, title)
|
||||
other.goto(url, wait_until="domcontentloaded")
|
||||
expect(other.locator(f"text={title}").first).to_be_visible()
|
||||
|
||||
|
||||
def test_gist_edit_modal_changes_visibility(alice):
|
||||
page, _ = alice
|
||||
title = f"VisGistEdit{int(time.time() * 1000)}"
|
||||
url = _create_gist_with_visibility(page, title, None)
|
||||
page.locator("[data-modal='edit-gist-modal']").click()
|
||||
expect(page.locator("#edit-gist-visibility")).to_have_value("published")
|
||||
page.select_option("#edit-gist-visibility", "hidden")
|
||||
page.locator("#edit-gist-modal button.btn-primary").click()
|
||||
page.wait_for_url(url, wait_until="domcontentloaded")
|
||||
assert not _gists_list_has(page, title)
|
||||
|
||||
|
||||
def test_gist_visibility_field_fits_a_phone(mobile_page):
|
||||
page, _ = mobile_page
|
||||
title = f"VisGistPhone{int(time.time() * 1000)}"
|
||||
_create_gist_with_visibility(page, title, "hidden")
|
||||
page.locator("[data-modal='edit-gist-modal']").click()
|
||||
expect(page.locator("#edit-gist-visibility")).to_be_visible()
|
||||
assert_no_horizontal_overflow(page, ".gist-detail-page")
|
||||
|
||||
Reference in New Issue
Block a user