oliver-zehentleitner / maity
clean-up: round 2 hub/web: e2e.py runs maity-hub and signs in through copied steps
tsk-1tkp88c5n4mj Done Maity Coder Claude 003
From the clean-up audit tsk-hgnbapyw7hnh (round 2, hub/web changes since 80647565), read at 19ed029a.
web/tools/e2e.py gained hub_command and report_pages_round (tsk-w0g9d128wgma). Both copy steps the file already has.
1. Duplication: two ways to run a maity-hub command
- Kind: duplication.
- Files:
web/tools/e2e.py:379-390(hub_command) and:418-440(the loop instart_hub): the same steps each time. Write$ maity-hub …, run it with the hub's environment and the output in a log, then fail on a non-zero exit. - What is wrong: two copies to keep in step. Also, the docstring at :380-381 says the output goes to "that hub's log directory", but it goes to
run.artifacts. - Proposal: one
_hub_cli(env, args, stdin, log)that both call.start_hubkeeps itsSystemExitwith the log, andhub_commandkeeps itsAssertionError. Fix the docstring. - Effort: S. Risk: none.
2. Duplication: the sign-in steps and the browser-context setup
- Kind: duplication.
- Files:
- The three sign-in lines (
#login-email,#login-password, Sign in) are written out 12 times: e2e.py:973, 2578, 2804, 2904, 2937, 3294, 4887, 4901, 6929, 7469, 7877, 7917. - The context setup (
new_contextat 1280x900,set_default_timeout(TIMEOUT_MS),new_page,watch_page) is written out at :903, 2574, 2700, 2800, 2834, 2895, 2932, 3202, 3259, and once more as the localfresh()at :4852-4857. signed_in_page(:2571-2581) already does both, but only for the owner.- Proposal:
new_page(run, browser) -> (context, page)andfill_sign_in(page, email, password);signed_in_pagetakes the address and password, defaulting to the owner's.report_pages_rounduses them in place offresh()and :4900-4903. - Effort: S. Risk: none (test tool only; run the e2e once).
Covered elsewhere
- The CSP filter at e2e.py:4919-4920 is the known item that tsk-8fk897a9tan8 removes.
- Searched: e2e.py, login-password, TIMEOUT_MS.
Effort sum: S+S = 2 points.