Keep composers usable, group actions and notifications, and drop the tool-count cap
DevPlace CI / test (push) Failing after 3h10m39s
DevPlace CI / test (push) Failing after 3h10m39s
Comment and post layouts stay full width on small screens. Secondary actions live in the More menu. Notifications can be grouped and throttled, and Enter can submit when that profile setting is on. Emulated-tool models accept large catalogs, with reserved names aliased on the wire and the catalog cached per owner. A dropped service-worker navigation is retried once. The test server waits 120s to finish importing before it is stopped.
This commit is contained in:
@@ -14,7 +14,7 @@ def _create_plain_post_engagement_ui(page, content):
|
||||
page.wait_for_url(f"{BASE_URL}/posts/*", wait_until="domcontentloaded")
|
||||
from uuid import uuid4
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from tests.conftest import BASE_URL, assert_share_copies
|
||||
from tests.conftest import BASE_URL, assert_share_copies, click_menu_action, open_action_menu
|
||||
from devplacepy.database import get_table
|
||||
from devplacepy.utils import make_combined_slug
|
||||
def _seed_posts(count):
|
||||
@@ -378,7 +378,7 @@ def test_add_poll_to_existing_post_via_edit(alice):
|
||||
_create_plain_post_engagement_ui(page, "Post that gains a poll through the edit modal.")
|
||||
expect(page.locator(".poll")).to_have_count(0)
|
||||
|
||||
page.locator("[data-modal='edit-post-modal']").click()
|
||||
click_menu_action(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
modal = page.locator("#edit-post-modal")
|
||||
expect(modal).to_be_visible()
|
||||
modal.locator("[data-poll-toggle]").click()
|
||||
@@ -485,7 +485,7 @@ def test_post_edit_button(alice):
|
||||
page.fill("#post-title", "Editable Post")
|
||||
page.locator("#create-post-modal button.btn-primary:has-text('Post')").click()
|
||||
page.wait_for_url(f"{BASE_URL}/posts/*", wait_until="domcontentloaded")
|
||||
edit_btn = page.locator("button:has-text('Edit')")
|
||||
edit_btn = open_action_menu(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
assert edit_btn.is_visible()
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ def test_post_edit_modal(alice):
|
||||
page.fill("#post-title", "Edit Modal Test")
|
||||
page.locator("#create-post-modal button.btn-primary:has-text('Post')").click()
|
||||
page.wait_for_url(f"{BASE_URL}/posts/*", wait_until="domcontentloaded")
|
||||
page.click("button:has-text('Edit')")
|
||||
click_menu_action(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
assert page.is_visible("h3:has-text('Edit Post')")
|
||||
|
||||
|
||||
@@ -509,7 +509,7 @@ def test_post_edit_submit(alice):
|
||||
page.fill("#post-title", "Original Title")
|
||||
page.locator("#create-post-modal button.btn-primary:has-text('Post')").click()
|
||||
page.wait_for_url(f"{BASE_URL}/posts/*", wait_until="domcontentloaded")
|
||||
page.click("button:has-text('Edit')")
|
||||
click_menu_action(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
page.fill("#edit-title", "Edited Title")
|
||||
page.fill("#edit-content", "Edited content for the post")
|
||||
page.click("button:has-text('Save Changes')")
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
import time
|
||||
|
||||
from playwright.sync_api import expect
|
||||
|
||||
from tests.conftest import BASE_URL
|
||||
|
||||
JSON = {"Accept": "application/json"}
|
||||
|
||||
|
||||
def _create_post(page, content):
|
||||
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
|
||||
page.locator(".feed-fab").first.wait_for(state="visible", timeout=10000)
|
||||
page.locator(".feed-fab").first.click()
|
||||
page.fill("#post-title", f"Requested {int(time.time() * 1000)}")
|
||||
page.fill("#post-content", content)
|
||||
page.locator("#create-post-modal button.btn-primary:has-text('Post')").click()
|
||||
page.wait_for_url(f"{BASE_URL}/posts/*", wait_until="domcontentloaded")
|
||||
|
||||
|
||||
def test_title_is_first_and_focused(alice):
|
||||
page, _user = alice
|
||||
page.goto(f"{BASE_URL}/feed", wait_until="domcontentloaded")
|
||||
page.locator(".feed-fab").first.wait_for(state="visible", timeout=10000)
|
||||
page.locator(".feed-fab").first.click()
|
||||
title = page.locator("#post-title")
|
||||
expect(title).to_be_focused()
|
||||
order = page.evaluate(
|
||||
"""() => {
|
||||
const title = document.querySelector('#post-title');
|
||||
const content = document.querySelector('#post-content');
|
||||
return (title.compareDocumentPosition(content) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
|
||||
}"""
|
||||
)
|
||||
assert order is True
|
||||
|
||||
|
||||
def test_post_detail_groups_secondary_actions_in_more_menu(alice):
|
||||
page, _user = alice
|
||||
_create_post(page, "Menu grouping post content.")
|
||||
expect(page.locator(".post-votes")).to_be_visible()
|
||||
expect(page.locator("[data-action-menu-trigger]")).to_be_visible()
|
||||
panel = page.locator("#post-actions-panel")
|
||||
expect(panel).to_be_hidden()
|
||||
page.locator("[data-action-menu-trigger]").click()
|
||||
expect(panel).to_be_visible()
|
||||
expect(panel.locator("[data-share]")).to_be_visible()
|
||||
expect(panel.locator(".bookmark-btn")).to_be_visible()
|
||||
page.keyboard.press("Escape")
|
||||
expect(panel).to_be_hidden()
|
||||
|
||||
|
||||
def test_comment_enter_posts_and_shift_enter_newlines(alice):
|
||||
page, user = alice
|
||||
username = user["username"]
|
||||
try:
|
||||
_create_post(page, "Enter key comment post content.")
|
||||
box = page.locator(".comment-form textarea[name='content']").first
|
||||
box.click()
|
||||
box.fill("First line")
|
||||
box.press("Shift+Enter")
|
||||
box.type("second line")
|
||||
assert "\n" in box.input_value()
|
||||
box.fill("Posted by Enter key")
|
||||
box.press("Enter")
|
||||
expect(page.locator(".comment-text", has_text="Posted by Enter key").first).to_be_visible(timeout=10000)
|
||||
finally:
|
||||
page.request.post(
|
||||
f"{BASE_URL}/profile/{username}/enter-to-submit",
|
||||
form={"value": "true"},
|
||||
headers=JSON,
|
||||
)
|
||||
|
||||
|
||||
def test_comment_enter_newlines_when_setting_off(alice):
|
||||
page, user = alice
|
||||
username = user["username"]
|
||||
resp = page.request.post(
|
||||
f"{BASE_URL}/profile/{username}/enter-to-submit",
|
||||
form={"value": "false"},
|
||||
headers=JSON,
|
||||
)
|
||||
assert resp.status == 200
|
||||
try:
|
||||
_create_post(page, "Enter off comment post content.")
|
||||
box = page.locator(".comment-form textarea[name='content']").first
|
||||
box.click()
|
||||
box.fill("Not posted yet")
|
||||
box.press("Enter")
|
||||
box.type("still editing")
|
||||
assert "still editing" in box.input_value()
|
||||
expect(page.locator(".comment-text", has_text="Not posted yet")).to_have_count(0)
|
||||
finally:
|
||||
page.request.post(
|
||||
f"{BASE_URL}/profile/{username}/enter-to-submit",
|
||||
form={"value": "true"},
|
||||
headers=JSON,
|
||||
)
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import time
|
||||
from playwright.sync_api import expect
|
||||
from tests.conftest import BASE_URL, assert_no_horizontal_overflow
|
||||
from tests.conftest import BASE_URL, assert_no_horizontal_overflow, click_menu_action
|
||||
|
||||
|
||||
def _unique():
|
||||
@@ -23,7 +23,7 @@ def _compose(page, token, visibility=None):
|
||||
|
||||
def _edit_visibility(page, url, value):
|
||||
page.goto(url, wait_until="domcontentloaded")
|
||||
page.locator("[data-modal='edit-post-modal']").click()
|
||||
click_menu_action(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
page.select_option("#edit-post-visibility", value)
|
||||
page.locator("#edit-post-form button.btn-primary").click()
|
||||
page.wait_for_url(url, wait_until="domcontentloaded")
|
||||
@@ -38,7 +38,7 @@ def test_new_post_defaults_to_published(alice):
|
||||
page, _ = alice
|
||||
token = _unique()
|
||||
url = _compose(page, token)
|
||||
page.locator("[data-modal='edit-post-modal']").click()
|
||||
click_menu_action(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
expect(page.locator("#edit-post-visibility")).to_have_value("published")
|
||||
assert _feed_has(page, token)
|
||||
page.goto(url, wait_until="domcontentloaded")
|
||||
@@ -57,7 +57,7 @@ def test_create_hidden_post_leaves_the_feed(alice):
|
||||
page, _ = alice
|
||||
token = _unique()
|
||||
url = _compose(page, token, "hidden")
|
||||
page.locator("[data-modal='edit-post-modal']").click()
|
||||
click_menu_action(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
expect(page.locator("#edit-post-visibility")).to_have_value("hidden")
|
||||
assert not _feed_has(page, token)
|
||||
page.goto(url, wait_until="domcontentloaded")
|
||||
@@ -92,7 +92,7 @@ def test_offline_post_is_not_shown_to_other_members(alice, bob):
|
||||
def test_edit_form_lists_the_three_choices(alice):
|
||||
page, _ = alice
|
||||
_compose(page, _unique())
|
||||
page.locator("[data-modal='edit-post-modal']").click()
|
||||
click_menu_action(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
options = page.locator("#edit-post-visibility option")
|
||||
assert options.all_text_contents() == ["Published", "Hidden", "Offline"]
|
||||
|
||||
@@ -100,6 +100,6 @@ def test_edit_form_lists_the_three_choices(alice):
|
||||
def test_visibility_field_fits_a_phone(mobile_page):
|
||||
page, _ = mobile_page
|
||||
_compose(page, _unique(), "hidden")
|
||||
page.locator("[data-modal='edit-post-modal']").click()
|
||||
click_menu_action(page.locator("#post-actions-panel [data-modal='edit-post-modal']"))
|
||||
expect(page.locator("#edit-post-visibility")).to_be_visible()
|
||||
assert_no_horizontal_overflow(page, ".post-page")
|
||||
|
||||
Reference in New Issue
Block a user