Repository navigation
Test every public Page method; check client actions against their services - #88
Merged
Merged
Conversation
… services PageApiCoverageTest fails for any public Ruflet::Page method that is not tested. A method is tested either through a table in test/support/page_api_contract.rb, whose tests PageApiContractTest generates, or by a test named in COVERED_BY, which must exist and call the method. The tables: - the 43 methods that call the client (page.get_battery_level, page.launch_url, page.close_drawer, ...): target service, page or view, method name, args, and the reply reaching on_result; - the 26 service accessors (page.battery, page.local_auth, ...): mounted once in the service registry, with the four proxy accessors still returning their proxy; - camera and screenshot, built but not mounted; - 18 page properties: read back, and sent on the page or on its view by page.update. New tests for the 16 methods no test called: the bottom sheet and snack bar writers, show_snack_bar, pop_dialog, go, on_view_pop=, patch_page, invoke_sync (reply and error), remove_service, services=, replay_route_after_reload!, session_id and method_missing's page props. ClientActionContractTest checks that each client action names a service and method Ruby can call. It also checks that each option is sent under the arg the matching Ruby service method sends it under, since the renderer runs both through the same handler.
AdamMusa
force-pushed
the
test/page-api-contracts
branch
from
November 16, 2026 06:28
bb17a7e to
1d23bbc
Compare
This was referenced Nov 17, 2026
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the release-readiness test pass, alongside #86 (controls) and #87 (control and service methods). It adds tests only; no lib changes.
Page APIs
PageApiCoverageTestfails for any publicRuflet::Pagemethod that isn't tested. A method counts as tested in one of two ways:test/support/page_api_contract.rb, whose testsPageApiContractTestgenerates;COVERED_BY, and the meta-test checks that the named test exists and calls the method.INVOKESpage.get_battery_level,page.launch_url,page.close_drawer, …)1or view), method name, args, call id, and that the reply reacheson_resultSERVICESpage.battery,page.local_auth, …)VISUALcamera,screenshotPROPSpage.updatesends the value on the page (title, alignments) or on its view16 methods had no test calling them. They now have new tests:
show_snack_bar;pop_dialog,go,on_view_pop=,patch_page;invoke_sync, covering both the reply and the error;remove_serviceby control, id or type;services=,replay_route_after_reload!,session_id;method_missing.Coverage: of 181 public
Pagemethods, 13 had no test mentioning them, and nothing enforced coverage. Now all 181 are covered and enforced.Client actions
ClientActionContractTestcovers each of the six actions. The renderer runs a client action through the same service handler that a Ruby call reaches, so the test checks that each action:They all agree today.
Found, not fixed here
page.can_launch_url(url, timeout:)takes noon_result:. The client's answer therefore never reaches the caller. The fix goes inpage.rb, which #82 changes, so it follows once #82 has merged.Verified