diff --git a/phpbb-test-board/README.md b/phpbb-test-board/README.md index 8d53ee9..b2d392e 100644 --- a/phpbb-test-board/README.md +++ b/phpbb-test-board/README.md @@ -124,6 +124,8 @@ Saves PNG screenshots of an extension's or style's pages with [Playwright](https `phpbbmodders/contactadmin` saves the three documentation gallery shots (ACP settings, guest form, member form) with private-message delivery and no captcha, plus three for its 10/18/2026 update gallery. The last of those sends a guest message through the form and shows the topic the contact bot posts. +`phpbbmodders/genders` gives every member a gender and saves the UCP selector, a topic, a profile and the ACP settings with the defaults, then the same topic, profile and settings with gender text before the icon, the phpBB 3.0 MOD prosilver icon set and gender in the main profile details. Use `--seed` with seed-forum's standard fixtures. + `phpbbmodders/knowledgebase` makes its own categories, articles (live, waiting for review, with a revision, and a draft) and forum questions, so a board search for `backup` shows its block; `--seed` with seed-forum's standard fixtures adds members to write them. Its two ACP pages are taken in full, so a new setting is not cut off. `phpbbmodders/newspage` replaces the board's welcome topic with four example news topics, the last one opening with a picture the script draws (and deletes afterwards), and makes that forum the news forum. It saves the news page with the first image above the text and without poster information or post buttons, one news item as the admin, the ACP settings (in full), the news page on a phone and filtered by forum, then the news page with poster information and post buttons on, shortened to 120 characters, and without the filters. diff --git a/phpbb-test-board/feature_checks.py b/phpbb-test-board/feature_checks.py index 4a71a3f..ad40bc0 100755 --- a/phpbb-test-board/feature_checks.py +++ b/phpbb-test-board/feature_checks.py @@ -619,7 +619,31 @@ def config(name: str) -> str: ok(not changed, "saving the settings changed no other setting" + (f": {changed}" if changed else "")) +def check_genders(b: Board) -> None: + """Exercise the reported profile and UCP paths with the stock board style.""" + member = requests.Session() + sid = b.login(member, acp=True) + ucp = f"{b.base}/ucp.php?i=ucp_profile&mode=profile_info&sid={sid}" + page = member.get(ucp, timeout=20) + action, fields = form_fields(page.text, "ucp") + ok(page.ok and 'name="user_gender"' in page.text and "form_token" in fields, + "UCP profile displays the gender selector and form token") + post_back(member, b.base, ucp, action, {**fields, "user_gender": "2", "submit": "Submit"}) + saved = b.sql("SELECT user_gender FROM phpbb_users WHERE user_id = 2") + ok(saved and str(saved[0][0]) == "2", "UCP saves the selected gender") + page = member.get(ucp, timeout=20) + ok(re.search(r' None: shoot.shot("posteripinviewtopic-lookup", f"viewtopic.php?t={topic}&sid={{sid}}", admin=True, prepare=look_up) +def shots_genders(board: Board, shoot: Shooter, args: argparse.Namespace) -> None: + """phpbbmodders/genders: the gender selector, genders on posts and profiles, and the ACP settings. + + Needs a board with posts by several members: run with --seed and + seed-forum's bin/seed-standard-fixtures.php. Every member gets a gender, + cycling through the first few choices. genders-ucp-profile, + genders-viewtopic, genders-profile and genders-acp-settings use the + default settings (icon only, User Statistics). genders-viewtopic-text, + genders-profile-details and genders-acp-settings-changed show the + 1.4.0-dev settings: gender text before the icon, the phpBB 3.0 MOD + prosilver icon set, and gender in the main profile details. + """ + users = [row[0] for row in board.sql("SELECT user_id FROM phpbb_users WHERE user_type IN (0, 3) ORDER BY user_id")] + for n, user_id in enumerate(users): + board.sql("UPDATE phpbb_users SET user_gender = ? WHERE user_id = ?", (n % 4 + 1, user_id)) + board.sql("UPDATE phpbb_users SET user_gender = 2 WHERE user_id = 2") + board.purge_cache() + _, topic = busiest_forum_and_topic(board) + acp = "adm/index.php?i=-phpbbmodders-genders-acp-settings_module&mode=settings&sid={sid}" + + def first_posts(p) -> None: + # Keep the title and the first three posts + p.add_style_tag(content="#page-body > .post:nth-of-type(n+4) ~ *:not(.action-bar.bar-top)," + "#page-body > .post:nth-of-type(n+4) { display: none; }") + shoot.shot("genders-ucp-profile", "ucp.php?i=ucp_profile&mode=profile_info&sid={sid}", admin=True, + selector="form#ucp") + shoot.shot("genders-viewtopic", f"viewtopic.php?t={topic}", selector="#page-body", prepare=first_posts) + shoot.shot("genders-profile", "memberlist.php?mode=viewprofile&u=2&sid={sid}", admin=True, selector="#page-body") + shoot.shot("genders-acp-settings", acp, admin=True, full_page=True) + + set_config(board, {"genders_show_text": "1", "genders_icon_set": "prosilver", "genders_profile_details": "1"}) + shoot.shot("genders-viewtopic-text", f"viewtopic.php?t={topic}", selector="#page-body", prepare=first_posts) + shoot.shot("genders-profile-details", "memberlist.php?mode=viewprofile&u=2&sid={sid}", admin=True, + selector="#page-body") + shoot.shot("genders-acp-settings-changed", acp, admin=True, full_page=True) + + SHOTS = { "phpbbmodders/contactadmin": shots_contactadmin, + "phpbbmodders/genders": shots_genders, "phpbbmodders/copylinks": shots_copylinks, "phpbbmodders/documentation": shots_documentation, "phpbbmodders/feedlinks": shots_feedlinks,