functional_tests + CI: rename pass + structural consolidations + parallel test-FTs split — every FT file now starts with one of 6 prefixes (test_admin_* / test_bill_* / test_core_* / test_dash_* / test_game_room_* / test_trinket_*) plus the 4 page-roots test_billboard / test_dashboard / test_gameboard / test_jasmine, so the partition is unambiguous and stable for tooling (the previous mix of test_applet_*, test_room_*, test_component_*, ad-hoc names had no consistent grouping); session-side: merged test_gatekeeper_bud_btn.py into test_bud_btn.py (then user renamed to test_core_bud_btn.py) — both files drove the same #id_bud_btn UI in two contexts (post-share + gatekeeper invite) and shared the bud-btn.js skeleton, so consolidation was overdue; split test_component_cards_tarot.py into test_admin_tarot.py (just TarotAdminTest, sitting next to test_admin / test_admin_post_readonly) + 3 classes (TarotDeckTest / GameKitDeckSelectionTest / GameKitPageTest) appended to test_game_room_tray.py; updated stale test_bud_btn.py references in the test_core_bud_btn.py docstring + test_admin_post_readonly.py comment to point at the new filename; user-driven renames (22 files): test_applet_my_notes/posts → test_bill_my_*, test_applet_new_post[_line_validation] → test_bill_new_post[_line_validation], test_applet_my_sky → test_dash_my_sky, test_applet_palette → test_dash_palette, test_wallet → test_dash_wallet, test_login → test_core_login, test_navbar → test_core_navbar, test_sharing → test_core_sharing, test_layout_and_styling → test_core_styling, test_my_buds → test_bill_my_buds, test_bud_btn → test_core_bud_btn, test_deck_contribution → test_game_room_deck_contrib, test_game_invite → test_game_room_invite, test_room_gatekeeper → test_game_room_gatekeeper, test_room_role_select → test_game_room_select_role, test_room_sea_select → test_game_room_select_sea, test_room_sig_select → test_game_room_select_sig, test_room_sky_select → test_game_room_select_sky, test_room_tray → test_game_room_tray, test_component_tray_tooltip → test_game_room_tray_tooltip; the post_page.py / room_page.py helper modules from the May-12 sprint absorbed the cross-file FT imports that would otherwise have cascade-broken on these renames
.woodpecker/main.yaml — CI test-FTs step splits into parallel siblings test-FTs-non-room (22 files via `ls functional_tests/test_*.py | grep -v 'test_game_room_'`) + test-FTs-room (9 files via `ls functional_tests/test_game_room_*.py`); room cluster is the heaviest (~70% of the pre-split ~40-min wall-clock) and now runs concurrently w. the rest instead of in series; DAG explicit via depends_on on every step (Woodpecker mixes default-sequential w. depends_on awkwardly, so each step pins its prerequisite); collectstatic stays in test-two-browser-FTs only — the shared workspace propagates assets to both parallel FT steps, no race + no duplication; screendumps + build-and-push fan back in (depends_on both parallel steps); deploy-staging + deploy-prod depend on build-and-push smoke-import: 31/31 FT modules green after the rename pass Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
76
src/functional_tests/test_core_sharing.py
Normal file
76
src/functional_tests/test_core_sharing.py
Normal file
@@ -0,0 +1,76 @@
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.test import tag
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from .base import FunctionalTest
|
||||
from .post_page import PostPage
|
||||
from .my_posts_page import MyPostsPage
|
||||
|
||||
|
||||
# Helper fns
|
||||
def quit_if_possible(browser):
|
||||
try:
|
||||
browser.quit()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
# Test mdls
|
||||
class SharingTest(FunctionalTest):
|
||||
@tag("two-browser")
|
||||
def test_can_share_a_post_with_another_user(self):
|
||||
self.create_pre_authenticated_session("disco@test.io")
|
||||
disco_browser = self.browser
|
||||
self.addCleanup(lambda: quit_if_possible(disco_browser))
|
||||
|
||||
options = webdriver.FirefoxOptions()
|
||||
if os.environ.get("HEADLESS"):
|
||||
options.add_argument("--headless")
|
||||
ali_browser = webdriver.Firefox(options=options)
|
||||
self.addCleanup(lambda: quit_if_possible(ali_browser))
|
||||
self.browser = ali_browser
|
||||
self.create_pre_authenticated_session("alice@test.io")
|
||||
|
||||
self.browser = disco_browser
|
||||
self.browser.get(self.live_server_url + '/billboard/')
|
||||
post_page = PostPage(self).add_post_line("Send help")
|
||||
|
||||
share_box = post_page.get_share_box()
|
||||
self.assertEqual(
|
||||
share_box.get_attribute("placeholder"),
|
||||
"friend@example.com or username",
|
||||
)
|
||||
|
||||
post_page.share_post_with("alice@test.io")
|
||||
|
||||
self.browser = ali_browser
|
||||
MyPostsPage(self).go_to_my_posts_page("alice@test.io")
|
||||
|
||||
self.browser.find_element(By.LINK_TEXT, "Send help").click()
|
||||
|
||||
self.wait_for(
|
||||
lambda: self.assertEqual(post_page.get_post_owner(), "disco@test.io")
|
||||
)
|
||||
|
||||
post_page.add_post_line("At your command, Disco King")
|
||||
|
||||
self.browser = disco_browser
|
||||
self.browser.refresh()
|
||||
# Line numbering: 1) "Send help" 2) "Shared with alice@test.io …"
|
||||
# (auto-appended by share_post in C3.b) 3) Alice's reply.
|
||||
post_page.wait_for_row_in_post_table("At your command, Disco King", 3)
|
||||
|
||||
class PostAccessTest(FunctionalTest):
|
||||
def test_stranger_cannot_access_owned_post(self):
|
||||
self.create_pre_authenticated_session("disco@test.io")
|
||||
self.browser.get(self.live_server_url + '/billboard/')
|
||||
PostPage(self).add_post_line("private eye")
|
||||
post_url = self.browser.current_url
|
||||
|
||||
self.browser.delete_cookie(settings.SESSION_COOKIE_NAME)
|
||||
self.browser.get(post_url)
|
||||
|
||||
self.assertNotEqual(self.browser.current_url, post_url)
|
||||
Reference in New Issue
Block a user