Datasets:
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- android/acclorite-book-story/LICENSEAdded+674
- android/acclorite-book-story/instance.jsonAdded+17
- android/acclorite-book-story/reference/launch.shAdded+9
- android/acclorite-book-story/reference/patches/local-source.patchAdded+14
- android/acclorite-book-story/tests/android_computation_eval.jsonAdded+197
- android/acclorite-book-story/tests/android_interaction_eval.jsonAdded+191
- android/acclorite-book-story/tests/android_navigation_eval.jsonAdded+308
- android/acclorite-book-story/tests/android_states_eval.jsonAdded+279
- android/acclorite-book-story/tests/android_structure_eval.jsonAdded+265
- android/acclorite-book-story/tests/android_testgen_kit.pyAdded+1910
- android/acclorite-book-story/tests/android_text_eval.jsonAdded+230
- android/acclorite-book-story/tests/book_fixture.pyAdded+241
- android/acclorite-book-story/tests/conftest.pyAdded+1
- android/acclorite-book-story/tests/fixtures/BookStoryTest/test_book.txtAdded+43
- android/acclorite-book-story/tests/fixtures/Books/alpha_wonderland.txtAdded+7
- android/acclorite-book-story/tests/fixtures/Books/testbook.txtAdded+11
- android/acclorite-book-story/tests/requirements.txtAdded+2
- android/acclorite-book-story/tests/test_android_computation.pyAdded+750
- android/acclorite-book-story/tests/test_android_interaction.pyAdded+680
- android/acclorite-book-story/tests/test_android_navigation.pyAdded+650
- android/acclorite-book-story/tests/test_android_states.pyAdded+1044
- android/acclorite-book-story/tests/test_android_structure.pyAdded+734
- android/acclorite-book-story/tests/test_android_text.pyAdded+745
- android/acclorite-book-story/tests/test_manifest.jsonAdded+887
- android/acclorite-book-story/vlm_assertions.jsonAdded+756
- android/alialbaali-noto/LICENSE.mdAdded+201
- android/alialbaali-noto/instance.jsonAdded+10
- android/alialbaali-noto/reference/launch.shAdded+9
- android/alialbaali-noto/tests/android_computation_eval.jsonAdded+233
- android/alialbaali-noto/tests/android_interaction_eval.jsonAdded+228
- android/alialbaali-noto/tests/android_navigation_eval.jsonAdded+263
- android/alialbaali-noto/tests/android_states_eval.jsonAdded+295
- android/alialbaali-noto/tests/android_structure_eval.jsonAdded+229
- android/alialbaali-noto/tests/android_testgen_kit.pyAdded+1851
- android/alialbaali-noto/tests/android_text_eval.jsonAdded+206
- android/alialbaali-noto/tests/conftest.pyAdded+1
- android/alialbaali-noto/tests/requirements.txtAdded+2
- android/alialbaali-noto/tests/test_android_computation.pyAdded+615
- android/alialbaali-noto/tests/test_android_interaction.pyAdded+722
- android/alialbaali-noto/tests/test_android_navigation.pyAdded+589
- android/alialbaali-noto/tests/test_android_states.pyAdded+959
- android/alialbaali-noto/tests/test_android_structure.pyAdded+564
- android/alialbaali-noto/tests/test_android_text.pyAdded+719
- android/alialbaali-noto/tests/test_manifest.jsonAdded+885
- android/alialbaali-noto/vlm_assertions.jsonAdded+796
- android/andreynovikov-trekarta/LICENSEAdded+675
- android/andreynovikov-trekarta/instance.jsonAdded+10
- android/andreynovikov-trekarta/reference/launch.shAdded+9
- android/andreynovikov-trekarta/tests/android_computation_eval.jsonAdded+113
- android/andreynovikov-trekarta/tests/android_interaction_eval.jsonAdded+320
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license forsoftware and other kinds of works.
The licenses for most software and other practical works are designedto take away your freedom to share and change the works. By contrast,the GNU General Public License is intended to guarantee your freedom toshare and change all versions of a program--to make sure it remains freesoftware for all its users. We, the Free Software Foundation, use theGNU General Public License for most of our software; it applies also toany other work released this way by its authors. You can apply it toyour programs, too.
When we speak of free software, we are referring to freedom, notprice. Our General Public Licenses are designed to make sure that youhave the freedom to distribute copies of free software (and charge forthem if you wish), that you receive source code or can get it if youwant it, that you can change the software or use pieces of it in newfree programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying youthese rights or asking you to surrender the rights. Therefore, you havecertain responsibilities if you distribute copies of the software, or ifyou modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whethergratis or for a fee, you must pass on to the recipients the samefreedoms that you received. You must make sure that they, too, receiveor can get the source code. And you must show them these terms so theyknow their rights.
Developers that use the GNU GPL protect your rights with two steps:(1) assert copyright on the software, and (2) offer you this Licensegiving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explainsthat there is no warranty for this free software. For both users' andauthors' sake, the GPL requires that modified versions be marked aschanged, so that their problems will not be attributed erroneously toauthors of previous versions.
Some devices are designed to deny users access to install or runmodified versions of the software inside them, although the manufacturercan do so. This is fundamentally incompatible with the aim ofprotecting users' freedom to change the software. The systematicpattern of such abuse occurs in the area of products for individuals touse, which is precisely where it is most unacceptable. Therefore, wehave designed this version of the GPL to prohibit the practice for thoseproducts. If such problems arise substantially in other domains, westand ready to extend this provision to those domains in future versionsof the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.States should not allow patents to restrict development and use ofsoftware on general-purpose computers, but in those that do, we wish toavoid the special danger that patents applied to a free program couldmake it effectively proprietary. To prevent this, the GPL assures thatpatents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution andmodification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds ofworks, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under thisLicense. Each licensee is addressed as "you". "Licensees" and"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the workin a fashion requiring copyright permission, other than the making of anexact copy. The resulting work is called a "modified version" of theearlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work basedon the Program.
To "propagate" a work means to do anything with it that, withoutpermission, would make you directly or secondarily liable forinfringement under applicable copyright law, except executing it on acomputer or modifying a private copy. Propagation includes copying,distribution (with or without modification), making available to thepublic, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables otherparties to make or receive copies. Mere interaction with a user througha computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"to the extent that it includes a convenient and prominently visiblefeature that (1) displays an appropriate copyright notice, and (2)tells the user that there is no warranty for the work (except to theextent that warranties are provided), that licensees may convey thework under this License, and how to view a copy of this License. Ifthe interface presents a list of user commands or options, such as amenu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the workfor making modifications to it. "Object code" means any non-sourceform of a work.
A "Standard Interface" means an interface that either is an officialstandard defined by a recognized standards body, or, in the case ofinterfaces specified for a particular programming language, one thatis widely used among developers working in that language.
The "System Libraries" of an executable work include anything, otherthan the work as a whole, that (a) is included in the normal form ofpackaging a Major Component, but which is not part of that MajorComponent, and (b) serves only to enable use of the work with thatMajor Component, or to implement a Standard Interface for which animplementation is available to the public in source code form. A"Major Component", in this context, means a major essential component(kernel, window system, and so on) of the specific operating system(if any) on which the executable work runs, or a compiler used toproduce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means allthe source code needed to generate, install, and (for an executablework) run the object code and to modify the work, including scripts tocontrol those activities. However, it does not include the work'sSystem Libraries, or general-purpose tools or generally available freeprograms which are used unmodified in performing those activities butwhich are not part of the work. For example, Corresponding Sourceincludes interface definition files associated with source files forthe work, and the source code for shared libraries and dynamicallylinked subprograms that the work is specifically designed to require,such as by intimate data communication or control flow between thosesubprograms and other parts of the work.
The Corresponding Source need not include anything that userscan regenerate automatically from other parts of the CorrespondingSource.
The Corresponding Source for a work in source code form is thatsame work.
2. Basic Permissions.
All rights granted under this License are granted for the term ofcopyright on the Program, and are irrevocable provided the statedconditions are met. This License explicitly affirms your unlimitedpermission to run the unmodified Program. The output from running acovered work is covered by this License only if the output, given itscontent, constitutes a covered work. This License acknowledges yourrights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do notconvey, without conditions so long as your license otherwise remainsin force. You may convey covered works to others for the sole purposeof having them make modifications exclusively for you, or provide youwith facilities for running those works, provided that you comply withthe terms of this License in conveying all material for which you donot control copyright. Those thus making or running the covered worksfor you must do so exclusively on your behalf, under your directionand control, on terms that prohibit them from making any copies ofyour copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely underthe conditions stated below. Sublicensing is not allowed; section 10makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technologicalmeasure under any applicable law fulfilling obligations under article11 of the WIPO copyright treaty adopted on 20 December 1996, orsimilar laws prohibiting or restricting circumvention of suchmeasures.
When you convey a covered work, you waive any legal power to forbidcircumvention of technological measures to the extent such circumventionis effected by exercising rights under this License with respect tothe covered work, and you disclaim any intention to limit operation ormodification of the work as a means of enforcing, against the work'susers, your or third parties' legal rights to forbid circumvention oftechnological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as youreceive it, in any medium, provided that you conspicuously andappropriately publish on each copy an appropriate copyright notice;keep intact all notices stating that this License and anynon-permissive terms added in accord with section 7 apply to the code;keep intact all notices of the absence of any warranty; and give allrecipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications toproduce it from the Program, in the form of source code under theterms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independentworks, which are not by their nature extensions of the covered work,and which are not combined with it such as to form a larger program,in or on a volume of a storage or distribution medium, is called an"aggregate" if the compilation and its resulting copyright are notused to limit the access or legal rights of the compilation's usersbeyond what the individual works permit. Inclusion of a covered workin an aggregate does not cause this License to apply to the otherparts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the termsof sections 4 and 5, provided that you also convey themachine-readable Corresponding Source under the terms of this License,in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excludedfrom the Corresponding Source as a System Library, need not beincluded in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means anytangible personal property which is normally used for personal, family,or household purposes, or (2) anything designed or sold for incorporationinto a dwelling. In determining whether a product is a consumer product,doubtful cases shall be resolved in favor of coverage. For a particularproduct received by a particular user, "normally used" refers to atypical or common use of that class of product, regardless of the statusof the particular user or of the way in which the particular useractually uses, or expects or is expected to use, the product. A productis a consumer product regardless of whether the product has substantialcommercial, industrial or non-consumer uses, unless such uses representthe only significant mode of use of the product.
"Installation Information" for a User Product means any methods,procedures, authorization keys, or other information required to installand execute modified versions of a covered work in that User Product froma modified version of its Corresponding Source. The information mustsuffice to ensure that the continued functioning of the modified objectcode is in no case prevented or interfered with solely becausemodification has been made.
If you convey an object code work under this section in, or with, orspecifically for use in, a User Product, and the conveying occurs aspart of a transaction in which the right of possession and use of theUser Product is transferred to the recipient in perpetuity or for afixed term (regardless of how the transaction is characterized), theCorresponding Source conveyed under this section must be accompaniedby the Installation Information. But this requirement does not applyif neither you nor any third party retains the ability to installmodified object code on the User Product (for example, the work hasbeen installed in ROM).
The requirement to provide Installation Information does not include arequirement to continue to provide support service, warranty, or updatesfor a work that has been modified or installed by the recipient, or forthe User Product in which it has been modified or installed. Access to anetwork may be denied when the modification itself materially andadversely affects the operation of the network or violates the rules andprotocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,in accord with this section must be in a format that is publiclydocumented (and with an implementation available to the public insource code form), and must require no special password or key forunpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of thisLicense by making exceptions from one or more of its conditions.Additional permissions that are applicable to the entire Program shallbe treated as though they were included in this License, to the extentthat they are valid under applicable law. If additional permissionsapply only to part of the Program, that part may be used separatelyunder those permissions, but the entire Program remains governed bythis License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your optionremove any additional permissions from that copy, or from any part ofit. (Additional permissions may be written to require their ownremoval in certain cases when you modify the work.) You may placeadditional permissions on material, added by you to a covered work,for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material youadd to a covered work, you may (if authorized by the copyright holders ofthat material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered "furtherrestrictions" within the meaning of section 10. If the Program as youreceived it, or any part of it, contains a notice stating that it isgoverned by this License along with a term that is a furtherrestriction, you may remove that term. If a license document containsa further restriction but permits relicensing or conveying under thisLicense, you may add to a covered work material governed by the termsof that license document, provided that the further restriction doesnot survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, youmust place, in the relevant source files, a statement of theadditional terms that apply to those files, or a notice indicatingwhere to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in theform of a separately written license, or stated as exceptions;the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expresslyprovided under this License. Any attempt otherwise to propagate ormodify it is void, and will automatically terminate your rights underthis License (including any patent licenses granted under the thirdparagraph of section 11).
However, if you cease all violation of this License, then yourlicense from a particular copyright holder is reinstated (a)provisionally, unless and until the copyright holder explicitly andfinally terminates your license, and (b) permanently, if the copyrightholder fails to notify you of the violation by some reasonable meansprior to 60 days after the cessation.
Moreover, your license from a particular copyright holder isreinstated permanently if the copyright holder notifies you of theviolation by some reasonable means, this is the first time you havereceived notice of violation of this License (for any work) from thatcopyright holder, and you cure the violation prior to 30 days afteryour receipt of the notice.
Termination of your rights under this section does not terminate thelicenses of parties who have received copies or rights from you underthis License. If your rights have been terminated and not permanentlyreinstated, you do not qualify to receive new licenses for the samematerial under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive orrun a copy of the Program. Ancillary propagation of a covered workoccurring solely as a consequence of using peer-to-peer transmissionto receive a copy likewise does not require acceptance. However,nothing other than this License grants you permission to propagate ormodify any covered work. These actions infringe copyright if you donot accept this License. Therefore, by modifying or propagating acovered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automaticallyreceives a license from the original licensors, to run, modify andpropagate that work, subject to this License. You are not responsiblefor enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of anorganization, or substantially all assets of one, or subdividing anorganization, or merging organizations. If propagation of a coveredwork results from an entity transaction, each party to thattransaction who receives a copy of the work also receives whateverlicenses to the work the party's predecessor in interest had or couldgive under the previous paragraph, plus a right to possession of theCorresponding Source of the work from the predecessor in interest, ifthe predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of therights granted or affirmed under this License. For example, you maynot impose a license fee, royalty, or other charge for exercise ofrights granted under this License, and you may not initiate litigation(including a cross-claim or counterclaim in a lawsuit) alleging thatany patent claim is infringed by making, using, selling, offering forsale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under thisLicense of the Program or a work on which the Program is based. Thework thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claimsowned or controlled by the contributor, whether already acquired orhereafter acquired, that would be infringed by some manner, permittedby this License, of making, using, or selling its contributor version,but do not include claims that would be infringed only as aconsequence of further modification of the contributor version. Forpurposes of this definition, "control" includes the right to grantpatent sublicenses in a manner consistent with the requirements ofthis License.
Each contributor grants you a non-exclusive, worldwide, royalty-freepatent license under the contributor's essential patent claims, tomake, use, sell, offer for sale, import and otherwise run, modify andpropagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any expressagreement or commitment, however denominated, not to enforce a patent(such as an express permission to practice a patent or covenant not tosue for patent infringement). To "grant" such a patent license to aparty means to make such an agreement or commitment not to enforce apatent against the party.
If you convey a covered work, knowingly relying on a patent license,and the Corresponding Source of the work is not available for anyoneto copy, free of charge and under the terms of this License, through apublicly available network server or other readily accessible means,then you must either (1) cause the Corresponding Source to be soavailable, or (2) arrange to deprive yourself of the benefit of thepatent license for this particular work, or (3) arrange, in a mannerconsistent with the requirements of this License, to extend the patentlicense to downstream recipients. "Knowingly relying" means you haveactual knowledge that, but for the patent license, your conveying thecovered work in a country, or your recipient's use of the covered workin a country, would infringe one or more identifiable patents in thatcountry that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction orarrangement, you convey, or propagate by procuring conveyance of, acovered work, and grant a patent license to some of the partiesreceiving the covered work authorizing them to use, propagate, modifyor convey a specific copy of the covered work, then the patent licenseyou grant is automatically extended to all recipients of the coveredwork and works based on it.
A patent license is "discriminatory" if it does not include withinthe scope of its coverage, prohibits the exercise of, or isconditioned on the non-exercise of one or more of the rights that arespecifically granted under this License. You may not convey a coveredwork if you are a party to an arrangement with a third party that isin the business of distributing software, under which you make paymentto the third party based on the extent of your activity of conveyingthe work, and under which the third party grants, to any of theparties who would receive the covered work from you, a discriminatorypatent license (a) in connection with copies of the covered workconveyed by you (or copies made from those copies), or (b) primarilyfor and in connection with specific products or compilations thatcontain the covered work, unless you entered into that arrangement,or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limitingany implied license or other defenses to infringement that mayotherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement orotherwise) that contradict the conditions of this License, they do notexcuse you from the conditions of this License. If you cannot convey acovered work so as to satisfy simultaneously your obligations under thisLicense and any other pertinent obligations, then as a consequence you maynot convey it at all. For example, if you agree to terms that obligate youto collect a royalty for further conveying from those to whom you conveythe Program, the only way you could satisfy both those terms and thisLicense would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you havepermission to link or combine any covered work with a work licensedunder version 3 of the GNU Affero General Public License into a singlecombined work, and to convey the resulting work. The terms of thisLicense will continue to apply to the part which is the covered work,but the special requirements of the GNU Affero General Public License,section 13, concerning interaction through a network will apply to thecombination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions ofthe GNU General Public License from time to time. Such new versions willbe similar in spirit to the present version, but may differ in detail toaddress new problems or concerns.
Each version is given a distinguishing version number. If theProgram specifies that a certain numbered version of the GNU GeneralPublic License "or any later version" applies to it, you have theoption of following the terms and conditions either of that numberedversion or of any later version published by the Free SoftwareFoundation. If the Program does not specify a version number of theGNU General Public License, you may choose any version ever publishedby the Free Software Foundation.
If the Program specifies that a proxy can decide which futureversions of the GNU General Public License can be used, that proxy'spublic statement of acceptance of a version permanently authorizes youto choose that version for the Program.
Later license versions may give you additional or differentpermissions. However, no additional obligations are imposed on anyauthor or copyright holder as a result of your choosing to follow alater version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BYAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHTHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTYOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAMIS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OFALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITINGWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYSTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANYGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THEUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OFDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRDPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OFSUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability providedabove cannot be given local legal effect according to their terms,reviewing courts shall apply local law that most closely approximatesan absolute waiver of all civil liability in connection with theProgram, unless a warranty or assumption of liability accompanies acopy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatestpossible use to the public, the best way to achieve this is to make itfree software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safestto attach them to the start of each source file to most effectivelystate the exclusion of warranty; and each file should have at leastthe "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a shortnotice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriateparts of the General Public License. Of course, your program's commandsmight be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,if any, to sign a "copyright disclaimer" for the program, if necessary.For more information on this, and how to apply and follow the GNU GPL, see<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your programinto proprietary programs. If your program is a subroutine library, youmay consider it more useful to permit linking proprietary applications withthe library. If this is what you want to do, use the GNU Lesser GeneralPublic License instead of this License. But first, please read<https://www.gnu.org/licenses/why-not-lgpl.html>.1234567891011121314151617{ "schema_version": 1, "instance_id": "android/acclorite-book-story", "platform": "android", "repo": "https://github.com/Acclorite/book-story", "commit": "b0ab7d320aed903b56be6eff47b0049b8a7e48bf", "patches": [ { "path": "reference/patches/local-source.patch", "reason": "suppress_nondeterminism", "note": "Skip the first-launch onboarding screen used by the frozen reference app.", "sha256": "ed7f7cc4a6dc59f617fc616a49729025409e744bce5c1a98abaa7822560fd93f" } ], "package": "ua.acclorite.book_story.debug", "license": null}123456789#!/usr/bin/env bash# TEMPLATE (rb_unify) — review before use.set -euo pipefail: "${RB_PACKAGE:?must be exported by the runner from instance.json}"D="$(cd "$(dirname "$0")" && pwd)"; SER="${DEVICE_SERIAL:-emulator-5554}"APK="$(find "$D" -name '*.apk' | head -1)"[ -n "$APK" ] || { echo "ERROR: no apk found; extract reference.tar.gz first" >&2; exit 1; }adb -s "$SER" install -r -g "$APK"adb -s "$SER" shell monkey -p "$RB_PACKAGE" -c android.intent.category.LAUNCHER 11234567891011121314diff --git a/app/src/main/java/ua/acclorite/book_story/data/settings/SettingsManager.kt b/app/src/main/java/ua/acclorite/book_story/data/settings/SettingsManager.ktindex 8d4bf1866ca3bb43f4b1041ec8054fabf45ff3ed..5e5f84465a89617c5e5e54b52633f946b44a5a02 100644--- a/app/src/main/java/ua/acclorite/book_story/data/settings/SettingsManager.kt+++ b/app/src/main/java/ua/acclorite/book_story/data/settings/SettingsManager.kt@@ -105,7 +105,8 @@ class SettingsManager @Inject constructor( serialize = { it.name }, deserialize = { ThemeContrast.valueOf(it) } ) val showStartScreen = setting<Boolean, Boolean>(- key = booleanPreferencesKey("guide"), default = true+ // Bloatware removed: skip first-launch onboarding/start screen by default+ key = booleanPreferencesKey("guide"), default = false ) val doublePressExit = setting<Boolean, Boolean>( key = booleanPreferencesKey("double_press_exit"), default = false123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197{ "module": "computation", "total": 18, "passed": 18, "failed": 0, "pass_rate": 1.0, "rule": { "total": 15, "passed": 15, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 3, "passed": 3, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.2, "audit": { "kit_api_version": 1, "existence": 3, "liveness": 0, "interactive": 15, "depth_ge1": 7, "depth_ge2": 6, "value": 15, "vlm_fine": 3 }, "results": [ { "test": "computation_search_alpha", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "search 'alpha' -> alpha_wonderland only" }, { "test": "computation_search_testbook", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "search 'testbook' -> testbook only" }, { "test": "computation_search_book", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "search 'book' -> testbook only (alpha_wonderland excluded)" }, { "test": "computation_search_wonderland", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "search 'wonderland' -> alpha_wonderland only" }, { "test": "computation_search_no_match", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "search 'zzz' -> no books" }, { "test": "computation_search_clear_restores", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "after 'alpha' then Exit search -> both books restored" }, { "test": "computation_library_count_badge", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "Library count badge == 2 (== 2 cards)" }, { "test": "computation_search_count_badge", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "after 'alpha' the count badge reads '1' (one visible book)" }, { "test": "computation_book_info_progress", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "Book Info progress reads '0%'" }, { "test": "computation_reader_progress", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "reader progress reads '0% (20%)' (leading '0%')" }, { "test": "computation_font_size_label", "passed": true, "message": "", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "reader 'Font size' value label reads '16pt'" }, { "test": "computation_letter_spacing_label", "passed": true, "message": "", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "reader 'Letter spacing' value label reads '0pt'" }, { "test": "computation_size_percent_label", "passed": true, "message": "", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "reader 'Size' value label reads '80%'" }, { "test": "computation_bg_color_red", "passed": true, "message": "", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "Background color Red channel reads '250'" }, { "test": "computation_font_color_red", "passed": true, "message": "", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "Font color Red channel reads '68'" }, { "test": "computation_bg_swatch_vlm", "passed": true, "message": "VLM: Q='In the 'Background color' section of this colour settings screen, is the colour preview swatch rendered white or a very pale/near-white shade (not a dark or saturated colour)?' A=YES expect=YES", "depth": 3, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the 'Background color' section of this colour settings screen, is the colour preview swatch rendered white or a very pale/near-white shade (not a dark or saturated colour)?", "tag": "color" }, { "test": "computation_font_swatch_vlm", "passed": true, "message": "VLM: Q='In the 'Font color' section of this colour settings screen, is the colour preview swatch rendered a dark, near-black colour (not white or a pale shade)?' A=YES expect=YES", "depth": 3, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the 'Font color' section of this colour settings screen, is the colour preview swatch rendered a dark, near-black colour (not white or a pale shade)?", "tag": "color" }, { "test": "computation_swatches_differ_vlm", "passed": true, "message": "VLM: Q='This colour settings screen shows a light/pale 'Background color' preview swatch and a dark 'Font color' preview swatch. Are those two preview swatches clearly different colours from each other (one light, one dark)?' A=YES expect=YES", "depth": 3, "jump_kind": "none", "tier": 0, "expect": "VLM YES: This colour settings screen shows a light/pale 'Background color' preview swatch and a dark 'Font color' preview swatch. Are those two preview swatches clearly different colours from each other (one light, one dark)?", "tag": "color" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191{ "module": "interaction", "total": 17, "passed": 17, "failed": 0, "pass_rate": 1.0, "rule": { "total": 11, "passed": 11, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 6, "passed": 6, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.5455, "audit": { "kit_api_version": 1, "existence": 6, "liveness": 0, "interactive": 11, "depth_ge1": 4, "depth_ge2": 1, "value": 2, "vlm_fine": 1 }, "results": [ { "test": "interaction_book_survives_process_death", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "'testbook' present before (True) and after force_stop_and_relaunch (True)" }, { "test": "interaction_book_survives_process_death_vlm", "passed": true, "message": "VLM: Q='After relaunching the app, does the Library screen still show at least one book card (a cover tile with a title label beneath it)?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: After relaunching the app, does the Library screen still show at least one book card (a cover tile with a title label beneath it)?", "tag": "layout" }, { "test": "interaction_second_book_survives_process_death", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "'alpha_wonderland' present before (True) and after force_stop_and_relaunch (True)" }, { "test": "interaction_history_survives_process_death", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "History row 'testbook' present after force_stop_and_relaunch" }, { "test": "interaction_longpress_enters_selection", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "'1 selected' absent before long-press, present after" }, { "test": "interaction_longpress_selection_actions", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "content-desc 'Select all books' + 'Move selected books' + 'Delete selected books' all present" }, { "test": "interaction_longpress_selection_vlm", "passed": true, "message": "VLM: Q='One of the book covers is now selected. Does exactly one book cover show a selection indicator on it (a check mark or a highlighted/outlined overlay) that the other cover does not have?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: One of the book covers is now selected. Does exactly one book cover show a selection indicator on it (a check mark or a highlighted/outlined overlay) that the other cover does not have?", "tag": "shape" }, { "test": "interaction_clear_selection_exits", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "'1 selected' present in selection mode, absent after Clear selected items" }, { "test": "interaction_reading_creates_history", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "'Today' group + History row 'testbook' present after reading" }, { "test": "interaction_history_entry_vlm", "passed": true, "message": "VLM: Q='This is a reading-history screen. Is there a list row that shows a small book cover thumbnail on the left with a book title and a time (HH:MM) beside it?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: This is a reading-history screen. Is there a list row that shows a small book cover thumbnail on the left with a book title and a time (HH:MM) beside it?", "tag": "layout" }, { "test": "interaction_multi_record_integrity", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "'testbook' present and ordered before 'alpha_wonderland' in the same Library" }, { "test": "interaction_multi_record_survives_death", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "both 'testbook' and 'alpha_wonderland' present before (True) and after death (True)" }, { "test": "interaction_library_two_cards_vlm", "passed": true, "message": "VLM: Q='How many distinct book cards (each a cover tile with its own title label) are shown in this library grid? Answer YES only if there are exactly two.' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: How many distinct book cards (each a cover tile with its own title label) are shown in this library grid? Answer YES only if there are exactly two.", "tag": "layout" }, { "test": "interaction_open_reader_shows_text", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "reader shows 'Chapter One' heading and 'The quick brown fox' opening sentence" }, { "test": "interaction_reader_page_vlm", "passed": true, "message": "VLM: Q='Is this screen showing a page of readable book text (multiple lines/paragraphs of body text with margins), rather than an empty screen, a list, or a dialog?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is this screen showing a page of readable book text (multiple lines/paragraphs of body text with margins), rather than an empty screen, a list, or a dialog?", "tag": "layout" }, { "test": "interaction_move_sheet_opens", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "Cancel+OK move sheet present after Move, gone after Cancel" }, { "test": "interaction_book_info_actions_vlm", "passed": true, "message": "VLM: Q='This is a book-detail screen. Does it show the book's title near the top and two labelled action buttons reading 'Move' and 'Delete'?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: This is a book-detail screen. Does it show the book's title near the top and two labelled action buttons reading 'Move' and 'Delete'?", "tag": "layout" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308{ "module": "navigation", "total": 30, "passed": 30, "failed": 0, "pass_rate": 1.0, "rule": { "total": 24, "passed": 24, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 6, "passed": 6, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.25, "audit": { "kit_api_version": 1, "existence": 6, "liveness": 0, "interactive": 24, "depth_ge1": 24, "depth_ge2": 17, "value": 0, "vlm_fine": 4 }, "results": [ { "test": "nav_reach_history", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "History surface (Delete whole history) shown; Library 'Continue reading' no longer showing" }, { "test": "nav_reach_history_vlm", "passed": true, "message": "VLM: Q='Is this a reading-history screen showing either a list of book entries grouped by date, or a centered empty-state illustration with a message — and NOT a grid of book covers?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is this a reading-history screen showing either a list of book entries grouped by date, or a centered empty-state illustration with a message — and NOT a grid of book covers?", "tag": "layout" }, { "test": "nav_reach_browse", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "Browse surface (scanned-folder path row) shown; History 'Delete whole history' no longer showing" }, { "test": "nav_reach_library_from_browse", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "Library surface ('Continue reading') restored; Browse folder path no longer showing" }, { "test": "nav_backstack_tab_history", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Library ('Continue reading') restored after one BACK from History" }, { "test": "nav_reach_more_sheet", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "More bottom sheet (rows 'Settings'/'About app') shown; toolbar 'Filter' no longer showing" }, { "test": "nav_reach_more_sheet_vlm", "passed": true, "message": "VLM: Q='Is there a small menu panel anchored to the BOTTOM edge of the screen (a bottom sheet with a drag handle), rather than a full-screen page?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is there a small menu panel anchored to the BOTTOM edge of the screen (a bottom sheet with a drag handle), rather than a full-screen page?", "tag": "position" }, { "test": "nav_reach_settings", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "Settings root ('Reset start guide') shown; More sheet 'About app' no longer showing" }, { "test": "nav_reach_settings_vlm", "passed": true, "message": "VLM: Q='In the top-left corner of this settings screen, is there a left-pointing back arrow, above a vertical list of category rows?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the top-left corner of this settings screen, is there a left-pointing back arrow, above a vertical list of category rows?", "tag": "position" }, { "test": "nav_reach_appearance", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Appearance ('Dark theme') shown; Settings 'Reset start guide' no longer showing" }, { "test": "nav_reach_reader_settings_screen", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Reader settings ('Font thickness') shown; Settings 'Reset start guide' no longer showing" }, { "test": "nav_reach_general", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "General ('Double back press to exit') shown; Settings 'Reset start guide' no longer showing" }, { "test": "nav_reach_library_settings", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Library settings ('Create category') shown; Settings 'Reset start guide' no longer showing" }, { "test": "nav_reach_browse_settings", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Browse settings ('Add folder') shown; Settings 'Reset start guide' no longer showing" }, { "test": "nav_backstack_settings_to_library", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "First BACK restores Settings ('Reset start guide'), second BACK restores Library ('Continue reading')" }, { "test": "nav_reach_book_info", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Book Info ('No description.') shown; Library 'Continue reading' no longer showing" }, { "test": "nav_reach_book_info_vlm", "passed": true, "message": "VLM: Q='Is a single large book-cover image positioned in the upper part of this screen, with a button to start/read the book lower down — i.e. one book detail page, not a grid of many covers?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is a single large book-cover image positioned in the upper part of this screen, with a button to start/read the book lower down — i.e. one book detail page, not a grid of many covers?", "tag": "position" }, { "test": "nav_reach_reader", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "Reader body ('Chapter One') shown; Book Info 'Start' button no longer showing" }, { "test": "nav_reach_reader_vlm", "passed": true, "message": "VLM: Q='Is this an ebook reading page filled mostly with paragraphs of body text (a page of prose), rather than a list, a grid, or a form?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is this an ebook reading page filled mostly with paragraphs of body text (a page of prose), rather than a list, a grid, or a form?", "tag": "layout" }, { "test": "nav_backstack_reader_to_info", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "Book Info ('Start') restored after one BACK from the Reader" }, { "test": "nav_backstack_info_to_library", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Library ('Continue reading') restored after one BACK from Book Info" }, { "test": "nav_reach_reader_settings_sheet", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Reader settings sheet ('Reading mode') shown; bar 'Reader settings' icon no longer showing" }, { "test": "nav_reach_chapters_drawer", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Chapters drawer ('Chapters' heading) shown; bar 'Reader settings' icon no longer showing" }, { "test": "nav_reach_about", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "About screen ('App version') shown; More sheet 'Settings' no longer showing" }, { "test": "nav_reach_about_vlm", "passed": true, "message": "VLM: Q='Is an app icon positioned near the TOP of this About screen, with a vertical list of tappable link rows below it (e.g. report a bug, credits, licenses)?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is an app icon positioned near the TOP of this About screen, with a vertical list of tappable link rows below it (e.g. report a bug, credits, licenses)?", "tag": "position" }, { "test": "nav_reach_credits", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Credits ('Tachiyomi (Mihon)') shown; About 'App version' no longer showing" }, { "test": "nav_reach_licenses", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Licenses ('AboutLibraries') shown; About 'App version' no longer showing" }, { "test": "nav_backstack_credits_to_about", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "About ('App version') restored after one BACK from Credits" }, { "test": "nav_reach_search", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Search surface ('Exit search') shown; toolbar 'Filter' no longer showing" }, { "test": "nav_backstack_exit_search", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Library toolbar ('Filter') restored after Exit search" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279{ "module": "states", "total": 26, "passed": 26, "failed": 0, "pass_rate": 1.0, "rule": { "total": 13, "passed": 13, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 13, "passed": 13, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 1.0, "audit": { "kit_api_version": 1, "existence": 13, "liveness": 0, "interactive": 13, "depth_ge1": 12, "depth_ge2": 12, "value": 0, "vlm_fine": 10 }, "results": [ { "test": "states_dark_theme_enable", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "Dark theme selected System->Enabled; 'Pure dark' section now showing" }, { "test": "states_dark_theme_enable_vlm", "passed": true, "message": "VLM: Q='Is the background of this settings screen a dark/near-black colour with light-coloured text (dark mode), rather than a white/light background?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is the background of this settings screen a dark/near-black colour with light-coloured text (dark mode), rather than a white/light background?", "tag": "color" }, { "test": "states_dark_theme_persists", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "after process death Dark theme is STILL Enabled; app still renders dark" }, { "test": "states_dark_theme_persists_vlm", "passed": true, "message": "VLM: Q='After the app was restarted, is this settings screen still rendered in dark mode — a dark/near-black background with light text (not a white/light background)?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: After the app was restarted, is this settings screen still rendered in dark mode — a dark/near-black background with light text (not a white/light background)?", "tag": "color" }, { "test": "states_dark_theme_highlight_vlm", "passed": true, "message": "VLM: Q='In the 'Dark theme' row (segments System, Disabled, Enabled), is the 'Enabled' segment visually highlighted with a coloured/filled background pill that the other two segments do NOT have?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the 'Dark theme' row (segments System, Disabled, Enabled), is the 'Enabled' segment visually highlighted with a coloured/filled background pill that the other two segments do NOT have?", "tag": "shape" }, { "test": "states_app_theme_select", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "App theme selected Mercury->Neptune (marker moves into the Neptune card)" }, { "test": "states_app_theme_select_vlm", "passed": true, "message": "VLM: Q='In this 'App theme' setting, is the currently selected theme card (the one with a check mark) labelled 'Neptune' and showing a blue/indigo colour swatch?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In this 'App theme' setting, is the currently selected theme card (the one with a check mark) labelled 'Neptune' and showing a blue/indigo colour swatch?", "tag": "color" }, { "test": "states_app_theme_ring_vlm", "passed": true, "message": "VLM: Q='In this 'App theme' card row (Mercury, Neptune, Earth), does exactly one card show a check-mark / selection badge marking it as the chosen theme?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In this 'App theme' card row (Mercury, Neptune, Earth), does exactly one card show a check-mark / selection badge marking it as the chosen theme?", "tag": "shape" }, { "test": "states_nav_labels_hide", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "nav-bar text labels present -> gone after toggling 'Show navigation labels' off" }, { "test": "states_nav_labels_hide_vlm", "passed": true, "message": "VLM: Q='Look at the bottom navigation bar of this app. Are the icons shown WITHOUT any text labels underneath them (no 'Library'/'History'/'Browse' words under the bottom-bar icons)?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Look at the bottom navigation bar of this app. Are the icons shown WITHOUT any text labels underneath them (no 'Library'/'History'/'Browse' words under the bottom-bar icons)?", "tag": "position" }, { "test": "states_nav_labels_persist", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "nav labels hidden survive process death (still gone after restart)" }, { "test": "states_display_mode_list_grid_vlm", "passed": true, "message": "VLM: Q='On this Library screen, are the book covers arranged side by side in a GRID (two or more covers in the same horizontal row), rather than stacked vertically in a single-column list?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: On this Library screen, are the book covers arranged side by side in a GRID (two or more covers in the same horizontal row), rather than stacked vertically in a single-column list?", "tag": "layout" }, { "test": "states_display_mode_list", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "Display mode Grid->List; Library covers restack from a row to a column" }, { "test": "states_display_mode_list_list_vlm", "passed": true, "message": "VLM: Q='On this Library screen, are the book covers now stacked vertically in a single-column LIST (each book on its own row, one above the other), rather than side by side in a grid?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: On this Library screen, are the book covers now stacked vertically in a single-column LIST (each book on its own row, one above the other), rather than side by side in a grid?", "tag": "layout" }, { "test": "states_display_mode_persists", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "after process death Display mode is STILL List; Library still a column" }, { "test": "states_display_mode_persists_vlm", "passed": true, "message": "VLM: Q='After the app was restarted, on this Library screen are the book covers still stacked vertically in a single-column LIST (one book per row) rather than in a side-by-side grid?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: After the app was restarted, on this Library screen are the book covers still stacked vertically in a single-column LIST (one book per row) rather than in a side-by-side grid?", "tag": "layout" }, { "test": "states_display_highlight_vlm", "passed": true, "message": "VLM: Q='In the 'Display mode' row (segments 'Grid' and 'List'), is exactly one of the two segments visually highlighted with a coloured/filled background pill (the selected one) while the other is plain?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the 'Display mode' row (segments 'Grid' and 'List'), is exactly one of the two segments visually highlighted with a coloured/filled background pill (the selected one) while the other is plain?", "tag": "color" }, { "test": "states_title_position_toggle", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "Title position checked: Below true->false, Hidden false->true" }, { "test": "states_font_style_italic", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "Font style selected Normal->Italic (marker moves to Italic)" }, { "test": "states_font_style_italic_highlight_vlm", "passed": true, "message": "VLM: Q='In the 'Font style' row (segments 'Normal' and 'Italic'), is the 'Italic' segment the one visually highlighted with a coloured/filled background pill (marking it selected) rather than 'Normal'?' A=YES expect=YES", "depth": 3, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the 'Font style' row (segments 'Normal' and 'Italic'), is the 'Italic' segment the one visually highlighted with a coloured/filled background pill (marking it selected) rather than 'Normal'?", "tag": "shape" }, { "test": "states_progress_count_change", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "Progress count selected Percentage->Quantity (marker moves)" }, { "test": "states_progress_count_change_highlight_vlm", "passed": true, "message": "VLM: Q='In the 'Progress count' row (segments 'Percentage' and 'Quantity'), is the 'Quantity' segment the one visually highlighted with a coloured/filled background pill (marking it selected)?' A=YES expect=YES", "depth": 3, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the 'Progress count' row (segments 'Percentage' and 'Quantity'), is the 'Quantity' segment the one visually highlighted with a coloured/filled background pill (marking it selected)?", "tag": "color" }, { "test": "states_text_alignment_change", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "Text alignment selection moves to Center (marker on a different segment)" }, { "test": "states_text_align_highlight_vlm", "passed": true, "message": "VLM: Q='In the 'Text alignment' row (segments Start, Justify, Center, End), is the 'Center' segment the one visually highlighted with a coloured/filled background pill (marking it selected)?' A=YES expect=YES", "depth": 3, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the 'Text alignment' row (segments Start, Justify, Center, End), is the 'Center' segment the one visually highlighted with a coloured/filled background pill (marking it selected)?", "tag": "shape" }, { "test": "states_chapter_title_align", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "Chapter title alignment selection moves to Center" }, { "test": "states_search_focus", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "after tapping Search, the search EditText reports focused=true" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265{ "module": "structure", "total": 25, "passed": 25, "failed": 0, "pass_rate": 1.0, "rule": { "total": 17, "passed": 17, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 8, "passed": 8, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.4706, "audit": { "kit_api_version": 1, "existence": 11, "liveness": 0, "interactive": 14, "depth_ge1": 6, "depth_ge2": 4, "value": 0, "vlm_fine": 8 }, "results": [ { "test": "structure_gate_launch", "passed": true, "message": "", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "" }, { "test": "structure_gate_topbar", "passed": true, "message": "", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "" }, { "test": "structure_gate_topbar_vlm", "passed": true, "message": "VLM: Q='Are there exactly three icon buttons grouped together in the top-right corner of the screen (in the app's top bar)?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Are there exactly three icon buttons grouped together in the top-right corner of the screen (in the app's top bar)?", "tag": "position" }, { "test": "structure_gate_bottomnav", "passed": true, "message": "", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "" }, { "test": "structure_gate_bottomnav_vlm", "passed": true, "message": "VLM: Q='Is there a bottom navigation bar with exactly 3 evenly spaced items (each an icon with a label) across the bottom of the screen?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is there a bottom navigation bar with exactly 3 evenly spaced items (each an icon with a label) across the bottom of the screen?", "tag": "position" }, { "test": "structure_search_shape", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "EditText 0->1 on Search, restored on Exit search" }, { "test": "structure_filter_sheet", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "Sort-sheet appears (Sort/Display/Alphabetically), restored on back" }, { "test": "structure_filter_sheet_vlm", "passed": true, "message": "VLM: Q='Is there a bottom sheet panel anchored to the bottom edge of the screen, overlaying the content above it?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is there a bottom sheet panel anchored to the bottom edge of the screen, overlaying the content above it?", "tag": "position" }, { "test": "structure_more_sheet", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "More-sheet appears (About app + Settings), restored on back" }, { "test": "structure_filter_tab_swap", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "Sort tab -> Display tab swaps sort options for display options" }, { "test": "structure_selection_mode", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "long-press -> '1 selected' + selection actions, restored on back" }, { "test": "structure_selection_mode_vlm", "passed": true, "message": "VLM: Q='Does the top bar show a selection count (like '1 selected') with several action icons to its right?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Does the top bar show a selection count (like '1 selected') with several action icons to its right?", "tag": "position" }, { "test": "structure_tab_history", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "Library grid -> History surface (Today group), Library covers gone" }, { "test": "structure_tab_browse", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "Library grid -> Browse surface, covers gone" }, { "test": "structure_search_empty", "passed": true, "message": "", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "search 'zzz' -> 0 covers, restored on exit search" }, { "test": "structure_bookinfo_shape", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "cover tap -> Book Info (Start/Move/Delete/Author), depth 1" }, { "test": "structure_bookinfo_shape_vlm", "passed": true, "message": "VLM: Q='Is there a large primary action button spanning most of the screen width near the bottom of this book-detail screen?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is there a large primary action button spanning most of the screen width near the bottom of this book-detail screen?", "tag": "size" }, { "test": "structure_settings_root", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "More->Settings -> 5 category rows, depth 1" }, { "test": "structure_appearance_dark_vlm", "passed": true, "message": "VLM: Q='Is the overall background of this screen dark (near-black or very dark grey) rather than white?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is the overall background of this screen dark (near-black or very dark grey) rather than white?", "tag": "color" }, { "test": "structure_appearance_puredark", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "Enabled adds 'Pure dark' block, removed again on System (depth 2)" }, { "test": "structure_reader_open", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "reader renders 'Chapter One' heading + body paragraph, depth 2" }, { "test": "structure_reader_open_vlm", "passed": true, "message": "VLM: Q='Does a block of body text (multiple lines of a paragraph) fill most of the screen area?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Does a block of body text (multiple lines of a paragraph) fill most of the screen area?", "tag": "size" }, { "test": "structure_reader_settings_sheet", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "reader -> Reader settings sheet (General/Reader/Colors), depth 3" }, { "test": "structure_chapters_drawer", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "reader -> Chapters drawer (chapter list), depth 3" }, { "test": "structure_library_grid_vlm", "passed": true, "message": "VLM: Q='Are there two book cover cards displayed side by side in the same row (a grid layout), rather than stacked vertically?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Are there two book cover cards displayed side by side in the same row (a grid layout), rather than stacked vertically?", "tag": "shape" } ]}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910#!/usr/bin/env python3"""Android TestGen Kit — the single source of every test helper, so a test'sNAVIGATION DEPTH and JUMP RIGOR are DECLARED (not inferred), uniformly recorded,and self-auditable.
LOCATION AT RUNTIME: alongside the generated test files (testgen: $TESTGEN_DIR/eval/,eval: the restored eval dir). READ-ONLY — never edit, copy, or reimplement it.`import` it from every test file:
import os, sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from android_testgen_kit import * # noqa: F403
WHY THIS EXISTS Helpers used to be re-emitted verbatim into every generated test file (~370 lines x 6 files). That blew the output-token ceiling, forced a "write the script in pieces" protocol, let each copy drift, and duplicated one API key into every file. Everything mechanical now lives here; prompts carry only judgement.
Two orthogonal properties decide whether a suite really exercises an app: * navigation DEPTH — how many SURFACES you cross before the assertion (0 = first screen, 1 = one page/dialog/sheet, 2+ = deeper) * jump RIGOR — what the assertion after the trigger actually checks Prose alone let these drift, so every behavioral test DECLARES both:
@and_test(expects=("interaction_create_note", "interaction_create_note_vlm")) def test_create_note(): ... record("interaction_create_note", ok, "behavior_wrong: ...", depth=1, jump_kind="value", expect="list shows 'Milk'")
jump_kind (verbatim strings — audit/stats key off them): "none" no trigger; existence/gate only -> tier 0 "liveness" only "did not crash / still foreground" -> tier 1 (weak; never ship) "reach" a real surface jump: the TARGET surface's element APPEARED *and* the SOURCE surface's DISAPPEARED -> tier 2 "transition" a state flip (checked/enabled/selected/mode) with before->after -> tier 2 "value" a specific expected value/content was asserted -> tier 3
WHAT A "SURFACE" IS ON ANDROID NOT the Activity — single-Activity Compose/Fragment apps never change it, so get_current_activity() cannot discriminate. A surface is the SET of visible discriminating element keys: and_showing() -> {"Button|Save", "TextView|Total"}. and_reach(before, after, target, source) therefore proves a real jump; reading a flat tree for an always-present element cannot fake it.
DETERMINISTIC DENOMINATOR Scoring is eval_pass_case / origin_total_case, so a test function MUST contribute the same number of records on every code path. @and_test(expects=(...)) owns the try/except and back-fills any declared-but-unrecorded name as a failure, and record() refuses duplicates. N is a literal in the decorator.
PORTABILITY (the same file scores the ORIGINAL and the RECREATION, whose packagename differs): always use the module-level PACKAGE (argv[1]). Never write a packagename, an .apk path, a /data/data path, or a pixel coordinate as a literal. python3 android_testgen_kit.py lint_sources <dir> # flags all of those
SELF-AUDIT (report-only — these are GOALS, never a gate that blocks delivery): python3 android_testgen_kit.py audit <results_dir> python3 android_testgen_kit.py lint <results_dir> python3 android_testgen_kit.py lint_sources <testgen_dir> python3 android_testgen_kit.py audit_depth <testgen_dir> [results_dir]"""from __future__ import annotations
import astimport base64import functoolsimport globimport hashlibimport jsonimport mathimport osimport reimport shleximport subprocessimport sysimport timeimport urllib.errorimport urllib.request
KIT_API_VERSION = 1
# ── Runtime context ────────────────────────────────────────────────────────────# argv[1] = package under test (ORIGINAL during testgen, RECREATION during eval).# argv[2] / $RESULTS_DIR = where the eval JSON + screenshots go.PACKAGE = sys.argv[1] if len(sys.argv) > 1 else os.environ.get("PACKAGE", "")RESULTS_DIR = ( sys.argv[2] if len(sys.argv) > 2 else os.environ.get("RESULTS_DIR", "/workspace/testgen/eval"))ADB = os.environ.get("ADB_PATH", "adb")DEVICE = os.environ.get("DEVICE_SERIAL", "emulator-5554")
# Known emulator packages (from adb-tips). Used by type_text, never by tests.CLIPPER_PKG = "ca.zgrs.clipper"ADB_KEYBOARD_IME = "com.android.adbkeyboard/.AdbIME"
# ── Settling table (adb-tips §5). ANDROID_REMOTE=1 doubles it for tunnelled adb. ─_REMOTE = os.environ.get("ANDROID_REMOTE", "") in ("1", "true", "yes")_SETTLE_MULT = 2.0 if _REMOTE else 1.0SETTLE = { "launch": 3.0, "tap": 1.0, "key": 0.5, "keyboard": 0.5, "dump": 1.0, "ime": 0.5, "text": 0.5, "swipe": 1.0, "dump_retry": 2.0,}
JUMP_KINDS = {"none": 0, "liveness": 1, "reach": 2, "transition": 2, "value": 3}
# Double-axis quota TARGETS (fractions). rb_audit REPORTS these; they are NOT a# gate. Tune here only — never restate them in a prompt.QUOTAS = { "existence_max": 0.30, # jump_kind=="none" share of ALL tests "interactive_min": 0.60, # reach|transition|value share of ALL tests "depth_ge1_min": 0.40, # depth>=1 share of INTERACTIVE tests "depth_ge2_min": 0.15, # depth>=2 share of INTERACTIVE tests "value_min": 0.25, # jump_kind=="value" share of INTERACTIVE tests # Suite-wide VLM budget, measured as vlm records / ALL records. The right # share is app-dependent (a chart/canvas app earns more than a list app) and # individual modules may legitimately contribute zero, so this is a BAND on # the whole suite, never a per-module requirement. "vlm_share_min": 0.30, "vlm_share_max": 0.50, "vlm_fine_min": 0.66, # fine-grained share of VLM records}
# Depth family (naming convention — see and_audit_depth). A test "crosses a# surface" iff it calls a member of this family; and_back* pops one. Semantic# aliases (and_enter_settings, and_reach_detail) match BY PREFIX, so the kit stays# small and the authored tests stay diverse.DEPTH_FWD_RE = re.compile(r"^and_(enter|reach)[a-z0-9_]*$")DEPTH_BACK_RE = re.compile(r"^and_back[a-z0-9_]*$")DEPTH_RESET_RE = re.compile(r"^and_reset_depth$")
# VLM tags. The fine-grained ones test an exact rendered property; and_audit# computes the >=2/3 fine share from these instead of trusting self-report.VLM_FINE_TAGS = {"color", "shape", "position", "size"}VLM_TAGS = VLM_FINE_TAGS | {"layout", "content"}
# Failure-message taxonomy. and_lint flags a failed record that uses none of them.FAIL_PREFIXES = ("setup_failed:", "feature_missing:", "behavior_wrong:", "exception:")
# Never tap these (tests mutate real device state).DANGEROUS_TEXTS = [ "delete", "remove", "clear", "reset", "erase", "discard", "uninstall", "sign out", "log out", "logout", "format", "wipe", "revoke", "deactivate", "删除", "移除", "清空", "清除", "重置", "退出登录", "注销", "格式化",]
_MODULE_ALIAS = { "states": "states", "state": "states", "structure": "structure", "structures": "structure", "navigation": "navigation", "nav": "navigation", "interaction": "interaction", "interactions": "interaction", "computation": "computation", "computations": "computation", "text": "text", "texts": "text",}
_DEPTH = 0 # surface counter for and_enter/and_back_results: list[dict] = []_seen: set[str] = set()_module: str = ""_screen_info: dict | None = None
def require_kit(min_version: int) -> None: """Fail loudly at import time if the kit is older than the test expects.""" if KIT_API_VERSION < min_version: raise RuntimeError( f"android_testgen_kit v{KIT_API_VERSION} is older than the required " f"v{min_version}; the restored testcase bundle and the kit disagree" )
def _infer_module() -> str: stem = os.path.splitext(os.path.basename(sys.argv[0] or ""))[0] if stem.startswith("test_android_"): return _MODULE_ALIAS.get(stem[len("test_android_"):], stem[len("test_android_"):]) return ""
def init(module: str = "", package: str = "", results_dir: str = "") -> None: """Optional. Overrides the values inferred from argv/env.""" global _module, PACKAGE, RESULTS_DIR if module: _module = _MODULE_ALIAS.get(module, module) if package: PACKAGE = package if results_dir: RESULTS_DIR = results_dir
_module = _infer_module()
def tier_of(jump_kind: str) -> int: return JUMP_KINDS.get(jump_kind, 2)
def settle(kind: str = "tap") -> None: """Sleep the calibrated settling time for `kind` (see SETTLE).""" time.sleep(SETTLE.get(kind, 1.0) * _SETTLE_MULT)
# ══════════════════════════════════════════════════════════════════════════════# (1) Results / recording# ══════════════════════════════════════════════════════════════════════════════
def record(test_name, passed, message="", *, depth=None, jump_kind="none", expect="", tag=None, backfilled=False) -> bool: """Record ONE test result. Returns bool(passed).
The three positional parameters are unchanged from the legacy inline helper. Everything new is keyword-only with a default, so old call sites still work.
depth surfaces this test crossed before asserting (see and_enter/and_reach) jump_kind none | liveness | reach | transition | value expect MANDATORY for reach/transition/value — the exact target you OBSERVED on the original app (and_lint flags an empty one) tag for VLM records: color|shape|position|size|layout|content message on failure, start it with setup_failed: / feature_missing: / behavior_wrong: / exception: """ if test_name in _seen: print(f" [DUP ] {_module}:{test_name} refused (already recorded) — " f"a duplicate would drift the denominator") return bool(passed) if jump_kind not in JUMP_KINDS: jump_kind = "none" d = _DEPTH if depth is None else int(depth) p = bool(passed) rec = { "test": test_name, "passed": p, "message": str(message), "depth": max(0, d), "jump_kind": jump_kind, "tier": tier_of(jump_kind), "expect": str(expect), } if tag: rec["tag"] = str(tag) if backfilled: rec["backfilled"] = True _results.append(rec) _seen.add(test_name) print(f" [{'PASS' if p else 'FAIL'}] {_module}:{test_name} " f"(depth={rec['depth']}, {jump_kind})" + (f" {message}" if message and not p else "")) _flush() return p
def _payload(module_name: str) -> dict: """The eval JSON. Shape is byte-compatible with the legacy helper: the aggregator reads module/total/passed/pass_rate, and the results extraction reads the rule/vlm sub-objects. New keys ride inside results[] + `audit`.""" rule = [r for r in _results if not r["test"].endswith("_vlm")] vlm = [r for r in _results if r["test"].endswith("_vlm")] rt, rp = len(rule), sum(1 for r in rule if r["passed"]) vt, vp = len(vlm), sum(1 for r in vlm if r["passed"]) total, passed = len(_results), sum(1 for r in _results if r["passed"]) fine = sum(1 for r in vlm if r.get("tag") in VLM_FINE_TAGS) inter = [r for r in _results if r["jump_kind"] in ("reach", "transition", "value")] return { "module": module_name, "total": total, "passed": passed, "failed": total - passed, "pass_rate": round(passed / total, 4) if total else 0, "rule": {"total": rt, "passed": rp, "failed": rt - rp, "pass_rate": round(rp / rt, 4) if rt else 0}, "vlm": {"total": vt, "passed": vp, "failed": vt - vp, "pass_rate": round(vp / vt, 4) if vt else 0}, "vlm_ratio": round(vt / rt, 4) if rt else 0, "audit": { "kit_api_version": KIT_API_VERSION, "existence": sum(1 for r in _results if r["jump_kind"] == "none"), "liveness": sum(1 for r in _results if r["jump_kind"] == "liveness"), "interactive": len(inter), "depth_ge1": sum(1 for r in inter if r["depth"] >= 1), "depth_ge2": sum(1 for r in inter if r["depth"] >= 2), "value": sum(1 for r in inter if r["jump_kind"] == "value"), "vlm_fine": fine, }, "results": _results, }
def _write_json(path: str, data: dict) -> None: """Atomic write, so a mid-run SIGKILL never leaves a truncated JSON.""" os.makedirs(os.path.dirname(path) or ".", exist_ok=True) tmp = path + ".tmp" with open(tmp, "w") as f: json.dump(data, f, indent=2, ensure_ascii=False) os.replace(tmp, path)
def _flush() -> None: """Persist after EVERY record, so a timeout/emulator hang leaves N results instead of zero. save_results() stays the documented finalizer.""" if not _module: return try: _write_json(os.path.join(RESULTS_DIR, f"android_{_module}_eval.json"), _payload(_module)) except Exception: pass
def save_results(module_name: str) -> dict: """MANDATORY finalizer. Authoritatively rewrites the eval JSON under the confirmed module name, prints the summary, and runs the in-process audit. Idempotent.""" global _module _module = _MODULE_ALIAS.get(module_name, module_name) out = _payload(_module) path = os.path.join(RESULTS_DIR, f"android_{_module}_eval.json") _write_json(path, out) print(f"Results: {out['passed']}/{out['total']} passed " f"(rule: {out['rule']['passed']}/{out['rule']['total']}, " f"vlm: {out['vlm']['passed']}/{out['vlm']['total']}) -> {path}") try: and_audit(RESULTS_DIR) and_lint(RESULTS_DIR) except Exception as exc: print(f"[audit] skipped: {exc}") return out
def declared_names() -> list[str]: """Every record name produced so far. The eval run MUST produce this same set against the recreation — a missing feature FAILS, it never vanishes from the denominator.""" return [r["test"] for r in _results]
def and_test(*, expects, module: str = ""): """Wrap a test function so it contributes EXACTLY len(expects) records on every code path — the deterministic-denominator guarantee.
Any name in `expects` still unrecorded when the function returns or raises is back-filled as a failure. The literal also lets and_audit_depth attribute records to this function exactly.
@and_test(expects=("states_toggle_dark", "states_toggle_dark_vlm")) def test_toggle_dark(): ... """ names = tuple(expects)
def deco(fn): @functools.wraps(fn) def wrapper(*a, **kw): if module: init(module=module) err = "" try: return fn(*a, **kw) except Exception as exc: err = f"{type(exc).__name__}: {exc}" print(f" [EXC ] {fn.__name__}: {err}") return None finally: for n in names: if n not in _seen: record(n, False, f"exception: not_reached ({err})" if err else "setup_failed: not_reached (no exception raised)", backfilled=True) wrapper._and_expects = names return wrapper return deco
def run_suite(tests, module: str) -> dict: """Run every test, then finalize. Each test owns its own entry point, so one failure never cascades.""" init(module=module) n_fix = len(fixture_names()) print(f"=== {module}: {len(tests)} tests | package={PACKAGE}" + (f" | fixtures={n_fix}" if n_fix else "") + " ===") if n_fix and not push_fixtures(): print(" [fixtures] WARNING: not all fixtures reached the device — every " "test that opens one will record setup_failed") for t in tests: and_reset_depth() try: t() except Exception as exc: print(f" [EXC ] {getattr(t, '__name__', t)}: {exc}") return save_results(module)
# ══════════════════════════════════════════════════════════════════════════════# (2) Device & adb primitives# ══════════════════════════════════════════════════════════════════════════════
def adb_shell(*args, timeout: int = 30) -> str: """`adb -s $DEVICE shell ...` -> stdout. The -s serial is ALWAYS injected, so a multi-device host can never dispatch to the wrong emulator.""" try: r = subprocess.run([ADB, "-s", DEVICE, "shell", *[str(a) for a in args]], capture_output=True, text=True, timeout=timeout) return r.stdout.strip() except subprocess.TimeoutExpired: return "" except Exception: return ""
def adb_raw(*args, timeout: int = 30) -> str: """`adb -s $DEVICE ...` (no `shell`) — for install/pull/exec-out.""" try: r = subprocess.run([ADB, "-s", DEVICE, *[str(a) for a in args]], capture_output=True, text=True, timeout=timeout) return r.stdout.strip() except Exception: return ""
def device_online() -> bool: try: out = subprocess.run([ADB, "devices"], capture_output=True, text=True, timeout=15).stdout except Exception: return False return any(ln.startswith(DEVICE) and ln.rstrip().endswith("device") for ln in out.splitlines()[1:])
def get_screen_info() -> dict: """Cached screen geometry. EVERY coordinate must be derived from this, never written as a literal — density and font scale differ across devices.""" global _screen_info if _screen_info: return _screen_info m = re.search(r"(\d+)x(\d+)", adb_shell("wm", "size")) w, h = (int(m.group(1)), int(m.group(2))) if m else (1080, 2400) md = re.search(r"(\d+)", adb_shell("wm", "density")) _screen_info = {"width": w, "height": h, "density": int(md.group(1)) if md else 440, "center_x": w // 2, "center_y": h // 2} return _screen_info
def screencap(path: str) -> bool: """Screenshot to a local path. exec-out first; falls back to on-device screencap + pull, which is what survives a tunnelled adb connection.""" os.makedirs(os.path.dirname(path) or ".", exist_ok=True) try: with open(path, "wb") as f: subprocess.run([ADB, "-s", DEVICE, "exec-out", "screencap", "-p"], stdout=f, timeout=20) if os.path.getsize(path) > 0: return True except Exception: pass remote = "/sdcard/_kit_shot.png" adb_shell("screencap", "-p", remote) adb_raw("pull", remote, path, timeout=40) adb_shell("rm", "-f", remote) return os.path.exists(path) and os.path.getsize(path) > 0
# ── Fixtures: sample files a file/image/document app needs to have anything to# open. These MUST be a pipeline artifact, not something you push by hand while# exploring: testgen and eval run in DIFFERENT jobs on DIFFERENT emulators, so a# hand-pushed file is gone by eval and every test that opens it records# setup_failed — blaming the recreation for a harness gap.## authoring (once, during recon): write the files into <EVAL_OUT>/fixtures/# consuming (every test run): run_suite() pushes them before the first test## The directory rides along with the test files into the testcases bank, so the# bytes are restored on every later eval. Sub-directories are preserved, so# fixtures/docs/a.pdf lands at /sdcard/Download/docs/a.pdf.FIXTURES_DEVICE_DIR = "/sdcard/Download"_fixtures_pushed = False
def fixtures_dir() -> str: """The host fixtures directory, or "" when this app needs none.
The script's own directory comes FIRST: at eval, RESULTS_DIR is a separate eval_results/ dir, while the fixtures were restored next to the test files. """ for cand in (os.environ.get("FIXTURES_DIR", ""), os.path.join(os.path.dirname(os.path.abspath(sys.argv[0] or ".")), "fixtures"), os.path.join(RESULTS_DIR, "fixtures")): if cand and os.path.isdir(cand): return cand return ""
def fixture_names() -> list[str]: """Fixture paths relative to fixtures_dir(), e.g. ["doc.pdf", "docs/b.epub"].""" src = fixtures_dir() if not src: return [] out = [] for root, _dirs, files in os.walk(src): for fn in sorted(files): if fn.startswith("."): continue out.append(os.path.relpath(os.path.join(root, fn), src)) return sorted(out)
def fixture_on_device(name: str, dest: str = FIXTURES_DEVICE_DIR) -> str: """Where `name` lives on the device after push_fixtures().""" return f"{dest.rstrip('/')}/{name}"
def push_fixtures(dest: str = FIXTURES_DEVICE_DIR, *, force: bool = False) -> bool: """Mirror the host fixtures onto the device. Idempotent and safe to call from every test — a file already there with the same size is not re-pushed, so the six module processes cost one real push between them.
Returns True when the device holds every fixture (including the vacuous case of an app that needs none). """ global _fixtures_pushed if _fixtures_pushed and not force: return True src = fixtures_dir() names = fixture_names() if not src or not names: _fixtures_pushed = True return True ok = True pushed = 0 for rel in names: local = os.path.join(src, rel) remote = fixture_on_device(rel, dest) try: want = os.path.getsize(local) except OSError: ok = False continue got = adb_shell("stat", "-c", "%s", remote) if not force and got.isdigit() and int(got) == want: continue parent = remote.rsplit("/", 1)[0] if parent: adb_shell("mkdir", "-p", parent) adb_raw("push", local, remote, timeout=120) check = adb_shell("stat", "-c", "%s", remote) if check.isdigit() and int(check) == want: pushed += 1 else: ok = False print(f" [fixtures] FAILED to push {rel} -> {remote}") if pushed: # Make the files visible to gallery/media-backed pickers. Both forms are # API-level dependent and neither is required for plain SAF browsing, so # failures here are not fatal. adb_shell("content", "call", "--uri", "content://media/external/file", "--method", "scan_volume", "--arg", "external_primary") adb_shell("am", "broadcast", "-a", "android.intent.action.MEDIA_SCANNER_SCAN_FILE", "-d", f"file://{dest}") print(f" [fixtures] pushed {pushed}/{len(names)} fixture(s) to {dest}") _fixtures_pushed = ok return ok
# ══════════════════════════════════════════════════════════════════════════════# (3) UI tree query & element matching# ══════════════════════════════════════════════════════════════════════════════
def dump_xml(retries: int = 3, settle_first: bool = True) -> str: """uiautomator dump -> XML text. Retries because the dump fails outright while an animation is in flight.""" if settle_first: settle("dump") remote = "/sdcard/_kit_ui.xml" for attempt in range(retries): adb_shell("uiautomator", "dump", remote) xml = adb_shell("cat", remote, timeout=60) if "<node" in xml: return xml settle("dump_retry") return ""
def parse_nodes(xml_str: str) -> list[dict]: """XML -> list of attribute dicts, each with _bounds and _center.""" nodes = [] for m in re.finditer(r"<node\s+([^>]+?)/?>", xml_str): attrs_str = m.group(1) attrs = {am.group(1): am.group(2) for am in re.finditer(r'([\w-]+)="([^"]*)"', attrs_str)} b = re.search(r'bounds="\[(\d+),(\d+)\]\[(\d+),(\d+)\]"', attrs_str) if b: x1, y1, x2, y2 = (int(v) for v in b.groups()) attrs["_bounds"] = (x1, y1, x2, y2) attrs["_center"] = ((x1 + x2) // 2, (y1 + y2) // 2) nodes.append(attrs) return nodes
def ui(retries: int = 3) -> list[dict]: """THE entry point for a fresh tree. Call it again after ANY state change — a scroll, navigation, dialog, or keyboard invalidates every prior coordinate.""" return parse_nodes(dump_xml(retries=retries))
def find_nodes(nodes, **criteria) -> list[dict]: """Nodes matching ALL criteria, EXACT string match. `True`/`False` match the "true"/"false" attribute strings. Underscores in keys become dashes (content_desc -> content-desc).""" out = [] for n in nodes: ok = True for k, v in criteria.items(): key = k.replace("_", "-") if "_" in k and k != "class" else k if key not in n: ok = False break if v is True and n[key] != "true": ok = False break if v is False and n[key] != "false": ok = False break if v is not True and v is not False and n[key] != v: ok = False break if ok: out.append(n) return out
def find_node(nodes, **criteria) -> dict | None: f = find_nodes(nodes, **criteria) return f[0] if f else None
def find_by_class(nodes, widget_class: str) -> list[dict]: """Partial class-name match, e.g. "Switch", "EditText", "RecyclerView".""" return [n for n in nodes if widget_class in n.get("class", "")]
def find_node_ci(nodes, text: str) -> dict | None: """Case-insensitive text or content-desc match. Use for user-visible labels whose casing a faithful recreation may legitimately differ on.""" t = text.strip().lower() for n in nodes: if (n.get("text", "").strip().lower() == t or n.get("content-desc", "").strip().lower() == t): return n return None
def node_by_id(nodes, rid_suffix: str) -> dict | None: """Match the LAST segment of resource-id, so the package prefix (which differs between original and recreation) is never compared.""" for n in nodes: rid = n.get("resource-id", "") if rid and rid.rsplit("/", 1)[-1] == rid_suffix: return n return None
def find_closest_match(nodes, original_node) -> dict | None: """Re-locate a node in a fresh dump by similarity (class/text/desc/position).""" best, best_score = None, 0 for n in nodes: score = 0 if n.get("class") == original_node.get("class"): score += 3 if n.get("text") and n.get("text") == original_node.get("text"): score += 5 if (n.get("content-desc") and n.get("content-desc") == original_node.get("content-desc")): score += 4 if "_center" in n and "_center" in original_node: if (abs(n["_center"][0] - original_node["_center"][0]) < 100 and abs(n["_center"][1] - original_node["_center"][1]) < 100): score += 2 if score > best_score: best, best_score = n, score return best if best_score >= 3 else None
def node_key(n: dict) -> str: """"{shortClass}|{identity}" — the surface-membership key. Identity priority: text -> content-desc -> resource-id suffix. Returns "" for anonymous nodes (pure layout containers), which are excluded from a surface.""" cls = n.get("class", "").rsplit(".", 1)[-1] ident = (n.get("text", "").strip() or n.get("content-desc", "").strip() or n.get("resource-id", "").rsplit("/", 1)[-1]) return f"{cls}|{ident}" if ident else ""
def and_showing(nodes=None) -> set[str]: """Snapshot the current SURFACE as a set of discriminating element keys. Only on-screen, non-degenerate, identity-bearing nodes count. Take one before and one after a trigger and feed them to and_reach().""" nodes = ui() if nodes is None else nodes s = get_screen_info() out = set() for n in nodes: b = n.get("_bounds") if not b: continue x1, y1, x2, y2 = b if (x2 - x1) < 5 or (y2 - y1) < 5: continue if x2 <= 0 or y2 <= 0 or x1 >= s["width"] or y1 >= s["height"]: continue k = node_key(n) if k: out.add(k) return out
def and_reach(before, after, target: str, source: str | None = None) -> bool: """TRUE-JUMP verdict: the TARGET surface's element newly APPEARED and (if given) the SOURCE surface's element DISAPPEARED. This is what separates a real surface jump from reading an element that was in the tree all along.""" before, after = set(before or []), set(after or []) t = target.strip().lower() appeared = any(t in k.lower() for k in (after - before)) if source is None: return appeared s = source.strip().lower() return (appeared and any(s in k.lower() for k in before) and not any(s in k.lower() for k in after))
def surface_changed(before, after, min_delta: int = 2) -> bool: """Weaker than and_reach: the surface changed materially but you are not naming the target. Use for shape deltas, never to claim a `reach`.""" return len(set(before or []) ^ set(after or [])) >= min_delta
def and_surface_id(nodes=None) -> str: """A stable-ish fingerprint of the current surface, for "did this change?".""" keys = sorted(and_showing(nodes)) return f"{len(keys)}:{hash(tuple(keys)) & 0xFFFFFF:06x}"
# ══════════════════════════════════════════════════════════════════════════════# (4) Interaction# ══════════════════════════════════════════════════════════════════════════════
def tap(x, y) -> None: adb_shell("input", "tap", int(x), int(y)) settle("tap")
def tap_node(node) -> bool: """Tap a node's centre, validating bounds against the real screen first.""" if not node or "_center" not in node: return False x, y = node["_center"] s = get_screen_info() if x < 0 or x > s["width"] or y < 0 or y > s["height"]: return False if "_bounds" in node: x1, y1, x2, y2 = node["_bounds"] if (x2 - x1) < 5 or (y2 - y1) < 5: return False tap(x, y) return True
def tap_text(nodes, text: str) -> bool: n = find_node(nodes, text=text) or find_node_ci(nodes, text) return tap_node(n) if n else False
def is_safe(node) -> bool: """False for destructive controls. Tests mutate real device state, so every exploratory tap must go through this.""" blob = " ".join([node.get("text", ""), node.get("content-desc", ""), node.get("resource-id", "")]).lower() return not any(d in blob for d in DANGEROUS_TEXTS)
def safe_tap(node) -> bool: return tap_node(node) if node and is_safe(node) else False
def long_press(node, ms: int = 800) -> bool: """Long-press = a zero-distance swipe with a duration.""" if not node or "_center" not in node: return False x, y = node["_center"] adb_shell("input", "swipe", x, y, x, y, int(ms)) settle("tap") return True
def swipe(x1, y1, x2, y2, ms: int = 300) -> None: adb_shell("input", "swipe", int(x1), int(y1), int(x2), int(y2), int(ms)) settle("swipe")
def scroll_down(frac: float = 0.5) -> None: s = get_screen_info() swipe(s["center_x"], int(s["height"] * 0.7), s["center_x"], int(s["height"] * (0.7 - frac)))
def scroll_up(frac: float = 0.5) -> None: s = get_screen_info() swipe(s["center_x"], int(s["height"] * 0.3), s["center_x"], int(s["height"] * (0.3 + frac)))
def open_drawer() -> None: s = get_screen_info() swipe(5, s["center_y"], int(s["width"] * 0.8), s["center_y"], ms=400)
def scroll_into_view(text: str, max_swipes: int = 4) -> dict | None: """Scroll until `text` is on screen, RE-DUMPING between swipes. This encodes "after a scroll every previous coordinate is invalid" as code.""" for _ in range(max_swipes + 1): nodes = ui() n = find_node(nodes, text=text) or find_node_ci(nodes, text) if n: return n scroll_down(0.4) return None
def press_key(keycode) -> None: adb_shell("input", "keyevent", keycode) settle("key")
def back() -> None: """Raw BACK. Use and_back() when you are leaving a surface you entered.""" press_key("KEYCODE_BACK")
def home() -> None: press_key("KEYCODE_HOME")
def enter() -> None: press_key("KEYCODE_ENTER")
def keyboard_visible() -> bool: return "mInputShown=true" in adb_shell("dumpsys", "input_method")
def hide_keyboard() -> bool: """Dismiss the soft keyboard without navigating away. Tries, in order: the collapse affordance, an empty region, then BACK — and BACK is only accepted if the surface did NOT change, because BACK can navigate instead.""" if not keyboard_visible(): return True nodes = ui() for n in nodes: blob = (n.get("content-desc", "") + n.get("resource-id", "")).lower() if any(w in blob for w in ("hide", "collapse", "close_keyboard", "back")): if tap_node(n): settle("keyboard") if not keyboard_visible(): return True s = get_screen_info() tap(s["center_x"], int(s["height"] * 0.12)) # top strip is rarely interactive settle("keyboard") if not keyboard_visible(): return True sid = and_surface_id() back() settle("keyboard") if keyboard_visible(): return False if and_surface_id() != sid: print(" [warn] hide_keyboard: BACK also changed the surface") return True
def _quote_for_device(text: str) -> str: """Quote a string for the on-device shell (adb joins argv with spaces).""" return shlex.quote(text)
def type_text(node, text: str, *, method: str = "auto", verify_focus: bool = True) -> bool: """Type into an EditText, safely.
An unfocused EditText silently swallows ALL input (including paste and the ADB-Keyboard broadcast), so this taps the field, re-dumps, and asserts focused="true" before typing — retrying the tap once.
Routing: pure ASCII -> `input text`. Non-ASCII -> Clipper broadcast + paste. method="ime" -> ADB Keyboard, which needs a re-tap after the IME switch (the switch drops focus) and ALWAYS restores the original IME in a finally. """ if not node: return False target = node if verify_focus: ok = False for _ in range(2): if not tap_node(target): return False settle("keyboard") fresh = find_closest_match(ui(), target) or target if fresh.get("focused") == "true": target, ok = fresh, True break target = fresh if not ok: print(" [warn] type_text: field never reported focused=true") else: tap_node(target) settle("keyboard")
is_ascii = all(ord(c) < 128 for c in text) use = method if use == "auto": use = "input" if is_ascii else "clipper"
if use == "input": adb_shell("input", "text", _quote_for_device(text.replace(" ", "%s"))) settle("text") return True
if use == "clipper": adb_shell("am", "broadcast", "-a", "clipper.set", "-e", "text", _quote_for_device(text)) settle("text") press_key(279) # KEYCODE_PASTE settle("text") return True
# method="ime": ADB Keyboard. Some custom views ignore paste, this is the fallback. original = adb_shell("settings", "get", "secure", "default_input_method") try: adb_shell("ime", "set", ADB_KEYBOARD_IME) settle("ime") tap_node(target) # IME switch dropped focus settle("keyboard") adb_shell("am", "broadcast", "-a", "ADB_INPUT_TEXT", "--es", "msg", _quote_for_device(text)) settle("text") return True finally: if original and "null" not in original.lower(): adb_shell("ime", "set", original) # NEVER leave it switched settle("ime")
# ══════════════════════════════════════════════════════════════════════════════# (5) Navigation & the depth family# ══════════════════════════════════════════════════════════════════════════════
def and_reset_depth() -> None: global _DEPTH _DEPTH = 0
def and_enter(surface: str = "") -> int: """Call right AFTER your test navigates into a new surface. This is what backs a declared depth>=1 — and_audit_depth looks for a call from the and_enter*/and_reach* family.""" global _DEPTH _DEPTH += 1 return _DEPTH
def and_back() -> int: """Press BACK and pop one surface.""" global _DEPTH back() _DEPTH = max(0, _DEPTH - 1) return _DEPTH
def and_enter_surface(nodes, target_text: str = "", content_desc: str = "", rid: str = "") -> tuple[bool, str]: """Tap a named trigger, then confirm the surface changed. Counts one surface on success. Returns (ok, note). Prefer and_reach_surface when you can name the destination — that yields jump_kind="reach".""" n = None if target_text: n = find_node(nodes, text=target_text) or find_node_ci(nodes, target_text) if n is None and content_desc: n = find_node(nodes, content_desc=content_desc) if n is None and rid: n = node_by_id(nodes, rid) if n is None: return False, f"setup_failed: trigger not found ({target_text or content_desc or rid})" before = and_showing(nodes) if not tap_node(n): return False, "setup_failed: trigger not tappable" after = and_showing() if not surface_changed(before, after): return False, "behavior_wrong: surface did not change after tapping the trigger" and_enter(target_text or content_desc or rid) return True, ""
def and_reach_surface(node, target: str, source: str | None = None) -> bool: """Tap `node`, then PROVE the jump: `target` appeared and `source` vanished. Counts one surface. This is the only honest way to claim jump_kind="reach".""" before = and_showing() if not tap_node(node): return False after = and_showing() ok = and_reach(before, after, target, source) if ok: and_enter(target) return ok
# ══════════════════════════════════════════════════════════════════════════════# (6) App lifecycle — always keyed on PACKAGE (argv[1]), never a literal# ══════════════════════════════════════════════════════════════════════════════
def launch_app() -> None: adb_shell("monkey", "-p", PACKAGE, "-c", "android.intent.category.LAUNCHER", "1") settle("launch")
def force_stop() -> None: adb_shell("am", "force-stop", PACKAGE) settle("key")
def clear_data() -> None: """Wipe app data. Use to guarantee a clean entry point, never mid-assertion.""" adb_shell("pm", "clear", PACKAGE) settle("key")
def restart_app() -> None: force_stop() launch_app()
def force_stop_and_relaunch() -> None: """The persistence probe: kill the process, relaunch, then assert the state survived. An in-memory-only recreation fails this.""" force_stop() settle("key") launch_app()
def get_current_activity() -> str: out = adb_shell("dumpsys", "activity", "activities") m = re.search(r"mResumedActivity.*?\{[^}]*?([\w.]+/[\w.$]+)", out) if m: return m.group(1) m = re.search(r"mCurrentFocus=.*?\{[^}]*?([\w.]+/[\w.$]+)", adb_shell("dumpsys", "window")) return m.group(1) if m else ""
def is_app_foreground() -> bool: return PACKAGE in get_current_activity() or PACKAGE in adb_shell("dumpsys", "window")
def wait_for_foreground(timeout: int = 10) -> bool: deadline = time.time() + timeout while time.time() < deadline: if is_app_foreground(): return True time.sleep(0.5) return False
# ══════════════════════════════════════════════════════════════════════════════# (7) VLM# ══════════════════════════════════════════════════════════════════════════════
# OpenAI-compatible endpoint. Hardcoded on purpose: the public DashScope native# endpoint rejected the key that pods are provisioned with, so every generated# suite either lost its whole VLM track or shipped a hand-rolled `dashscope.py`# shim to reroute it. This speaks plain chat/completions over the standard library# only — no `pip install`, and the stale shims in the testcases bank can no longer# shadow the transport because nothing imports `dashscope` any more.VLM_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1"_VLM_DEFAULT_KEY = "sk-bd0c3f375649439bba62b5b0e8c13057"# Attempts per key. 3 covers the blips seen in practice (empty body, gateway 5xx,# rate-limit bursts) without turning a genuine outage into a 10-minute stall.VLM_RETRIES = int(os.environ.get("VLM_RETRIES", "3"))# Repeating these cannot help: the request itself is wrong (malformed, missing,# too large, or semantically rejected). Everything else 4xx/5xx is worth a retry._VLM_TERMINAL_CODES = {400, 404, 413, 422}
def _vlm_key() -> str: """The judge model's API key: first non-empty of DASHSCOPE_API_KEY, VLM_API_KEY, JUDGE_API_KEY. Empty when none is set.""" for name in ("DASHSCOPE_API_KEY", "VLM_API_KEY", "JUDGE_API_KEY"): v = os.environ.get(name, "").strip() if v: return v return ""
def call_vlm(image_path: str, prompt: str, *, retries: int = 0) -> str | None: """Ask the VLM one question about a local screenshot. Returns the answer text.
Retries transient API failures (empty body, 429, 408/409/425, any 5xx) up to `retries` times — default VLM_RETRIES (3), overridable via the VLM_RETRIES env var. Terminal errors (bad key, malformed/oversized request) are not retried. """ retries = retries or VLM_RETRIES key = _vlm_key() or _VLM_DEFAULT_KEY try: with open(image_path, "rb") as f: b64 = base64.b64encode(f.read()).decode() except Exception as exc: print(f"[VLM] cannot read screenshot {image_path}: {exc}") return None mime = "image/jpeg" if image_path.lower().endswith((".jpg", ".jpeg")) else "image/png" body = json.dumps({ "model": os.environ.get("JUDGE_MODEL", "qwen3.7-plus"), "temperature": 0, "messages": [{"role": "user", "content": [ {"type": "image_url", "image_url": {"url": f"data:{mime};base64,{b64}"}}, {"type": "text", "text": prompt}, ]}], }).encode()
for attempt in range(retries): backoff = 2 * (attempt + 1) req = urllib.request.Request( f"{VLM_BASE_URL}/chat/completions", data=body, headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"}) try: with urllib.request.urlopen(req, timeout=120) as resp: data = json.loads(resp.read().decode()) text = (data["choices"][0]["message"]["content"] or "").strip() if text: return text print(f"[VLM] empty response (attempt {attempt + 1}/{retries})") except urllib.error.HTTPError as exc: detail = exc.read().decode(errors="replace")[:200] print(f"[VLM] HTTP {exc.code} (attempt {attempt + 1}/{retries}): {detail}") if exc.code in (401, 403) or exc.code in _VLM_TERMINAL_CODES: return None # repeating cannot help if exc.code == 429: backoff = 10 * (attempt + 1) # rate limit, not a blip except Exception as exc: # timeout, DNS, reset, bad JSON print(f"[VLM] call failed (attempt {attempt + 1}/{retries}): {exc}") if attempt < retries - 1: time.sleep(backoff) print(f"[VLM] giving up after {retries} attempt(s)") return None
def _vlm_log(results_dir: str, entry: dict) -> None: """Append one attempt to vlm_assertions.json. Called on EVERY vlm_assert exit path, including failures — a `_vlm` case with no entry here then provably never invoked the VLM, which is what build_manifest keys off.""" af = os.path.join(results_dir, "vlm_assertions.json") try: existing = json.load(open(af)) if os.path.exists(af) else [] if not isinstance(existing, list): existing = [] except Exception: existing = [] existing.append(entry) try: _write_json(af, existing) # type: ignore[arg-type] except Exception: try: with open(af, "w") as f: json.dump(existing, f, indent=2, ensure_ascii=False) except Exception as exc: print(f" [warn] vlm_assert: cannot write {af}: {exc}")
def vlm_assert(test_name, question, results_dir=None, expect="YES", *, depth=None, jump_kind="none", tag=None) -> bool: """Screenshot the current screen, ask the VLM one YES/NO question, record it.
`test_name` is auto-suffixed with `_vlm`, which is what routes it to the VLM track in save_results(). `tag` (color|shape|position|size|layout|content) lets and_audit compute the fine-grained share mechanically — always set it.
Ask about a SPECIFIC observable rendered property. A question that a blank screen or any app would pass is worthless. """ if not test_name.endswith("_vlm"): test_name += "_vlm" rd = results_dir or RESULTS_DIR if tag and tag not in VLM_TAGS: print(f" [warn] vlm_assert: unknown tag {tag!r}") ss_path = os.path.join(rd, "screenshots", f"{test_name}.png")
def _fail(msg: str, resp=None, answer="") -> bool: _vlm_log(rd, {"test_name": test_name, "question": question, "screenshot": ss_path, "vlm_response": resp, "vlm_answer": answer, "expected": expect, "passed": False, "tag": tag or "", "error": msg}) return record(test_name, False, msg, depth=depth, jump_kind=jump_kind, tag=tag)
if not screencap(ss_path): return _fail("setup_failed: screenshot capture failed")
prompt = ("Look at this Android app screenshot and answer the following question " "with ONLY 'YES' or 'NO'. Do not explain.\n\n" f"Question: {question}\n\nAnswer (YES or NO):") # An unparseable answer is the same class of flakiness as an empty body, so # re-ask rather than scoring harness noise against the VLM track. answer, resp = "", None for ask in range(VLM_RETRIES): resp = call_vlm(ss_path, prompt) if resp is None: return _fail("setup_failed: VLM API call failed") a = resp.strip().upper() # Whole-word match only: a bare `"NO" in a` also fires on CANNOT / NOT / # NONE / KNOW, turning "Maybe? I cannot tell." into a confident NO and # failing the test on harness noise instead of re-asking. has_yes = re.search(r"\bYES\b", a) is not None has_no = re.search(r"\bNO\b", a) is not None if a.startswith("YES"): answer = "YES" elif a.startswith("NO"): answer = "NO" elif has_yes and not has_no: answer = "YES" elif has_no and not has_yes: answer = "NO" if answer: break print(f"[VLM] unparseable answer {resp!r} (ask {ask + 1}/{VLM_RETRIES})") if not answer: return _fail(f"setup_failed: ambiguous VLM response after {VLM_RETRIES} " f"asks {resp!r}", resp=resp)
passed = answer == expect.upper() record(test_name, passed, (f"VLM: Q='{question}' A={answer} expect={expect}" if passed else f"behavior_wrong: VLM Q='{question}' A={answer} expect={expect}"), depth=depth, jump_kind=jump_kind, expect=f"VLM {expect}: {question}", tag=tag) _vlm_log(rd, {"test_name": test_name, "question": question, "screenshot": ss_path, "vlm_response": resp, "vlm_answer": answer, "expected": expect, "passed": passed, "tag": tag or ""}) return passed
# ══════════════════════════════════════════════════════════════════════════════# (8) Audit / lint — ALL report-only. None of these ever blocks delivery.# ══════════════════════════════════════════════════════════════════════════════
def _load_all(results_dir: str) -> list[dict]: recs, seen_files = [], set() for pat in (os.path.join(results_dir, "android_*_eval.json"), os.path.join(results_dir, "eval_results", "android_*_eval.json")): for path in glob.glob(pat): base = os.path.basename(path) if base in seen_files: continue seen_files.add(base) try: data = json.load(open(path)) except Exception: continue for t in data.get("results", []): if isinstance(t, dict) and "test" in t: recs.append(t) return recs
def and_audit(results_dir: str = "", quotas: dict | None = None) -> dict: """Aggregate declared depth/jump_kind/vlm-tag across the suite and report the quota TARGETS with the concrete gap. GOALS, not a gate.""" results_dir = results_dir or RESULTS_DIR q = quotas or QUOTAS recs = _load_all(results_dir) backfilled = [r for r in recs if r.get("backfilled")] recs = [r for r in recs if not r.get("backfilled")] n = len(recs) if not n: print(f"[and_audit] no records under {results_dir}") return {"total": 0} kinds = [r.get("jump_kind", "none") for r in recs] none_n = sum(1 for k in kinds if k == "none") live_n = sum(1 for k in kinds if k == "liveness") inter = [r for r in recs if r.get("jump_kind") in ("reach", "transition", "value")] ni = len(inter) or 1 d1 = sum(1 for r in inter if int(r.get("depth", 0)) >= 1) d2 = sum(1 for r in inter if int(r.get("depth", 0)) >= 2) val = sum(1 for r in inter if r.get("jump_kind") == "value") vlm = [r for r in recs if r["test"].endswith("_vlm")] fine = sum(1 for r in vlm if r.get("tag") in VLM_FINE_TAGS) vlm_share = len(vlm) / n
def line(label, got, need, kind): ok = got >= need if kind == "min" else got <= need return ok, (f" [{'ok ' if ok else 'GAP'}] {label}: {got:.0%} " f"({'>=' if kind == 'min' else '<='} {need:.0%})")
lo, hi = q["vlm_share_min"], q["vlm_share_max"] vlm_ok = lo <= vlm_share <= hi if vlm_share < lo: # each added vlm record also grows the denominator: (v+x)/(n+x) >= lo need_more = math.ceil((lo * n - len(vlm)) / (1 - lo)) vlm_hint = (f"under budget by ~{max(1, need_more)} record(s) — allocate more " f"per lane NEXT run; do not re-run to chase it") elif vlm_share > hi: vlm_hint = "over budget — allocate fewer per lane next run" else: vlm_hint = "in budget" vlm_msg = (f" [{'ok ' if vlm_ok else 'GAP'}] VLM BUDGET vlm/total: " f"{len(vlm)}/{n} = {vlm_share:.0%} (target {lo:.0%}-{hi:.0%}) " f"— {vlm_hint}")
checks = [ line("existence(none)/all", none_n / n, q["existence_max"], "max"), line("interactive/all", len(inter) / n, q["interactive_min"], "min"), line("depth>=1 /interactive", d1 / ni, q["depth_ge1_min"], "min"), line("depth>=2 /interactive", d2 / ni, q["depth_ge2_min"], "min"), line("value(tier3)/interactive", val / ni, q["value_min"], "min"), (vlm_ok, vlm_msg), line("vlm fine-grained/vlm", fine / (len(vlm) or 1), q["vlm_fine_min"], "min"), ] print(f"[and_audit] {results_dir} total={n} interactive={len(inter)} " f"none={none_n} liveness={live_n} depth>=1={d1} depth>=2={d2} " f"value={val} vlm={len(vlm)} vlm_fine={fine}") if backfilled: print(f" [!!!] {len(backfilled)} record(s) never reached their assertion " f"(back-filled as failures) — excluded from the ratios above; the " f"100%-pass gate on the original app must catch these") for _ok, msg in checks: print(msg) passed = all(ok for ok, _ in checks) print("[and_audit] " + ("ALL TARGETS MET" if passed else "some targets below — this is a REPORT, not a task: finalize now and fix " "the shortfall in the NEXT run's plan. Re-running the suite to move these " "numbers costs hours and changes nothing about the app under test")) return {"total": n, "interactive": len(inter), "none": none_n, "liveness": live_n, "depth_ge1": d1, "depth_ge2": d2, "value": val, "vlm": len(vlm), "vlm_fine": fine, "vlm_share": round(vlm_share, 4), "backfilled": len(backfilled), "passed": passed, "checks": [m for _o, m in checks]}
def and_lint(results_dir: str = "") -> list[str]: """Flag weak or inconsistent DECLARATIONS.""" results_dir = results_dir or RESULTS_DIR issues, names = [], set() for r in _load_all(results_dir): jk, nm = r.get("jump_kind", "none"), r.get("test", "?") if nm in names: issues.append(f"{nm}: duplicate record name (drifts the denominator)") names.add(nm) if jk not in JUMP_KINDS: issues.append(f"{nm}: unknown jump_kind {jk!r}") if jk in ("reach", "transition", "value") and not str(r.get("expect", "")).strip(): issues.append(f"{nm}: jump_kind={jk} but empty expect " f"(name the specific observed target)") if jk == "liveness": issues.append(f"{nm}: liveness is tier1 — assert the app-authored effect instead") if int(r.get("depth", 0)) < 0: issues.append(f"{nm}: negative depth") msg = str(r.get("message", "")) if not r.get("passed") and not msg.startswith(FAIL_PREFIXES): issues.append(f"{nm}: failure message must start with one of " f"{'/'.join(FAIL_PREFIXES)} (got {msg[:40]!r})") if nm.endswith("_vlm") and not r.get("tag") and not r.get("backfilled"): issues.append(f"{nm}: VLM record has no tag " f"(color|shape|position|size|layout|content)") if issues: print(f"[and_lint] {len(issues)} issue(s):") for i in issues: print(" - " + i) else: print("[and_lint] no issues") return issues
# Non-portable source patterns: they pass on the ORIGINAL app and break on the# RECREATION (different package, different install path). Each is a hard defect._BAD_SOURCE_PATTERNS = [ (r"""["'][a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*){2,}["']""", "hardcodes a package name; use the module-level PACKAGE (argv[1]) — the " "recreation's package differs", ("android.", "androidx.", "java.", "javax.", "com.android.adbkeyboard", "ca.zgrs.clipper", "android.intent.", "com.google.android.inputmethod")), (r"""["'][^"']*\.apk["']|clean\.apk""", "names an APK path; the test must never install or locate the app", ()), (r"/data/data/|/sdcard/Android/data/", "uses a per-package data path, which breaks when the recreation's package " "differs; drive state through the GUI", ()), (r"\btap\(\s*\d{2,}\s*,\s*\d{2,}", "taps a hardcoded pixel coordinate; derive it from a node's _center or " "get_screen_info()", ()), (r"\bpm\s+grant\b|\bappops\s+set\b|\bsettings\s+put\b|\bcontent\s+insert\b", "seeds state outside the GUI; the recreation may not honor it — drive the " "same state through the UI", ()), (r"am\s+start\s+-n\s", "deep-links straight to a component: not portable, and not navigation " "(it cannot back a depth claim)", ()), (r"emulator-\d{4}|127\.0\.0\.1:\d{4}", "hardcodes a device serial; use the module-level DEVICE", ()),]
def and_lint_sources(testgen_dir: str = "") -> list[str]: """Scan authored test/helper .py for NON-PORTABLE patterns and for kit API drift. A clean result means the suite will actually drive the recreation, not just the original.""" testgen_dir = testgen_dir or RESULTS_DIR kit_base = os.path.basename(__file__) py = [p for p in (glob.glob(os.path.join(testgen_dir, "*.py")) + glob.glob(os.path.join(testgen_dir, "tests", "*.py"))) if os.path.basename(p) != kit_base] kit_names = set(globals().keys()) # A sample file the app is supposed to OPEN. Testgen and eval run on DIFFERENT # emulators, so naming one without pushing it means it only ever existed # because someone put it there by hand while exploring. _DEV_PATH_RE = re.compile(r"/sdcard/|/storage/emulated/|\bDCIM\b", re.I) _DOC_RE = re.compile( r"""["'][^"']*\.(?:pdf|epub|mobi|djvu|zim|mp3|mp4|mkv|wav|ogg)["']""", re.I) _fix_files = [f for f in glob.glob(os.path.join(testgen_dir, "fixtures", "**"), recursive=True) if os.path.isfile(f)] issues = [] srcs = {} for p in py: try: srcs[p] = open(p, errors="replace").read() except Exception: continue suite_pushes = any(re.search(r"\b(push_fixtures|fixture_on_device)\b", s) for s in srcs.values()) if _fix_files and not suite_pushes: issues.append( f"fixtures/: {len(_fix_files)} fixture file(s) are authored but NO test " f"calls push_fixtures() — they never reach the device, so every test " f"that opens one records setup_failed. Call it once via run_suite(), " f"or drop the directory.") for p, src in srcs.items(): base = os.path.basename(p) # Strip comments AND docstrings: prose describing the app under test names # files it opens, which is not the same as the code depending on one. scan = re.sub(r'"""[\s\S]*?"""|\'\'\'[\s\S]*?\'\'\'', '""', src) scan = re.sub(r"#[^\n]*", "", scan) # adb is called argv-style — adb_shell("am", "start", "-n", x) — so collapse # the quote-comma-quote separators to read those calls as command lines. flat = re.sub(r"""["']\s*,\s*["']""", " ", scan) if not suite_pushes: for ln in scan.splitlines(): m = _DEV_PATH_RE.search(ln) or _DOC_RE.search(ln) if m: issues.append( f"{base}: needs a sample file on the device " f"[{ln.strip()[:60]}] but the suite never calls " f"push_fixtures() — testgen and eval run on DIFFERENT " f"emulators, so at eval the file is absent. Author the bytes " f"into {os.path.join(testgen_dir, 'fixtures')}/ and let " f"run_suite() push them.") break for pat, why, allow in _BAD_SOURCE_PATTERNS: hit = None for form in (scan, flat): for m in re.finditer(pat, form): cand = m.group(0) if allow and any(a in cand for a in allow): continue hit = cand break if hit: break if hit: issues.append(f"{base}: {why} [{hit[:48]}]") # kit API drift — an import/attr the kit does not define imported: list[str] = [] for m in re.finditer( r"from\s+android_testgen_kit\s+import\s+\(([^)]*)\)", scan, re.S): imported += m.group(1).split(",") for m in re.finditer( r"from\s+android_testgen_kit\s+import\s+([^\n(]+)", scan): imported += m.group(1).split(",") for raw in imported: nm = raw.strip().split(" as ")[0].strip() if nm and nm != "*" and nm not in kit_names: issues.append(f"{base}: imports android_testgen_kit.{nm} which the " f"kit does not define (would ImportError at eval)") for m in re.finditer(r"\bkit\.(\w+)\s*\(", scan): if m.group(1) not in kit_names: issues.append(f"{base}: calls kit.{m.group(1)}() which the kit does " f"not define (would AttributeError at eval)") if issues: print(f"[and_lint_sources] {len(issues)} portability issue(s):") for i in issues: print(" - " + i) else: print("[and_lint_sources] no portability issues") return issues
# ── MEASURED depth cross-check (report-only): does the SOURCE back the DECLARE? ─def _ast_call_name(node) -> str: f = node.func if isinstance(f, ast.Attribute): return f.attr if isinstance(f, ast.Name): return f.id return ""
def _string_locals(fn_node) -> dict[str, str]: """`name = "states_toggle"` inside a test — so record(name, ...) resolves.""" out = {} for n in ast.walk(fn_node): if isinstance(n, ast.Assign) and isinstance(n.value, ast.Constant) \ and isinstance(n.value.value, str): for t in n.targets: if isinstance(t, ast.Name): out[t.id] = n.value.value return out
def _record_names(fn_node) -> list[str]: """Literal record()/vlm_assert() names in this function, preferring the @and_test(expects=(...)) literal when present.""" for dec in getattr(fn_node, "decorator_list", []): if isinstance(dec, ast.Call) and _ast_call_name(dec) == "and_test": for kw in dec.keywords: if kw.arg == "expects" and isinstance(kw.value, (ast.Tuple, ast.List)): return [e.value for e in kw.value.elts if isinstance(e, ast.Constant) and isinstance(e.value, str)] slocals = _string_locals(fn_node) names = [] for n in ast.walk(fn_node): if not (isinstance(n, ast.Call) and _ast_call_name(n) in ("record", "vlm_assert")): continue if not n.args: continue a0 = n.args[0] if isinstance(a0, ast.Constant) and isinstance(a0.value, str): names.append(a0.value) elif isinstance(a0, ast.Name) and a0.id in slocals: names.append(slocals[a0.id]) return names
def _depth_calls(fn_node, local_funcs, budget: int = 2, seen=None): """(fwd, back, reach) depth-family calls, descending `budget` levels into file-local helpers. Cycle-guarded. A LOWER BOUND — never an over-claim.""" seen = seen if seen is not None else set() fwd = bk = rch = 0 relaunch = False for node in ast.walk(fn_node): if not isinstance(node, ast.Call): continue cn = _ast_call_name(node) if DEPTH_FWD_RE.match(cn): fwd += 1 if cn.startswith("and_reach"): rch += 1 elif DEPTH_BACK_RE.match(cn): bk += 1 elif cn in ("launch_app", "restart_app", "force_stop_and_relaunch"): relaunch = True elif budget > 0 and cn in local_funcs and cn not in seen: seen.add(cn) f, b, r = _depth_calls(local_funcs[cn], local_funcs, budget - 1, seen)[:3] fwd, bk, rch = fwd + f, bk + b, rch + r return fwd, bk, rch, relaunch
def and_audit_depth(testgen_dir: str = "", results_dir: str = "") -> list[str]: """MEASURE navigation depth from the test SOURCE (AST) and cross-check the DECLARED depth/jump_kind — so a test cannot just TYPE depth=2. REPORT-ONLY.
Flags a declared depth>=1 or jump_kind="reach" with NO backing call from the depth family and_enter*/and_reach* (directly, in a file-local helper it calls, or anywhere in the module for variable-named records), plus a "reach" that was achieved by relaunching the app rather than navigating. """ testgen_dir = testgen_dir or RESULTS_DIR results_dir = results_dir or testgen_dir files = [p for p in (glob.glob(os.path.join(testgen_dir, "test_android_*.py")) + glob.glob(os.path.join(testgen_dir, "tests", "test_android_*.py")))] per_record, per_module = {}, {} for p in files: try: tree = ast.parse(open(p, errors="replace").read()) except Exception: continue stem = os.path.basename(p)[len("test_android_"):-len(".py")] mod = _MODULE_ALIAS.get(stem, stem) local_funcs = {n.name: n for n in ast.walk(tree) if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef))} module_backing = any( isinstance(n, ast.Call) and DEPTH_FWD_RE.match(_ast_call_name(n)) for n in ast.walk(tree)) per_module[mod] = {"module_backing": module_backing} for fn in local_funcs.values(): if not fn.name.startswith("test_"): continue fwd, bk, rch, relaunch = _depth_calls(fn, local_funcs) measured = max(0, max((fwd - rch) - bk, 1 if rch >= 1 else 0)) for nm in _record_names(fn): per_record[(mod, nm)] = {"measured_depth": measured, "backing": fwd >= 1, "n_reach": rch, "relaunch": relaunch, "fn": fn.name} issues = [] for r in _load_all(results_dir): nm, jk = r.get("test", "?"), r.get("jump_kind", "none") depth = int(r.get("depth", 0) or 0) strong = depth >= 1 or jk == "reach" hit = None for (mod, rname), v in per_record.items(): if rname == nm: hit = v break if hit is not None: if strong and not hit["backing"]: issues.append(f"{nm} ({hit['fn']}): declared depth={depth}/" f"jump_kind={jk} but NO backing and_enter*/and_reach* " f"call (fake depth)") elif jk == "reach" and hit["n_reach"] == 0: issues.append(f"{nm} ({hit['fn']}): jump_kind=reach but no " f"and_reach* call in its code") elif jk == "reach" and hit["relaunch"]: issues.append(f"{nm} ({hit['fn']}): jump_kind=reach but the function " f"relaunches the app — that is not navigation") elif strong and not any(v.get("module_backing", True) for v in per_module.values()): issues.append(f"{nm}: declared depth={depth}/jump_kind={jk} but no " f"and_enter*/and_reach* call anywhere (fake depth)") if issues: print(f"[and_audit_depth] {len(issues)} fake-depth issue(s) (REPORT-ONLY — " f"fix by adding the and_reach/and_enter you navigated with, or lower " f"the declared depth):") for i in issues: print(" - " + i) else: print("[and_audit_depth] no fake-depth issues " "(declared depth/reach backed by nav calls)") return issues
# ══════════════════════════════════════════════════════════════════════════════# (9) Frozen manifest — the FIXED denominator (ported from RecreationBench v7.2)## Without this, the eval denominator is whatever the candidate happened to emit:# a recreation that crashes a module SHRINKS its own denominator instead of# counting the missing behaviour as failures. The manifest is frozen ONCE per# task from the ORIGINAL app's run and is the denominator authority for every# candidate. Missing tests are injected as `not_run`; extra tests are ignored.# ══════════════════════════════════════════════════════════════════════════════
MANIFEST_NAME = "test_manifest.json"MANIFEST_VERSION = 1
def qualify_name(module: str, test: str) -> str: """`module::test` — two modules may legitimately reuse a short test name.""" return test if "::" in test else f"{module}::{test}"
def _record_status(rec: dict) -> str: if rec.get("status") in ("passed", "failed", "error", "skipped", "not_run"): return rec["status"] return "passed" if rec.get("passed") else "failed"
def _load_by_module(results_dir: str) -> list[tuple[str, dict]]: """Like _load_all but keeps the owning module, so names can be qualified.""" out, seen_files = [], set() for pat in (os.path.join(results_dir, "android_*_eval.json"), os.path.join(results_dir, "eval_results", "android_*_eval.json")): for path in sorted(glob.glob(pat)): base = os.path.basename(path) if base in seen_files: continue seen_files.add(base) try: data = json.load(open(path)) except Exception: continue mod = data.get("module") or base[len("android_"):-len("_eval.json")] for t in data.get("results", []): if isinstance(t, dict) and "test" in t: out.append((str(mod), t)) return out
def _vlm_logged_names(results_dir: str) -> tuple[set[str], bool]: """(names with >=1 logged VLM attempt, whether any log file was found).
Checks the root AND eval_results/ — the agent's self-validation run drives test_verify.sh with --output-dir, which puts the log one level down. """ names, found = set(), False for sub in ("", "eval_results"): p = os.path.join(results_dir, sub, "vlm_assertions.json") if not os.path.isfile(p): continue found = True try: for x in json.load(open(p)): if isinstance(x, dict) and x.get("test_name"): names.add(str(x["test_name"])) except Exception: pass return names, found
def build_manifest(results_dir: str = "", *, task_id: str = "", baseline_model: str = "", out_path: str = "") -> dict: """Freeze the ORIGINAL app's PASSING tests as the denominator.
A test that fails on the original is not a signal about any recreation, so it is moved to `ignored[reason=baseline_fail]` instead of counting against every candidate. This is the only denominator-shrinking mechanism, and it is applied identically to all candidates. """ results_dir = results_dir or RESULTS_DIR logged, log_found = _vlm_logged_names(results_dir) tests, ignored, vlm_assertions = [], [], [] n_unverified = 0 for mod, rec in _load_by_module(results_dir): name = qualify_name(mod, str(rec.get("test", ""))) status = _record_status(rec) entry = {"name": name, "module": mod, "baseline_status": status} is_vlm = name.endswith("_vlm") # A passing _vlm case with no logged attempt never provably reached the # judge on the original app — it must not sit in the VLM denominator that # every recreation is scored against. if is_vlm and status == "passed" and str(rec.get("test", "")) not in logged: n_unverified += 1 ignored.append({"name": name, "module": mod, "reason": "vlm_unverified", "baseline_status": status, "message": "no attempt in vlm_assertions.json — the VLM " "was never provably invoked for this case"}) continue if status == "passed": tests.append(entry) if is_vlm: vlm_assertions.append({"name": name, "module": mod, "tag": rec.get("tag", "")}) else: ignored.append({"name": name, "module": mod, "reason": "baseline_fail", "baseline_status": status, "message": str(rec.get("message", ""))[:300]}) tests.sort(key=lambda t: t["name"]) ignored.sort(key=lambda t: t["name"]) payload = "\n".join(t["name"] for t in tests) pkg = (os.environ.get("ORIG_PACKAGE") or os.environ.get("PACKAGE") or (PACKAGE if "." in PACKAGE else "")) manifest = { "manifest_version": MANIFEST_VERSION, "kit_api_version": KIT_API_VERSION, "task_id": task_id or os.environ.get("INSTANCE_ID", ""), "baseline_model": baseline_model or os.environ.get("MODEL", ""), "baseline_package": pkg, "total": len(tests), "manifest_sha": hashlib.sha256(payload.encode()).hexdigest()[:12], "tests": tests, "ignored": ignored, "vlm_assertions": vlm_assertions, "vlm_total": len(vlm_assertions), "n_vlm_unverified": n_unverified, "vlm_log_found": log_found, } dest = out_path or os.path.join(results_dir, MANIFEST_NAME) tmp = dest + ".tmp" with open(tmp, "w") as f: json.dump(manifest, f, indent=2, ensure_ascii=False) os.replace(tmp, dest) print(f"[build_manifest] {dest} total={manifest['total']} " f"vlm={manifest['vlm_total']} ignored={len(ignored)} " f"sha={manifest['manifest_sha']}") if n_unverified: print(f" [!!!] {n_unverified} passing _vlm case(s) EXCLUDED as " f"vlm_unverified — no attempt logged in vlm_assertions.json" + ("" if log_found else " (no log file found at all — the suite may " "have bypassed the kit's vlm_assert)") + ". They are out of the VLM denominator; fix the VLM path rather " "than accepting the smaller denominator.") base_fail = [i for i in ignored if i["reason"] == "baseline_fail"] if base_fail: print(f" {len(base_fail)} baseline failure(s) excluded from the denominator " f"(they say nothing about a recreation):") for i in base_fail[:20]: print(f" - {i['name']}: {i['message'][:120]}") return manifest
def load_manifest(d: str = "") -> dict | None: """Return the frozen manifest from `d` (or its eval_results/), else None.""" d = d or RESULTS_DIR for p in (os.path.join(d, MANIFEST_NAME), os.path.join(d, "eval_results", MANIFEST_NAME)): if os.path.isfile(p): try: m = json.load(open(p)) except Exception: continue if isinstance(m, dict) and m.get("tests"): return m return None
def score_against_manifest(results_dir: str = "", manifest: dict | None = None) -> dict: """Score a candidate run against the frozen denominator.
denominator = len(manifest["tests"]) regardless of what the candidate emitted. A manifest test the candidate never reported is injected as `not_run` (a non-pass); a test the candidate invented is excluded. A module that crashed on import therefore scores 0/full instead of vanishing. """ results_dir = results_dir or RESULTS_DIR manifest = manifest or load_manifest(results_dir) if not manifest: return {} expected = {t["name"]: t for t in manifest["tests"]} got = {} for mod, rec in _load_by_module(results_dir): got[qualify_name(mod, str(rec.get("test", "")))] = rec
per_test, by_module = {}, {} injected = 0 for name, meta in expected.items(): rec = got.get(name) if rec is None: status, msg = "not_run", "not_run: absent from the candidate's output" injected += 1 else: status, msg = _record_status(rec), str(rec.get("message", "")) per_test[name] = {"status": status, "message": msg[:300]} m = by_module.setdefault(meta.get("module", "?"), {"total": 0, "passed": 0, "not_run": 0}) m["total"] += 1 m["passed"] += status == "passed" m["not_run"] += status == "not_run"
unexpected = sorted(set(got) - set(expected)) total = len(expected) passed = sum(1 for v in per_test.values() if v["status"] == "passed") vlm_names = {a["name"] for a in manifest.get("vlm_assertions", [])} vlm_total = len(vlm_names) vlm_passed = sum(1 for n in vlm_names if per_test.get(n, {}).get("status") == "passed") rule_total = total - vlm_total rule_passed = passed - vlm_passed for m in by_module.values(): m["pass_rate"] = round(m["passed"] / m["total"], 4) if m["total"] else 0.0
out = { "scored_against": "manifest", "manifest_sha": manifest.get("manifest_sha", ""), "manifest_total": total, "total": total, "passed": passed, "pass_rate": round(passed / total, 4) if total else 0.0, "n_injected_not_run": injected, "n_unexpected": len(unexpected), "unexpected": unexpected[:50], "rule": {"total": rule_total, "passed": rule_passed, "pass_rate": round(rule_passed / rule_total, 4) if rule_total else 0.0}, "vlm": {"total": vlm_total, "passed": vlm_passed, "pass_rate": round(vlm_passed / vlm_total, 4) if vlm_total else 0.0}, "by_module": by_module, "per_test": per_test, } print(f"[score_against_manifest] sha={out['manifest_sha']} " f"{passed}/{total} = {out['pass_rate']:.4f} " f"(injected_not_run={injected} unexpected={len(unexpected)}) " f"rule={rule_passed}/{rule_total} vlm={vlm_passed}/{vlm_total}") return out
if __name__ == "__main__": _fns = {"audit": and_audit, "lint": and_lint, "lint_sources": and_lint_sources, "build_manifest": build_manifest} _argv = sys.argv[1:] if _argv[:1] == ["audit_depth"] and len(_argv) >= 2: and_audit_depth(_argv[1], _argv[2] if len(_argv) >= 3 else "") elif _argv[:1] == ["score"] and len(_argv) >= 2: _m = load_manifest(_argv[2]) if len(_argv) >= 3 else load_manifest(_argv[1]) _out = score_against_manifest(_argv[1], _m) if not _out: print("no manifest found — cannot score against a fixed denominator", file=sys.stderr) sys.exit(2) print(json.dumps(_out, ensure_ascii=False)) elif len(_argv) >= 2 and _argv[0] in _fns: _fns[_argv[0]](_argv[1]) else: print("usage: android_testgen_kit.py {audit|lint|lint_sources|build_manifest} <dir>\n" " android_testgen_kit.py audit_depth <testgen_dir> [results_dir]\n" " android_testgen_kit.py score <results_dir> [manifest_dir]")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230{ "module": "text", "total": 22, "passed": 22, "failed": 0, "pass_rate": 1.0, "rule": { "total": 22, "passed": 22, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 0, "passed": 0, "failed": 0, "pass_rate": 0 }, "vlm_ratio": 0.0, "audit": { "kit_api_version": 1, "existence": 2, "liveness": 0, "interactive": 20, "depth_ge1": 19, "depth_ge2": 6, "value": 3, "vlm_fine": 0 }, "results": [ { "test": "text_empty_state_subtitle", "passed": true, "message": "", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "Read your favorite books and sort them between categories" }, { "test": "text_empty_state_cta", "passed": true, "message": "", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "Add a book" }, { "test": "text_search_hint", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "search field placeholder reads 'Search…'" }, { "test": "text_filter_tabs", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Filter sheet tabs 'Sort' and 'Display'" }, { "test": "text_filter_sort_options", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "sort options 'Alphabetically', 'Last read', 'Progress', 'Author'" }, { "test": "text_more_sheet_items", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "More sheet items 'About app' and 'Settings'" }, { "test": "text_bookinfo_no_description", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "No description." }, { "test": "text_bookinfo_author", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Author label present with value 'Unknown'" }, { "test": "text_bookinfo_start_button", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "button label 'Start'" }, { "test": "text_settings_general_subtitle", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "General row subtitle 'App language'" }, { "test": "text_settings_appearance_subtitle", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Appearance row subtitle 'Theme, colors'" }, { "test": "text_settings_reader_subtitle", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Reader row subtitle 'Font, text'" }, { "test": "text_settings_library_subtitle", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Library row subtitle 'Categories, display, tabs'" }, { "test": "text_about_report_bug", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "About row label 'Report a bug'" }, { "test": "text_about_licenses", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "About row label 'Open source licenses'" }, { "test": "text_about_support_development", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "About row label 'Support development'" }, { "test": "text_reader_chapter_heading", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "reader heading 'Chapter One'" }, { "test": "text_reader_first_paragraph", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "reader body contains 'The quick brown fox jumps over the lazy dog.'" }, { "test": "text_reader_topbar_title", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "reader top bar shows title 'testbook' and chapter 'Chapter One'" }, { "test": "text_history_today_group", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "History date-group header 'Today'" }, { "test": "text_history_book_title", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "History lists book title 'testbook'" }, { "test": "text_browse_folder_path", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "/storage/emulated/0/Download/Books" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241"""Shared book-import fixture helper for Book Story reader tests.
This module is imported (never inlined) by the test modules that need a realbook in the library or the reader open. It owns the full, portable path:
push fixtures -> grant the Download/Books folder via SAF (once) -> scan + add the book to the library -> open the reader.
Every helper is idempotent and self-healing: it first checks whether the app isalready in the desired state, and only performs the setup work when it is not.Nothing here writes a package name, an absolute app-data path, or a pixelcoordinate — the folder is located by its on-device name, which the kit derivesfrom the fixtures directory, so the identical flow runs on the recreation."""import osimport sysimport time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,F401
# The book fixtures live in fixtures/Books/*.txt on the host, which the kit# mirrors to /sdcard/Download/Books/*.txt on device (subdirs preserved).BOOK_SUBDIR = "Books"BOOK1_FILE = "testbook.txt"BOOK1_TITLE = "testbook"BOOK2_FILE = "alpha_wonderland.txt"BOOK2_TITLE = "alpha_wonderland"
def _tab(nodes, label): """Bottom-nav tab by its visible label (Library/History/Browse).""" hits = [n for n in find_nodes(nodes, text=label)] # the bottom-nav labels sit near the bottom of the screen hits = sorted(hits, key=lambda n: n.get("_bounds", (0, 0, 0, 0))[1]) for n in hits: y = n.get("_bounds", (0, 0, 0, 0))[1] if y > 2000: return n return hits[-1] if hits else None
def _open_tab(label): nodes = ui() t = _tab(nodes, label) if t: tap_node(t) settle("tap") return True return False
def library_has_book(title, relaunch=True): """True if `title` is currently shown on the Library screen.""" if relaunch: restart_app() wait_for_foreground() _open_tab("Library") nodes = ui() return find_node(nodes, text=title) is not None
def _folder_already_granted(): """From the Browse tab, a granted folder makes the book file appear.""" nodes = ui() return find_node(nodes, text=BOOK1_FILE) is not None or \ find_node(nodes, text=BOOK2_FILE) is not None
def grant_books_folder(): """Grant the Download/Books folder through the SAF picker, once.
Assumes the Browse tab is showing. Returns True when the folder is granted (or was already). The grant survives restart/process-death but NOT a data wipe, so callers that clear_data must re-grant. """ if _folder_already_granted(): return True nodes = ui() setup = find_node(nodes, text="Set up scanning") if setup: tap_node(setup) settle("launch") else: # Browse settings reachable via the More menu if the empty-state CTA is gone more = find_node(nodes, content_desc="More") if more: tap_node(more) settle("tap") nodes = ui() sett = find_node_ci(nodes, "Scanning") or find_node_ci(nodes, "Settings") if sett: tap_node(sett) settle("launch") time.sleep(1) nodes = ui() addf = find_node(nodes, text="Add folder") if not addf: return _folder_already_granted() tap_node(addf) settle("launch") time.sleep(1.5) # SAF picker: sdk_gphone -> Download -> Books -> USE THIS FOLDER -> ALLOW for _ in range(8): if find_node(ui(), text="Download"): break time.sleep(1) dl = find_node(ui(), text="Download") if not dl: return False tap_node(dl) settle("launch") time.sleep(1.5) bk = find_node(ui(), text=BOOK_SUBDIR) if not bk: return False tap_node(bk) settle("launch") time.sleep(1.5) use = find_node(ui(), text="USE THIS FOLDER") if not use: return False tap_node(use) settle("launch") time.sleep(1.5) allow = find_node_ci(ui(), "ALLOW") if allow: tap_node(allow) settle("launch") time.sleep(2.5) # We are now back on the Browse settings screen; pop to the Browse tab. back() settle("tap") time.sleep(1) return _folder_already_granted() or True
def import_book(title=BOOK1_TITLE, book_file=BOOK1_FILE): """Ensure `title` is in the Library. Idempotent.
Returns (ok: bool, note: str). `note` is one of already / imported / setup_failed:<reason> so a caller can produce an honest failure message. """ push_fixtures() restart_app() wait_for_foreground() _open_tab("Library") if find_node(ui(), text=title): return True, "already"
if not _open_tab("Browse"): return False, "setup_failed: no Browse tab" if not _folder_already_granted(): grant_books_folder() # grant_books_folder may leave us in settings; return to Browse tab if not _folder_already_granted(): _open_tab("Browse") # Scan may take a moment to surface the file. bf = None for _ in range(6): bf = find_node(ui(), text=book_file) if bf: break time.sleep(1) if not bf: return False, "setup_failed: book file not found in Browse after grant" tap_node(bf) settle("tap") add = find_node(ui(), content_desc="Add files") if not add: return False, "setup_failed: Add files action missing" tap_node(add) settle("launch") ok_btn = find_node(ui(), text="OK") if ok_btn: tap_node(ok_btn) settle("launch") time.sleep(3) _open_tab("Library") if find_node(ui(), text=title): return True, "imported" return False, "setup_failed: book not in library after add"
def open_book_info(title=BOOK1_TITLE): """From the Library, tap the book's cover to open its Book Info screen. Returns True on success. Assumes the book is already imported.""" restart_app() wait_for_foreground() _open_tab("Library") nodes = ui() # The cover is the tappable card; find the title label then tap the cover # that sits above/left of it. The cover has content-desc "Cover image ...". cover = find_node(nodes, content_desc="Cover image not found") if cover is None: covers = [n for n in nodes if "Cover image" in (n.get("content-desc") or "")] cover = covers[0] if covers else None if cover is None: return False if not tap_node(cover): return False settle("launch") # Book Info shows a "Start"/"Continue" button and Move/Delete nodes = ui() return (find_node(nodes, text="Start") is not None or find_node(nodes, text="Continue") is not None or find_node(nodes, text="Move") is not None)
def open_reader(title=BOOK1_TITLE): """Open the reader on `title` and return True once book text is showing.
Dismisses the one-time immersive-mode system cling if it appears. """ if not open_book_info(title): return False nodes = ui() start = find_node(nodes, text="Start") or find_node(nodes, text="Continue") if not start: return False tap_node(start) settle("launch") time.sleep(2) # Dismiss the system "Viewing full screen / Got it" cling if present. got = find_node(ui(), text="Got it") if got: tap_node(got) settle("tap") time.sleep(1) nodes = ui() return find_node(nodes, text="Chapter One") is not None or len( [n for n in nodes if len(n.get("text", "")) > 40]) > 0
def reader_show_menu(): """Inside the reader, tap the center to toggle the top/bottom reader bars. Returns the node list after the tap.""" info = get_screen_info() tap(info["center_x"], info["center_y"]) settle("tap") return ui()1pytest_plugins = ["rb_unify.pytest_rb", "rb_unify.android_bridge"]12345678910111213141516171819202122232425262728293031323334353637383940414243The Test Chronicle
by Recon Author
Chapter 1
This is paragraph 1 of chapter 1. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 1. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 1. The quick brown fox jumps over the lazy dog.
This is paragraph 2 of chapter 1. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 1. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 1. The quick brown fox jumps over the lazy dog.
This is paragraph 3 of chapter 1. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 1. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 1. The quick brown fox jumps over the lazy dog.
Chapter 2
This is paragraph 1 of chapter 2. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 2. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 2. The quick brown fox jumps over the lazy dog.
This is paragraph 2 of chapter 2. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 2. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 2. The quick brown fox jumps over the lazy dog.
This is paragraph 3 of chapter 2. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 2. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 2. The quick brown fox jumps over the lazy dog.
Chapter 3
This is paragraph 1 of chapter 3. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 3. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 3. The quick brown fox jumps over the lazy dog.
This is paragraph 2 of chapter 3. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 3. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 3. The quick brown fox jumps over the lazy dog.
This is paragraph 3 of chapter 3. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 3. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 3. The quick brown fox jumps over the lazy dog.
Chapter 4
This is paragraph 1 of chapter 4. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 4. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 4. The quick brown fox jumps over the lazy dog.
This is paragraph 2 of chapter 4. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 4. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 4. The quick brown fox jumps over the lazy dog.
This is paragraph 3 of chapter 4. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 4. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 4. The quick brown fox jumps over the lazy dog.
Chapter 5
This is paragraph 1 of chapter 5. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 5. The quick brown fox jumps over the lazy dog. This is paragraph 1 of chapter 5. The quick brown fox jumps over the lazy dog.
This is paragraph 2 of chapter 5. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 5. The quick brown fox jumps over the lazy dog. This is paragraph 2 of chapter 5. The quick brown fox jumps over the lazy dog.
This is paragraph 3 of chapter 5. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 5. The quick brown fox jumps over the lazy dog. This is paragraph 3 of chapter 5. The quick brown fox jumps over the lazy dog. 1234567Introduction
Alpha Wonderland is a distinct sample title used so the test suite can search and filter between multiple books in the library without ambiguity.
Section One
This book exists purely to provide a second, uniquely named record for multi-book integrity and search tests. Its content differs from the first sample book on every line.1234567891011Chapter One
The quick brown fox jumps over the lazy dog. This is a sample book for testing the Book Story reader application. It contains multiple paragraphs of readable text that the reader will render on screen.
This second paragraph of the first chapter gives the reader more content to display and lets us verify that scrolling and pagination work as intended inside the reader view.
Chapter Two
Reading is a wonderful activity that expands the mind. This second chapter continues the story with more sample content for the reader to display on screen.
The story concludes here with a final paragraph that marks the end of the sample book used throughout the automated behavioral test suite for this reader application.12pytestpillow123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750#!/usr/bin/env python3"""COMPUTATION module — CORE FUNCTION input -> output for Book's Story.
Lane: the app's derived/computed values. SOLE OWNER of jump_kind="value". Everytest feeds an INPUT (a typed search query, opening a record, reaching a settingssheet) and asserts a SPECIFIC value the running original produced — never a valuecomputed here or read from the source.
Ground truth — every value below was OBSERVED on the running original with scratchscripts before it was hard-coded (recon's numbers were partly stale; these are thedevice's own):
Library SEARCH (Library tab, Search icon -> single EditText, live filter; the DB query is LOWER(title) LIKE '%q%' — case-insensitive substring on TITLE only): * "" -> both {testbook, alpha_wonderland}; count badge "2" * "alpha" -> {alpha_wonderland}; badge "1" * "testbook" -> {testbook}; badge "1" * "book" -> {testbook} ONLY (alpha_wonderland's title has no "book") * "wonderland" -> {alpha_wonderland}; badge "1" * "zzz" -> {} (none); badge "0" * type "alpha" then tap "Exit search" -> both restored (round-trip) Library title count badge = number of book cards (2). The "Default" category tab badge tracks the CURRENT filtered count (2 -> 1 -> 0). Book Info (tap a cover) -> progress reads "0%" for a never-opened book. Reader (Start) bottom progress reads "0% (20%)" for testbook page 1 (leading token "0%"; the "(20%)" is this book's chapter fraction). Reader settings sheet ("Reader settings" icon) tabs General/Reader/Colors: * Reader tab: Font size "16pt", Letter spacing "0pt", Size "80%", Corners roundness "8pt". * Colors tab (Color preset "Preset 1"): Background color R/G/B = 250/248/255, Font color R/G/B = 68/70/79.
Depth is REAL: Book Info = 1 (and_reach_book_info), Reader = 2 (and_reach_reader),the reader settings sheet = 3 (and_enter_reader_sheet). Never clear_data() — thelibrary persists across restart_app(); each test opens its own entry point."""import osimport sysimport time
# ADB_PATH / DEVICE_SERIAL / PACKAGE come from the environment the runner exports;# the kit reads them via os.environ / argv. Never bake a serial/package/adb path in.sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,F401import book_fixture as bf # shared, validated import helper
COVER_DESC = "Cover image not found"BOOK1 = bf.BOOK1_TITLE # "testbook"BOOK1_FILE = bf.BOOK1_FILE # "testbook.txt"BOOK2 = bf.BOOK2_TITLE # "alpha_wonderland"BOOK2_FILE = bf.BOOK2_FILE # "alpha_wonderland.txt"
TESTS = []
def _t(fn): TESTS.append(fn) return fn
# ── entry-point helpers ──────────────────────────────────────────────────────
def _reach_library(retries: int = 6) -> bool: """Bring the app to the Library tab with a book visible. Absorbs the launch race (monkey reports foreground a beat before Compose paints).""" wait_for_foreground() for _ in range(retries): bf._open_tab("Library") nodes = ui() if (find_node(nodes, content_desc=COVER_DESC) is not None or find_node(nodes, text=BOOK1) is not None): return True settle("tap") return False
def _ensure_both_books() -> bool: """Idempotent guard: both persisted books present (fast 'already' path).""" ok1, _ = bf.import_book(BOOK1, BOOK1_FILE) ok2, _ = bf.import_book(BOOK2, BOOK2_FILE) return ok1 and ok2
def _library_titles(): """The set of KNOWN book titles currently visible on the Library screen.""" nodes = ui() return {tt for tt in (BOOK1, BOOK2) if find_node(nodes, text=tt) is not None}
def _open_search() -> bool: """From the Library, tap the Search icon and confirm the query field appeared.""" s = find_node(ui(), content_desc="Search") if s is None or not tap_node(s): return False settle("tap") time.sleep(0.8) return len(find_by_class(ui(), "EditText")) > 0
def _search_field(): edits = find_by_class(ui(), "EditText") return edits[0] if edits else None
def _category_badge_value(): """The 'Default' category tab count badge — a digit TextView just right of the 'Default' label (y in the tab strip, x to its right). Returns the string or ''.""" nodes = ui() default = find_node(nodes, text="Default") if default is None: return "" dx1, dy1, dx2, dy2 = default["_bounds"] best = "" for n in nodes: t = n.get("text", "").strip() if not t.isdigit(): continue b = n.get("_bounds") if not b: continue # same row as the Default tab, immediately to its right if abs(b[1] - dy1) < 60 and b[0] >= dx2 - 20: best = t break return best
def _library_title_badge_value(): """The Library screen title's count badge — a digit TextView on the 'Library' title row (top bar), to the right of the 'Library' title text.""" nodes = ui() # The top-bar 'Library' title sits high (y<300); the tab label sits low (y>2200). titles = [n for n in find_nodes(nodes, text="Library") if n.get("_bounds") and n["_bounds"][1] < 400] if not titles: return "" tx1, ty1, tx2, ty2 = titles[0]["_bounds"] for n in nodes: t = n.get("text", "").strip() if not t.isdigit(): continue b = n.get("_bounds") if b and abs(b[1] - ty1) < 80 and b[0] >= tx2 - 20: return t return ""
# ── depth-backing navigation helpers (name-matched by and_audit_depth) ────────
def and_reach_book_info(title=BOOK1) -> bool: """Tap the book's cover and PROVE the jump into Book Info. Backs depth 1.""" nodes = ui() cover = find_node(nodes, content_desc=COVER_DESC) if cover is None: covers = [n for n in nodes if "Cover image" in (n.get("content-desc") or "")] cover = covers[0] if covers else None if cover is None: return False if and_reach_surface(cover, target="Start", source="Continue reading"): return True return find_node(ui(), text="Move") is not None
def and_reach_reader() -> bool: """From Book Info tap Start; confirm reader body text rendered. Backs depth 2 (immersive reader has no reliable pre-cling surface diff, so and_enter).""" start = find_node(ui(), text="Start") or find_node(ui(), text="Continue") if start is None or not tap_node(start): return False settle("launch") time.sleep(1.5) got = find_node(ui(), text="Got it") # one-time immersive cling if got: tap_node(got) settle("tap") and_enter("reader") return find_node(ui(), text="Chapter One") is not None
def and_enter_reader_sheet() -> bool: """From inside the reader, reveal the bars and open the Reader settings sheet. Confirms the sheet's tab row (General/Reader/Colors) appeared. Backs depth 3.""" info = get_screen_info() tap(info["center_x"], info["center_y"]) # toggle bars settle("tap") time.sleep(1) rs = find_node(ui(), content_desc="Reader settings") if rs is None or not tap_node(rs): return False settle("launch") time.sleep(1) nodes = ui() ok = (find_node(nodes, text="Colors") is not None and find_node(nodes, text="Reader") is not None) if ok: and_enter("reader_settings_sheet") return ok
def _open_reader_sheet_tab(tab_text: str) -> bool: """Inside the open Reader settings sheet, switch to a named tab.""" tab = find_node(ui(), text=tab_text) if tab is None or not tap_node(tab): return False settle("tap") time.sleep(0.6) return True
def _label_value_below(section_text: str, suffix_ok=("pt", "%")): """The value label rendered directly BELOW a section header (e.g. '16pt' under 'Font size'). Returns the first suffix-matching TextView whose top is just beneath the header and horizontally aligned with it. '' if not found.""" nodes = ui() header = find_node(nodes, text=section_text) if header is None: return "" hx1, hy1, hx2, hy2 = header["_bounds"] cands = [] for n in nodes: t = n.get("text", "").strip() if not t or not any(t.endswith(s) for s in suffix_ok): continue b = n.get("_bounds") if not b: continue # below the header, left-aligned with it, within a slider block if b[1] >= hy1 and (b[1] - hy2) < 220 and abs(b[0] - hx1) < 80: cands.append((b[1], t)) cands.sort() return cands[0][1] if cands else ""
def _rgb_values_after(section_text: str, n_values=3): """The N numeric slider values rendered after a colour section header (the R, G, B labels under 'Background color' / 'Font color'). Order = top-to-bottom.""" nodes = ui() header = find_node(nodes, text=section_text) if header is None: return [] hy = header["_bounds"][1] vals = [] for n in nodes: t = n.get("text", "").strip() if not (t.isdigit() and 0 <= int(t) <= 255): continue b = n.get("_bounds") if b and b[1] > hy: vals.append((b[1], t)) vals.sort() return [v for _y, v in vals[:n_values]]
def _screenshot(name): p = os.path.join(RESULTS_DIR, "screenshots", f"_computation_{name}.png") screencap(p) return p
# ════════════════════════════════════════════════════════════��═════════════════# 1. Library SEARCH — the cleanest input->output (5 filter cases + round-trip)# ══════════════════════════════════════════════════════════════════════════════
def _run_search_case(name, query, expected_set, expect_str): """Shared body: open Library search, type `query`, assert the visible KNOWN titles equal `expected_set`. A positive/negative pair is baked in — for a single-result query the OTHER book must be ABSENT after being present before.""" if not _ensure_both_books(): record(name, False, "setup_failed: could not ensure both books present", depth=0, jump_kind="value", expect=expect_str) return restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=0, jump_kind="value", expect=expect_str) return before = _library_titles() if not _open_search(): record(name, False, "setup_failed: search field did not open", depth=0, jump_kind="value", expect=expect_str) return field = _search_field() if field is None or not type_text(field, query): record(name, False, "setup_failed: could not type into the search field", depth=0, jump_kind="value", expect=expect_str) return time.sleep(1.2) got = _library_titles() # both books must have been present before we filtered (guards a mis-setup) both_before = before == {BOOK1, BOOK2} ok = both_before and got == expected_set record(name, ok, "" if ok else f"behavior_wrong: query {query!r} left {sorted(got)}, expected " f"{sorted(expected_set)} (before filter: {sorted(before)})", depth=0, jump_kind="value", expect=expect_str)
@_t@and_test(expects=("computation_search_alpha",))def test_search_alpha(): _run_search_case("computation_search_alpha", "alpha", {BOOK2}, "search 'alpha' -> alpha_wonderland only")
@_t@and_test(expects=("computation_search_testbook",))def test_search_testbook(): _run_search_case("computation_search_testbook", "testbook", {BOOK1}, "search 'testbook' -> testbook only")
@_t@and_test(expects=("computation_search_book",))def test_search_book(): # 'book' is a substring of 'testbook' but NOT of 'alpha_wonderland' -> only testbook _run_search_case("computation_search_book", "book", {BOOK1}, "search 'book' -> testbook only (alpha_wonderland excluded)")
@_t@and_test(expects=("computation_search_wonderland",))def test_search_wonderland(): _run_search_case("computation_search_wonderland", "wonderland", {BOOK2}, "search 'wonderland' -> alpha_wonderland only")
@_t@and_test(expects=("computation_search_no_match",))def test_search_no_match(): _run_search_case("computation_search_no_match", "zzz", set(), "search 'zzz' -> no books")
@_t@and_test(expects=("computation_search_clear_restores",))def test_search_clear_restores(): """Round-trip: type 'alpha' (one book), tap 'Exit search', both books return. The OUTPUT set goes {both} -> {one} -> {both}: a positive/negative/positive over the SAME surface.""" name = "computation_search_clear_restores" expect_str = "after 'alpha' then Exit search -> both books restored" if not _ensure_both_books(): record(name, False, "setup_failed: could not ensure both books present", depth=0, jump_kind="value", expect=expect_str) return restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=0, jump_kind="value", expect=expect_str) return if not _open_search(): record(name, False, "setup_failed: search field did not open", depth=0, jump_kind="value", expect=expect_str) return field = _search_field() if field is None or not type_text(field, "alpha"): record(name, False, "setup_failed: could not type into the search field", depth=0, jump_kind="value", expect=expect_str) return time.sleep(1.2) filtered = _library_titles() ex = find_node(ui(), content_desc="Exit search") if ex is None or not tap_node(ex): record(name, False, "behavior_wrong: no 'Exit search' affordance to clear", depth=0, jump_kind="value", expect=expect_str) return settle("tap") time.sleep(1) restored = _library_titles() ok = filtered == {BOOK2} and restored == {BOOK1, BOOK2} record(name, ok, "" if ok else f"behavior_wrong: filtered={sorted(filtered)} then restored=" f"{sorted(restored)}, expected {{alpha_wonderland}} then both", depth=0, jump_kind="value", expect=expect_str)
# ══════════════════════════════════════════════════════════════════════════════# 2. Count badges — a DERIVED value (badge == number of matching book cards)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("computation_library_count_badge",))def test_library_count_badge(): """The Library title badge equals the number of book cards on screen. With the two persisted books it reads '2' and matches the card count we observe — a self-consistent computation, not a constant.""" name = "computation_library_count_badge" if not _ensure_both_books(): record(name, False, "setup_failed: could not ensure both books present", depth=0, jump_kind="value", expect="Library count badge == 2 == #cards") return restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=0, jump_kind="value", expect="Library count badge == 2 == #cards") return nodes = ui() cards = len([n for n in nodes if (n.get("content-desc") or "") == COVER_DESC]) badge = _library_title_badge_value() or _category_badge_value() ok = badge.isdigit() and int(badge) == cards == 2 record(name, ok, "" if ok else f"behavior_wrong: badge={badge!r} but observed {cards} book cards " f"(expected both == '2')", depth=0, jump_kind="value", expect="Library count badge == 2 (== 2 cards)")
@_t@and_test(expects=("computation_search_count_badge",))def test_search_count_badge(): """Search-result count consistency: after typing 'alpha' the 'Default' category badge reads '1' and exactly one known title remains — the badge is the derived count of the filtered set.""" name = "computation_search_count_badge" expect_str = "after 'alpha' the count badge reads '1' (one visible book)" restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=0, jump_kind="value", expect=expect_str) return before_badge = _category_badge_value() if not _open_search(): record(name, False, "setup_failed: search field did not open", depth=0, jump_kind="value", expect=expect_str) return field = _search_field() if field is None or not type_text(field, "alpha"): record(name, False, "setup_failed: could not type into the search field", depth=0, jump_kind="value", expect=expect_str) return time.sleep(1.2) badge = _category_badge_value() visible = _library_titles() ok = before_badge == "2" and badge == "1" and visible == {BOOK2} record(name, ok, "" if ok else f"behavior_wrong: badge {before_badge!r}->{badge!r}, visible " f"{sorted(visible)}; expected '2'->'1' with only alpha_wonderland", depth=0, jump_kind="value", expect=expect_str)
# ══════════════════════════════════════════════════════════════════════════════# 3. Book Info progress value (depth 1)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("computation_book_info_progress",))def test_book_info_progress(): """A never-opened book reads 0% on its Book Info screen — the app's derived reading-progress value. Depth 1, backed by and_reach_book_info.""" name = "computation_book_info_progress" expect_str = "Book Info progress reads '0%'" restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=1, jump_kind="value", expect=expect_str) return if not and_reach_book_info(BOOK1): record(name, False, "setup_failed: could not open Book Info", depth=1, jump_kind="value", expect=expect_str) return nodes = ui() # the progress value is a TextView ending in '%' on the Book Info header pct = "" for n in nodes: t = n.get("text", "").strip() if t.endswith("%") and t[:-1].strip().replace(".", "").isdigit(): pct = t break ok = pct.replace(" ", "") == "0%" record(name, ok, "" if ok else f"behavior_wrong: Book Info progress reads {pct!r}, expected '0%'", depth=1, jump_kind="value", expect=expect_str)
# ══════════════════════════════════════════════════════════════════════════════# 4. Reader progress readout (depth 2)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("computation_reader_progress",))def test_reader_progress(): """The reader's bottom progress readout is a COMPUTED string: bookProgress% + ' (chapterProgress%)'. For testbook page 1 it reads '0% (20%)'. We assert the full observed string, then (fallback) the stable leading '0%' token. Depth 2.""" name = "computation_reader_progress" expect_str = "reader progress reads '0% (20%)' (leading '0%')" restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=2, jump_kind="value", expect=expect_str) return if not and_reach_book_info(BOOK1): record(name, False, "setup_failed: could not open Book Info", depth=1, jump_kind="value", expect=expect_str) return if not and_reach_reader(): record(name, False, "setup_failed: reader did not render book text", depth=2, jump_kind="value", expect=expect_str) return # reveal the bars, then read the bottom progress TextView info = get_screen_info() tap(info["center_x"], info["center_y"]) settle("tap") time.sleep(1) nodes = ui() progress = "" for n in nodes: t = n.get("text", "").strip() b = n.get("_bounds") # the progress readout is a lone '..%..' TextView low on screen if b and b[1] > info["height"] * 0.8 and "%" in t and "(" in t: progress = t break if not progress: # fallback: any low TextView containing a leading percentage for n in nodes: t = n.get("text", "").strip() b = n.get("_bounds") if b and b[1] > info["height"] * 0.8 and t.replace(" ", "").startswith("0%"): progress = t break norm = progress.replace(" ", "") ok = norm == "0%(20%)" or norm.startswith("0%") record(name, ok, "" if ok else f"behavior_wrong: reader progress reads {progress!r}, expected " f"'0% (20%)' (or a leading '0%')", depth=2, jump_kind="value", expect=expect_str)
# ══════════════════════════════════════════════════════════════════════════════# 5. Reader settings sheet — computed value LABELS (depth 3, Reader tab)# ══════════════════════════════════════════════════════════════════════════════
def _reach_reader_settings_tab(tab_text): """Full path to a named tab of the reader settings sheet. Returns True with the sheet open on `tab_text`, else False. Crosses Library->BookInfo->Reader->Sheet.""" if not _reach_library(): return False if not and_reach_book_info(BOOK1): return False if not and_reach_reader(): return False if not and_enter_reader_sheet(): return False return _open_reader_sheet_tab(tab_text)
def _run_reader_label_case(name, section, expected, expect_str, scrolls=3): """Open the reader sheet's Reader tab, scroll to `section`, assert its value label. Depth 3 throughout (backed by the and_reach_/and_enter_ chain).""" restart_app() if not _reach_reader_settings_tab("Reader"): record(name, False, "setup_failed: could not reach the reader settings 'Reader' tab", depth=3, jump_kind="value", expect=expect_str) return # scroll the sheet until the section header is on screen found = find_node(ui(), text=section) is not None for _ in range(scrolls): if found: break scroll_down(0.5) time.sleep(0.4) found = find_node(ui(), text=section) is not None if not found: record(name, False, f"setup_failed: '{section}' not found in the Reader tab", depth=3, jump_kind="value", expect=expect_str) return val = _label_value_below(section) ok = val.replace(" ", "") == expected record(name, ok, "" if ok else f"behavior_wrong: '{section}' value reads {val!r}, expected {expected!r}", depth=3, jump_kind="value", expect=expect_str)
@_t@and_test(expects=("computation_font_size_label",))def test_font_size_label(): _run_reader_label_case("computation_font_size_label", "Font size", "16pt", "reader 'Font size' value label reads '16pt'")
@_t@and_test(expects=("computation_letter_spacing_label",))def test_letter_spacing_label(): _run_reader_label_case("computation_letter_spacing_label", "Letter spacing", "0pt", "reader 'Letter spacing' value label reads '0pt'")
@_t@and_test(expects=("computation_size_percent_label",))def test_size_percent_label(): _run_reader_label_case("computation_size_percent_label", "Size", "80%", "reader 'Size' value label reads '80%'")
# ══════════════════════════════════════════════════════════════════════════════# 6. Reader settings Colors tab — RGB numeric values + rendered reader colours# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("computation_bg_color_red",))def test_background_color_red(): """The Colors tab shows the Background colour as three stored channel values R/G/B = 250/248/255 for 'Preset 1'. We assert the Red channel == '250' — a value the app computes/stores, read out of the slider label. Depth 3.""" name = "computation_bg_color_red" expect_str = "Background color Red channel reads '250'" restart_app() if not _reach_reader_settings_tab("Colors"): record(name, False, "setup_failed: could not reach the reader settings 'Colors' tab", depth=3, jump_kind="value", expect=expect_str) return # scroll to the Background color section if needed for _ in range(3): if find_node(ui(), text="Background color") is not None: break scroll_down(0.4) time.sleep(0.4) vals = _rgb_values_after("Background color", 3) red = vals[0] if vals else "" ok = red == "250" record(name, ok, "" if ok else f"behavior_wrong: Background R reads {red!r} (all={vals}), expected '250'", depth=3, jump_kind="value", expect=expect_str)
@_t@and_test(expects=("computation_font_color_red",))def test_font_color_red(): """The Font colour's first stored channel R == '68' for 'Preset 1'. A distinct computed value from the background, read out of its slider label. Depth 3.""" name = "computation_font_color_red" expect_str = "Font color Red channel reads '68'" restart_app() if not _reach_reader_settings_tab("Colors"): record(name, False, "setup_failed: could not reach the reader settings 'Colors' tab", depth=3, jump_kind="value", expect=expect_str) return # The 'Font color' section sits low; its header must be scrolled into the # UPPER half so its three R/G/B digit labels are actually on-screen below it # (when the header is near the bottom, the digits are clipped off and read ''). half = get_screen_info()["height"] * 0.55 for _ in range(8): fc = find_node(ui(), text="Font color") if fc is not None and fc["_bounds"][1] < half: break scroll_down(0.4) time.sleep(0.4) vals = _rgb_values_after("Font color", 3) red = vals[0] if vals else "" ok = red == "68" record(name, ok, "" if ok else f"behavior_wrong: Font R reads {red!r} (all={vals}), expected '68'", depth=3, jump_kind="value", expect=expect_str)
# ── VLM (exactly 3, all tag='color') — the RGB NUMBER is dump-readable but the# rendered reader page and text colours are not; each question a blank screen# fails. ────────────────────────────────────────────────────────────────────
@_t@and_test(expects=("computation_bg_swatch_vlm",))def test_background_swatch_vlm(): """The Background colour (R/G/B=250/248/255) renders as a near-white/very-pale reader page — the rendered hue, not the number.""" name = "computation_bg_swatch_vlm" restart_app() if not _reach_reader_settings_tab("Colors"): record(name, False, "setup_failed: could not reach the Colors tab", depth=3, jump_kind="none", tag="color") return for _ in range(3): if find_node(ui(), text="Background color") is not None: break scroll_down(0.4) time.sleep(0.4) _screenshot("bg_swatch") vlm_assert( "computation_bg_swatch", "In the visible 'Chapter One' reader area above the colour settings panel, " "is the page background rendered white or a very pale/near-white shade " "rather than a dark or saturated colour?", RESULTS_DIR, expect="YES", depth=3, jump_kind="none", tag="color")
@_t@and_test(expects=("computation_font_swatch_vlm",))def test_font_swatch_vlm(): """The Font colour (R/G/B=68/70/79) renders as dark/near-black reader text, visibly distinct from the pale page background.""" name = "computation_font_swatch_vlm" restart_app() if not _reach_reader_settings_tab("Colors"): record(name, False, "setup_failed: could not reach the Colors tab", depth=3, jump_kind="none", tag="color") return for _ in range(4): if find_node(ui(), text="Font color") is not None: break scroll_down(0.5) time.sleep(0.4) _screenshot("font_swatch") vlm_assert( "computation_font_swatch", "In the visible 'Chapter One' reader area above the colour settings panel, " "is the body text rendered dark gray or near-black rather than white or " "another pale shade?", RESULTS_DIR, expect="YES", depth=3, jump_kind="none", tag="color")
@_t@and_test(expects=("computation_swatches_differ_vlm",))def test_swatches_differ_vlm(): """The pale page and dark font render with clear readable contrast — a visual property the RGB values in the accessibility dump alone cannot confirm.""" name = "computation_swatches_differ_vlm" restart_app() if not _reach_reader_settings_tab("Colors"): record(name, False, "setup_failed: could not reach the Colors tab", depth=3, jump_kind="none", tag="color") return # position so both the Background and Font colour sections are visible together for _ in range(2): if find_node(ui(), text="Font color") is not None: break scroll_down(0.4) time.sleep(0.4) _screenshot("swatches_differ") vlm_assert( "computation_swatches_differ", "In the visible 'Chapter One' reader area above the colour settings panel, " "is there clear dark-text-on-light-background contrast that makes the title " "and body text visibly readable?", RESULTS_DIR, expect="YES", depth=3, jump_kind="none", tag="color")
if __name__ == "__main__": if not device_online(): print("Device offline — aborting (a whole module of setup_failed would be " "misattributed to the app).") sys.exit(2) run_suite(TESTS, "computation")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680#!/usr/bin/env python3"""INTERACTION module — effect-by-consequence on user DATA for Book's Story.
Lane: CRUD lifecycle, multi-step data sequences, multi-record integrity, DATApersistence across process death, and long-press / context menus (sole owner).
Ground truth (all verified on the running original before authoring): * Library shows two persisted book cards: "testbook" and "alpha_wonderland". Cover card has content-desc "Cover image not found"; count badge "2". * Long-press a cover -> selection mode: "1 selected" + actions "Select all books" / "Move selected books" / "Delete selected books" and "Clear selected items". (We assert they EXIST; we never tap Delete.) * Tap a cover -> Book Info: title, "Author"/"Unknown", "0%", "Move"/"Delete", "No description.", "Start", top-bar "Go back"/"File details". * Book Info "Start" -> Reader renders body text "Chapter One" + "The quick brown fox jumps over the lazy dog." in the view tree. * Reading a book creates a History entry: group "Today", "testbook", HH:MM, per-row "Delete history element". * Book Info "Move" -> a category-move sheet ("Move" / "No categories." / "Edit" / "Cancel" / "OK"); we open it then Cancel (no destructive commit). * Imported books + reading history SURVIVE force_stop_and_relaunch() (process death) — the recreation-killing persistence probe.
We do NOT clear_data() (it wipes the folder grant -> ~2min re-import); every testopens its own entry point via restart_app()/force_stop_and_relaunch(), which thelibrary survives. The one CREATE test rides book_fixture.import_book()'s idempotent"already" path: the book is a real persisted record either way."""import osimport sysimport time
# ADB_PATH / DEVICE_SERIAL / PACKAGE are supplied by the environment the runner# exports (the kit reads them via os.environ / argv). We never bake a serial,# package, or adb path into the source — the same file scores the recreation.sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,F401import book_fixture as bf # shared, validated import helper
COVER_DESC = "Cover image not found" # every book cover carries this descBOOK1 = bf.BOOK1_TITLE # "testbook"BOOK1_FILE = bf.BOOK1_FILE # "testbook.txt"BOOK2 = bf.BOOK2_TITLE # "alpha_wonderland"
# ── local helpers ───────────────────────────────────────────────────────────# The monkey launch occasionally reports the package foregrounded a beat before# the Compose Library has actually painted, so every entry point re-verifies the# Library surface with a short retry instead of trusting a single dump.
def _reach_library(retries: int = 6) -> bool: """Bring the app to the Library tab with a book visible. Returns True once a cover is on screen. Absorbs the launch race without any fixed sleep loop.""" wait_for_foreground() for _ in range(retries): bf._open_tab("Library") nodes = ui() if (find_node(nodes, content_desc=COVER_DESC) is not None or find_node(nodes, text=BOOK1) is not None): return True settle("tap") return False
def and_reach_book_info(title=BOOK1): """Tap the book's cover and confirm we crossed into Book Info. Backs a depth claim via its and_reach_* name AND an and_reach() surface proof.""" nodes = ui() cover = find_node(nodes, content_desc=COVER_DESC) if cover is None: covers = [n for n in nodes if "Cover image" in (n.get("content-desc") or "")] cover = covers[0] if covers else None if cover is None: return False # Book Info's "Start"/"Move" appear and the Library's "Continue reading" # affordance disappears -> a real surface jump. if and_reach_surface(cover, target="Start", source="Continue reading"): return True # Fallback: some builds label the primary action "Continue"; still a jump if # Book Info's "Move" surfaced. nodes = ui() return find_node(nodes, text="Move") is not None
def and_reach_reader(): """From Book Info, tap Start and confirm the reader body text rendered. Counts one surface via and_enter (the reader is immersive, so a plain and_reach_surface proof is not always available before the cling clears).""" nodes = ui() start = find_node(nodes, text="Start") or find_node(nodes, text="Continue") if start is None or not tap_node(start): return False settle("launch") time.sleep(1.5) got = find_node(ui(), text="Got it") # one-time immersive cling if got: tap_node(got) settle("tap") and_enter("reader") nodes = ui() return find_node(nodes, text="Chapter One") is not None
def _leave_reader_to_history(): """Pop out of the reader back through Book Info and open the History tab.""" back() # reader -> book info settle("tap") time.sleep(1) nodes = ui() gb = find_node(nodes, content_desc="Go back") if gb: tap_node(gb) # book info -> library settle("tap") bf._open_tab("History") settle("tap") time.sleep(1)
def _screenshot(): """Capture the current screen to a scratch path (reused before each VLM ask).""" p = os.path.join(RESULTS_DIR, "screenshots", "_interaction_scratch.png") screencap(p) return p
TESTS = []
def _t(fn): TESTS.append(fn) return fn
# ══════════════════════════════════════════════════════════════════════════════# 1. DATA persistence across process death — the marquee, recreation-killing test# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("interaction_book_survives_process_death",))def test_book_survives_process_death(): """testbook is in the Library -> kill the PROCESS -> still in the Library. An in-memory-only recreation loses the record here.""" restart_app() if not _reach_library(): record("interaction_book_survives_process_death", False, "setup_failed: Library never showed a book to probe", depth=0, jump_kind="transition", expect=f"{BOOK1!r} present before and after process death") return present_before = find_node(ui(), text=BOOK1) is not None force_stop_and_relaunch() reached = _reach_library() present_after = reached and find_node(ui(), text=BOOK1) is not None ok = present_before and present_after record("interaction_book_survives_process_death", ok, "" if ok else "behavior_wrong: book record did not survive process death", depth=0, jump_kind="transition", expect=f"{BOOK1!r} present before (True) and after force_stop_and_relaunch (True)")
@_t@and_test(expects=("interaction_book_survives_process_death_vlm",))def test_book_survives_process_death_vlm(): """After process death + relaunch, the Library still RENDERS the book card.""" force_stop_and_relaunch() if not _reach_library(): record("interaction_book_survives_process_death_vlm", False, "setup_failed: Library not reachable after relaunch", depth=0, jump_kind="none", tag="layout") return _screenshot() vlm_assert( "interaction_book_survives_process_death", "After relaunching the app, does the Library screen still show at least " "one book card (a cover tile with a title label beneath it)?", RESULTS_DIR, expect="YES", depth=0, jump_kind="none", tag="layout")
@_t@and_test(expects=("interaction_second_book_survives_process_death",))def test_second_book_survives_process_death(): """The SECOND distinct record (alpha_wonderland) also survives process death — proves persistence stores every row, not just the first.""" restart_app() if not _reach_library(): record("interaction_second_book_survives_process_death", False, "setup_failed: Library never showed books to probe", depth=0, jump_kind="transition", expect=f"{BOOK2!r} present before and after process death") return present_before = find_node(ui(), text=BOOK2) is not None force_stop_and_relaunch() present_after = _reach_library() and find_node(ui(), text=BOOK2) is not None ok = present_before and present_after record("interaction_second_book_survives_process_death", ok, "" if ok else "behavior_wrong: second book record lost across process death", depth=0, jump_kind="transition", expect=f"{BOOK2!r} present before (True) and after force_stop_and_relaunch (True)")
@_t@and_test(expects=("interaction_history_survives_process_death",))def test_history_survives_process_death(): """Reading data persists: open the reader (creating/refreshing a History entry), kill the process, and the "testbook" History entry is still there. A 3+ step data sequence whose product must survive process death.""" restart_app() if not _reach_library(): record("interaction_history_survives_process_death", False, "setup_failed: Library not reachable", depth=1, jump_kind="transition", expect=f"History entry for {BOOK1!r} present after process death") return if not and_reach_book_info(BOOK1): record("interaction_history_survives_process_death", False, "setup_failed: could not open Book Info to reach the reader", depth=1, jump_kind="transition", expect=f"History entry for {BOOK1!r} present after process death") return if not and_reach_reader(): record("interaction_history_survives_process_death", False, "setup_failed: reader did not open (no book text rendered)", depth=2, jump_kind="transition", expect=f"History entry for {BOOK1!r} present after process death") return # Kill the process, relaunch, and read the History tab back out. force_stop_and_relaunch() if not _reach_library(): record("interaction_history_survives_process_death", False, "setup_failed: app not reachable after relaunch", depth=1, jump_kind="transition", expect=f"History entry for {BOOK1!r} present after process death") return bf._open_tab("History") settle("tap") time.sleep(1) entry = find_node(ui(), text=BOOK1) is not None record("interaction_history_survives_process_death", entry, "" if entry else "behavior_wrong: reading-history entry lost across process death", depth=1, jump_kind="transition", expect=f"History row {BOOK1!r} present after force_stop_and_relaunch")
# ══════════════════════════════════════════════════════════════════════════════# 2. Long-press -> selection mode / context menu (SOLE OWNER of long-press)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("interaction_longpress_enters_selection",))def test_longpress_enters_selection_mode(): """Long-press a book cover -> selection mode: "1 selected" appears and the normal top bar ("Library" title / Search) gives way to selection actions.""" restart_app() if not _reach_library(): record("interaction_longpress_enters_selection", False, "setup_failed: Library not reachable", depth=0, jump_kind="transition", expect="'1 selected' shown after long-press") return nodes = ui() absent_before = find_node(nodes, text="1 selected") is None cover = find_node(nodes, content_desc=COVER_DESC) if cover is None or not long_press(cover): record("interaction_longpress_enters_selection", False, "feature_missing: no long-pressable book cover", depth=0, jump_kind="transition", expect="'1 selected' shown after long-press") return present_after = find_node(ui(), text="1 selected") is not None ok = absent_before and present_after record("interaction_longpress_enters_selection", ok, "" if ok else "behavior_wrong: long-press did not enter selection mode", depth=0, jump_kind="transition", expect="'1 selected' absent before long-press, present after")
@_t@and_test(expects=("interaction_longpress_selection_actions",))def test_longpress_selection_actions_present(): """Selection mode exposes the context actions Select-all / Move / Delete. We assert all three EXIST (proving a real multi-select menu) but never tap the destructive one.""" restart_app() if not _reach_library(): record("interaction_longpress_selection_actions", False, "setup_failed: Library not reachable", depth=0, jump_kind="transition", expect="Select all / Move / Delete actions in selection mode") return cover = find_node(ui(), content_desc=COVER_DESC) if cover is None or not long_press(cover): record("interaction_longpress_selection_actions", False, "feature_missing: no long-pressable book cover", depth=0, jump_kind="transition", expect="Select all / Move / Delete actions in selection mode") return nodes = ui() select_all = find_node(nodes, content_desc="Select all books") is not None move = find_node(nodes, content_desc="Move selected books") is not None delete = find_node(nodes, content_desc="Delete selected books") is not None ok = select_all and move and delete record("interaction_longpress_selection_actions", ok, "" if ok else "behavior_wrong: selection-mode context actions missing", depth=0, jump_kind="transition", expect="content-desc 'Select all books' + 'Move selected books' + 'Delete selected books' all present")
@_t@and_test(expects=("interaction_longpress_selection_vlm",))def test_longpress_selection_vlm(): """The long-pressed cover renders a selected/checked overlay (a visual mark that distinguishes the chosen tile from the unselected one).""" restart_app() if not _reach_library(): record("interaction_longpress_selection_vlm", False, "setup_failed: Library not reachable", depth=0, jump_kind="none", tag="shape") return cover = find_node(ui(), content_desc=COVER_DESC) if cover is None or not long_press(cover): record("interaction_longpress_selection_vlm", False, "feature_missing: no long-pressable book cover", depth=0, jump_kind="none", tag="shape") return _screenshot() vlm_assert( "interaction_longpress_selection", "One of the book covers is now selected. Does exactly one book cover show " "a selection indicator on it (a check mark or a highlighted/outlined " "overlay) that the other cover does not have?", RESULTS_DIR, expect="YES", depth=0, jump_kind="none", tag="shape")
@_t@and_test(expects=("interaction_clear_selection_exits",))def test_clear_selection_exits_mode(): """Multi-step: enter selection mode, then tap "Clear selected items" and confirm the mode exits ("1 selected" is gone, the Library title returns).""" restart_app() if not _reach_library(): record("interaction_clear_selection_exits", False, "setup_failed: Library not reachable", depth=0, jump_kind="transition", expect="selection mode exits after Clear selected items") return cover = find_node(ui(), content_desc=COVER_DESC) if cover is None or not long_press(cover): record("interaction_clear_selection_exits", False, "feature_missing: no long-pressable book cover", depth=0, jump_kind="transition", expect="selection mode exits after Clear selected items") return nodes = ui() in_selection = find_node(nodes, text="1 selected") is not None clear = find_node(nodes, content_desc="Clear selected items") if clear is None or not tap_node(clear): record("interaction_clear_selection_exits", False, "behavior_wrong: no 'Clear selected items' control in selection mode", depth=0, jump_kind="transition", expect="selection mode exits after Clear selected items") return exited = find_node(ui(), text="1 selected") is None ok = in_selection and exited record("interaction_clear_selection_exits", ok, "" if ok else "behavior_wrong: selection mode did not exit after clearing", depth=0, jump_kind="transition", expect="'1 selected' present in selection mode, absent after Clear selected items")
# ══════════════════════════════════════════════════════════════════════════════# 3. Reading creates a History record — multi-step data-producing sequence# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("interaction_reading_creates_history",))def test_reading_creates_history_entry(): """4-step sequence: Library -> Book Info -> Reader (renders text) -> back -> History tab shows a "testbook" row under "Today". Each step depends on the prior; a dead shell that echoes step one cannot produce the History row.""" restart_app() if not _reach_library(): record("interaction_reading_creates_history", False, "setup_failed: Library not reachable", depth=1, jump_kind="transition", expect=f"History row {BOOK1!r} under 'Today' after reading") return if not and_reach_book_info(BOOK1): record("interaction_reading_creates_history", False, "setup_failed: could not open Book Info", depth=1, jump_kind="transition", expect=f"History row {BOOK1!r} under 'Today' after reading") return if not and_reach_reader(): record("interaction_reading_creates_history", False, "setup_failed: reader did not render book text", depth=2, jump_kind="transition", expect=f"History row {BOOK1!r} under 'Today' after reading") return _leave_reader_to_history() nodes = ui() entry = find_node(nodes, text=BOOK1) is not None today = find_node(nodes, text="Today") is not None ok = entry and today record("interaction_reading_creates_history", ok, "" if ok else "behavior_wrong: reading did not produce a History entry", depth=1, jump_kind="transition", expect=f"'Today' group + History row {BOOK1!r} present after reading")
@_t@and_test(expects=("interaction_history_entry_vlm",))def test_history_entry_vlm(): """The History screen renders the entry as a row with a cover thumbnail on the left and a timestamp — a laid-out history record, not bare text.""" restart_app() if not _reach_library(): record("interaction_history_entry_vlm", False, "setup_failed: Library not reachable", depth=1, jump_kind="none", tag="layout") return if not (and_reach_book_info(BOOK1) and and_reach_reader()): record("interaction_history_entry_vlm", False, "setup_failed: could not read a book to populate History", depth=2, jump_kind="none", tag="layout") return _leave_reader_to_history() _screenshot() vlm_assert( "interaction_history_entry", "This is a reading-history screen. Is there a list row that shows a small " "book cover thumbnail on the left with a book title and a time (HH:MM) " "beside it?", RESULTS_DIR, expect="YES", depth=1, jump_kind="none", tag="layout")
# ══════════════════════════════════════════════════════════════════════════════# 4. Multi-record integrity — both distinct records coexist and are ordered# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("interaction_multi_record_integrity",))def test_multi_record_integrity(): """Both distinct records coexist in the Library simultaneously and keep their left-to-right order (testbook before alpha_wonderland). Catches a recreation that keeps only one row or drops one on a re-render.""" # A controlled CREATE via the idempotent import helper: the book is a real # persisted record whether it was already present or freshly added. ok1, note1 = bf.import_book(BOOK1, BOOK1_FILE) ok2, note2 = bf.import_book(BOOK2, bf.BOOK2_FILE) if not (ok1 and ok2): record("interaction_multi_record_integrity", False, f"setup_failed: import did not yield both records ({note1}/{note2})", depth=0, jump_kind="value", expect=f"both {BOOK1!r} and {BOOK2!r} present and ordered") return if not _reach_library(): record("interaction_multi_record_integrity", False, "setup_failed: Library not reachable", depth=0, jump_kind="value", expect=f"both {BOOK1!r} and {BOOK2!r} present and ordered") return nodes = ui() n1 = find_node(nodes, text=BOOK1) n2 = find_node(nodes, text=BOOK2) both = n1 is not None and n2 is not None ordered = False if both: # testbook's card sits left of (or above) alpha_wonderland's. y1, y2 = n1["_bounds"][1], n2["_bounds"][1] x1, x2 = n1["_bounds"][0], n2["_bounds"][0] ordered = (y1, x1) < (y2, x2) ok = both and ordered record("interaction_multi_record_integrity", ok, "" if ok else "behavior_wrong: the two book records do not coexist in order", depth=0, jump_kind="value", expect=f"{BOOK1!r} present and ordered before {BOOK2!r} in the same Library")
@_t@and_test(expects=("interaction_multi_record_survives_death",))def test_both_records_survive_process_death(): """Multi-record persistence: BOTH records are present, then a single process death leaves BOTH intact — the strongest discriminator against an in-memory recreation that could fake one row.""" restart_app() if not _reach_library(): record("interaction_multi_record_survives_death", False, "setup_failed: Library not reachable", depth=0, jump_kind="transition", expect=f"both {BOOK1!r} and {BOOK2!r} present after process death") return nodes = ui() before = (find_node(nodes, text=BOOK1) is not None and find_node(nodes, text=BOOK2) is not None) force_stop_and_relaunch() after = False if _reach_library(): nodes = ui() after = (find_node(nodes, text=BOOK1) is not None and find_node(nodes, text=BOOK2) is not None) ok = before and after record("interaction_multi_record_survives_death", ok, "" if ok else "behavior_wrong: not both records survived process death", depth=0, jump_kind="transition", expect=f"both {BOOK1!r} and {BOOK2!r} present before (True) and after death (True)")
@_t@and_test(expects=("interaction_library_two_cards_vlm",))def test_library_two_cards_vlm(): """The populated Library visibly renders TWO distinct book cards side by side — a layout consequence of the two coexisting records.""" restart_app() if not _reach_library(): record("interaction_library_two_cards_vlm", False, "setup_failed: Library not reachable", depth=0, jump_kind="none", tag="layout") return _screenshot() vlm_assert( "interaction_library_two_cards", "How many distinct book cards (each a cover tile with its own title label) " "are shown in this library grid? Answer YES only if there are exactly two.", RESULTS_DIR, expect="YES", depth=0, jump_kind="none", tag="layout")
# ══════════════════════════════════════════════════════════════════════════════# 5. Book Info — reader open sequence + Move sheet (data-adjacent interaction)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("interaction_open_reader_shows_text",))def test_open_reader_shows_body_text(): """Multi-step read path: Library -> Book Info -> Start -> the reader renders this book's actual body TEXT. We assert the specific opening content ("Chapter One" + the opening sentence) — a value read out of the record, not a title echoed back. Depth is backed by the and_reach_* navigation helpers; the assertion is jump_kind=value because we name the exact rendered content.""" restart_app() if not _reach_library(): record("interaction_open_reader_shows_text", False, "setup_failed: Library not reachable", depth=2, jump_kind="value", expect="reader body shows 'Chapter One' + 'The quick brown fox' text") return if not and_reach_book_info(BOOK1): record("interaction_open_reader_shows_text", False, "setup_failed: could not open Book Info", depth=1, jump_kind="value", expect="reader body shows 'Chapter One' + 'The quick brown fox' text") return if not and_reach_reader(): record("interaction_open_reader_shows_text", False, "behavior_wrong: reader did not render the book's body text", depth=2, jump_kind="value", expect="reader body shows 'Chapter One' + 'The quick brown fox' text") return nodes = ui() heading = find_node(nodes, text="Chapter One") is not None # The opening paragraph is a long TextView; match its distinctive prefix. opener = any("The quick brown fox" in (n.get("text", "") or "") for n in nodes) ok = heading and opener record("interaction_open_reader_shows_text", ok, "" if ok else "behavior_wrong: reader body text did not match the book's content", depth=2, jump_kind="value", expect="reader shows 'Chapter One' heading and 'The quick brown fox' opening sentence")
@_t@and_test(expects=("interaction_reader_page_vlm",))def test_reader_page_vlm(): """The reader renders a full page of body text with margins — a laid-out reading page, not an empty or error screen.""" restart_app() if not _reach_library(): record("interaction_reader_page_vlm", False, "setup_failed: Library not reachable", depth=2, jump_kind="none", tag="layout") return if not (and_reach_book_info(BOOK1) and and_reach_reader()): record("interaction_reader_page_vlm", False, "setup_failed: reader did not open", depth=2, jump_kind="none", tag="layout") return _screenshot() vlm_assert( "interaction_reader_page", "Is this screen showing a page of readable book text (multiple lines/" "paragraphs of body text with margins), rather than an empty screen, a " "list, or a dialog?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="layout")
@_t@and_test(expects=("interaction_move_sheet_opens",))def test_book_info_move_sheet_opens_and_cancels(): """Data-adjacent context action: Book Info "Move" opens a category-move sheet (title "Move" + Cancel/OK). We open it, assert the sheet, then Cancel — never committing a destructive change.""" restart_app() if not _reach_library(): record("interaction_move_sheet_opens", False, "setup_failed: Library not reachable", depth=1, jump_kind="transition", expect="Move sheet (Cancel/OK) appears then closes") return if not and_reach_book_info(BOOK1): record("interaction_move_sheet_opens", False, "setup_failed: could not open Book Info", depth=1, jump_kind="transition", expect="Move sheet (Cancel/OK) appears then closes") return nodes = ui() move = find_node(nodes, text="Move") if move is None or not is_safe(move) or not tap_node(move): record("interaction_move_sheet_opens", False, "feature_missing: no Move control on Book Info", depth=1, jump_kind="transition", expect="Move sheet (Cancel/OK) appears then closes") return settle("launch") nodes = ui() # The move sheet is identified by its Cancel+OK pair (its title "Move" also # exists on Book Info, so require the sheet's buttons too). sheet = (find_node(nodes, text="Cancel") is not None and find_node(nodes, text="OK") is not None) # Back out non-destructively via Cancel. cancel = find_node(nodes, text="Cancel") closed = False if cancel and tap_node(cancel): settle("tap") closed = find_node(ui(), text="OK") is None ok = sheet and closed record("interaction_move_sheet_opens", ok, "" if ok else "behavior_wrong: Move did not open a cancellable category sheet", depth=1, jump_kind="transition", expect="Cancel+OK move sheet present after Move, gone after Cancel")
@_t@and_test(expects=("interaction_book_info_actions_vlm",))def test_book_info_actions_vlm(): """Book Info renders the record with its Move and Delete action buttons — the per-record management surface for this book.""" restart_app() if not _reach_library(): record("interaction_book_info_actions_vlm", False, "setup_failed: Library not reachable", depth=1, jump_kind="none", tag="layout") return if not and_reach_book_info(BOOK1): record("interaction_book_info_actions_vlm", False, "setup_failed: could not open Book Info", depth=1, jump_kind="none", tag="layout") return _screenshot() vlm_assert( "interaction_book_info_actions", "This is a book-detail screen. Does it show the book's title near the top " "and two labelled action buttons reading 'Move' and 'Delete'?", RESULTS_DIR, expect="YES", depth=1, jump_kind="none", tag="layout")
if __name__ == "__main__": if not device_online(): print("Device offline — aborting (a whole module of setup_failed would be " "misattributed to the app).") sys.exit(2) run_suite(TESTS, "interaction")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650"""Navigation lane for Book's Story (ebook reader).
This module owns SURFACE REACHABILITY and BACK-STACK INTEGRITY: tapping a navtrigger (tab, bottom-sheet row, cover, toolbar icon) lands on the intendedCompose surface, and BACK unwinds the stack hop by hop. It is the SOLE owner ofjump_kind="reach" and of the deep (depth>=2) chains; every jump is proven withand_reach* — the TARGET surface's discriminating element APPEARED *and* theSOURCE surface's element DISAPPEARED (a flat-tree element that was there allalong cannot fake a reach).
Every target/source string below was observed on the RUNNING original app withscratch probes before being committed here (e.g. Settings->Appearance shows"Dark theme" and drops "Reset start guide"; BookInfo->Reader shows "Chapter One"and drops "Start"; About->Credits shows "Tachiyomi (Mihon)" and drops"App version"). Contributors is intentionally NOT tested as an in-app reach: onthe original it launches the external Chrome browser (not an in-app surface), soit is unobservable as navigation.
A real book (title "testbook") is imported once via the shared book_fixturehelper (never inlined); the kit pushes the fixture bytes before the first testvia run_suite(). Toggles/rows in this Jetpack-Compose app are android.view.Viewwith content-desc, and resource-id is almost always empty, so matching is byclass + text + content-desc, never by full class path or package prefix."""import osimport sysimport time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,F401import book_fixture as bf # shared import-a-book helper
RESULTS_DIR = sys.argv[2] if len(sys.argv) > 2 else os.path.dirname( os.path.abspath(__file__))
BOOK = bf.BOOK1_TITLE # "testbook"
# ══════════════════════════════════════════════════════════════════════════════# Local helpers — entry points and file-local depth-family shims. The and_enter*/# and_reach* NAME is what the depth audit looks for; each wraps the kit's proven# and_reach_surface so the verdict stays honest.# ══════════════════════════════════════════════════════════════════════════════
def _open_library(): """Cold-restart into the Library tab. Returns the node list.""" restart_app() wait_for_foreground() time.sleep(1) bf._open_tab("Library") return ui()
def _cover(nodes): """The Library book-cover card (icon-only, content-desc 'Cover image ...').""" n = find_node(nodes, content_desc="Cover image not found") if n: return n covers = [x for x in nodes if "Cover image" in (x.get("content-desc") or "")] return covers[0] if covers else None
def _open_more_sheet(nodes): """Library ▸ More: tap the More toolbar icon; return True once the sheet's 'Settings' row shows.""" more = find_node(nodes, content_desc="More") if not more or not tap_node(more): return False settle("tap") return find_node(ui(), text="Settings") is not None
_BROWSE_SURFACE_TARGETS = ( "/storage/emulated/0/Download/Books", "Set up scanning",)
def _reach_browse(node, source: str) -> str | None: """Reach Browse whether its scanned files are still pending or imported.
Browse hides files already present in Library. Once both shared fixtures have been imported, the valid reference UI is therefore the Browse empty state (``Set up scanning``), not the scanned-folder header. Return the marker that actually appeared so a following jump can prove it vanished. """ before = and_showing() if not tap_node(node): return None for _ in range(8): after = and_showing() for target in _BROWSE_SURFACE_TARGETS: if and_reach(before, after, target, source): and_enter(target) return target time.sleep(0.5) return None
def and_reach_more_sheet(nodes): """Library ▸ More: open the More sheet, counting one surface via the kit's reach verdict (sheet row 'Settings' appears; toolbar 'Filter' leaves).""" more = find_node(nodes, content_desc="More") return bool(more) and and_reach_surface(more, "Settings", "Filter")
def and_reach_settings(nodes): """From the OPEN More sheet, tap Settings -> Settings root (title row 'Reset start guide' appears; sheet row 'About app' leaves).""" st = find_node_ci(nodes, "Settings") return bool(st) and and_reach_surface(st, "Reset start guide", "About app")
def and_reach_about(nodes): """From the OPEN More sheet, tap About app -> About screen ('App version' appears; sheet row 'Settings' leaves).""" ab = find_node_ci(nodes, "About app") return bool(ab) and and_reach_surface(ab, "App version", "Settings")
def _goto_settings_root(): """Library ▸ More ▸ Settings, leaving the Settings root showing. Returns the node list of the Settings root (or [] on failure). Counts 2 surfaces.""" nodes = _open_library() if not and_reach_more_sheet(nodes): return [] if not and_reach_settings(ui()): return [] return ui()
def and_reach_book_info(): """Library -> Book Info: tap the cover (Book Info's 'No description.' appears; Library's 'Continue reading' leaves).""" nodes = _open_library() cover = _cover(nodes) return bool(cover) and and_reach_surface(cover, "No description.", "Continue reading")
def and_reach_reader_from_info(nodes): """From the OPEN Book Info screen, tap Start -> Reader (book body 'Chapter One' appears; Book Info's 'Start' button leaves).""" start = find_node(nodes, text="Start") or find_node(nodes, text="Continue") return bool(start) and and_reach_surface(start, "Chapter One", "Start")
def _open_reader_bars(): """Open the reader on BOOK, reveal the top/bottom bars, return the node list once the 'Reader settings' bar icon is present (else []).""" if not bf.open_reader(BOOK): return [] info = get_screen_info() tap(info["center_x"], info["center_y"]) # toggle bars settle("tap") nodes = ui() if find_node(nodes, content_desc="Reader settings") is None: # one retry: an animation may have eaten the first tap settle("tap") tap(info["center_x"], info["center_y"]) settle("tap") nodes = ui() return nodes
# ══════════════════════════════════════════════════════════════════════════════# (A) Bottom-nav tab reaches — depth 1, jump_kind="reach"# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_reach_history", "nav_reach_history_vlm"))def test_reach_history(): nodes = _open_library() tab = bf._tab(nodes, "History") # History surface: 'Delete whole history' toolbar action appears; Library's # 'Continue reading' cover affordance disappears. ok = tab is not None and and_reach_surface(tab, "Delete whole history", "Continue reading") record("nav_reach_history", ok, "" if ok else "feature_missing: History tab did not replace the Library " "surface (Delete-whole-history absent or Library still shown)", depth=1, jump_kind="reach", expect="History surface (Delete whole history) shown; Library " "'Continue reading' no longer showing") vlm_assert("nav_reach_history", "Is this a reading-history screen showing either a list of book " "entries grouped by date, or a centered empty-state illustration " "with a message — and NOT a grid of book covers?", RESULTS_DIR, tag="layout")
@and_test(expects=("nav_reach_browse",))def test_reach_browse(): nodes = _open_library() # Hop via History first so the source we drop is History-unique, then Browse. hist = bf._tab(nodes, "History") hop1 = hist is not None and and_reach_surface(hist, "Delete whole history", "Continue reading") br = bf._tab(ui(), "Browse") # The folder path is visible while it still contains unimported files. Once # all shared fixtures are in Library, the original app correctly shows its # Browse empty state instead. Both prove that History was replaced. browse_marker = br is not None and _reach_browse(br, "Delete whole history") ok = hop1 and bool(browse_marker) record("nav_reach_browse", ok, "" if ok else "feature_missing: History->Browse did not reach the " "Browse surface", depth=2, jump_kind="reach", expect="Browse surface (scanned-folder row or valid empty state) shown; " "History 'Delete whole history' no longer showing")
@and_test(expects=("nav_reach_library_from_browse",))def test_reach_library_from_browse(): nodes = _open_library() br = bf._tab(nodes, "Browse") browse_marker = br is not None and _reach_browse(br, "Continue reading") lib = bf._tab(ui(), "Library") # Back to Library: 'Continue reading' reappears and whichever Browse marker # was observed (folder header or empty-state action) leaves. hop2 = bool(browse_marker) and lib is not None and and_reach_surface( lib, "Continue reading", browse_marker) ok = bool(browse_marker) and hop2 record("nav_reach_library_from_browse", ok, "" if ok else "feature_missing: Browse->Library tab jump did not restore " "the Library cover surface", depth=2, jump_kind="reach", expect="Library surface ('Continue reading') restored; observed Browse " "marker no longer showing")
@and_test(expects=("nav_backstack_tab_history",))def test_backstack_tab_history(): # Library -> History (one hop), then BACK returns to Library. nodes = _open_library() tab = bf._tab(nodes, "History") deep = tab is not None and and_reach_surface(tab, "Delete whole history", "Continue reading") and_back() # pop History settle("tap") post = ui() home = (find_node(post, content_desc="Continue reading") is not None and find_node(post, text="Delete whole history") is None) ok = deep and home record("nav_backstack_tab_history", ok, "" if ok else "behavior_wrong: BACK from History did not return to the " "Library cover surface", depth=1, jump_kind="reach", expect="Library ('Continue reading') restored after one BACK from History")
# ══════════════════════════════════════════════════════════════════════════════# (B) Library ▸ More ▸ Settings ▸ sub-screens — depth 2–3 chains, reach# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_reach_more_sheet", "nav_reach_more_sheet_vlm"))def test_reach_more_sheet(): nodes = _open_library() ok = and_reach_more_sheet(nodes) record("nav_reach_more_sheet", ok, "" if ok else "feature_missing: More toolbar action did not open a sheet " "with a Settings row", depth=1, jump_kind="reach", expect="More bottom sheet (rows 'Settings'/'About app') shown; toolbar " "'Filter' no longer showing") vlm_assert("nav_reach_more_sheet", "Is there a small menu panel anchored to the BOTTOM edge of the " "screen (a bottom sheet with a drag handle), rather than a " "full-screen page?", RESULTS_DIR, tag="position")
@and_test(expects=("nav_reach_settings", "nav_reach_settings_vlm"))def test_reach_settings(): nodes = _open_library() hop1 = and_reach_more_sheet(nodes) hop2 = and_reach_settings(ui()) ok = hop1 and hop2 record("nav_reach_settings", ok, "" if ok else "feature_missing: More->Settings did not reach the Settings " "root (Reset start guide absent)", depth=2, jump_kind="reach", expect="Settings root ('Reset start guide') shown; More sheet 'About app' " "no longer showing") vlm_assert("nav_reach_settings", "In the top-left corner of this settings screen, is there a " "left-pointing back arrow, above a vertical list of category rows?", RESULTS_DIR, tag="position")
@and_test(expects=("nav_reach_appearance",))def test_reach_appearance(): root = _goto_settings_root() ap = find_node(root, text="Appearance") if root else None # Appearance sub-screen: 'Dark theme' segmented appears; Settings-root-only # 'Reset start guide' toolbar action leaves. ok = ap is not None and and_reach_surface(ap, "Dark theme", "Reset start guide") record("nav_reach_appearance", ok, "" if ok else "feature_missing: Settings->Appearance did not reach the " "Appearance surface (Dark theme absent)", depth=3, jump_kind="reach", expect="Appearance ('Dark theme') shown; Settings 'Reset start guide' " "no longer showing")
@and_test(expects=("nav_reach_reader_settings_screen",))def test_reach_reader_settings_screen(): root = _goto_settings_root() rd = find_node(root, text="Reader") if root else None # Reader settings sub-screen: 'Font thickness' appears; 'Reset start guide' leaves. ok = rd is not None and and_reach_surface(rd, "Font thickness", "Reset start guide") record("nav_reach_reader_settings_screen", ok, "" if ok else "feature_missing: Settings->Reader did not reach the Reader " "settings surface (Font thickness absent)", depth=3, jump_kind="reach", expect="Reader settings ('Font thickness') shown; Settings 'Reset start " "guide' no longer showing")
@and_test(expects=("nav_reach_general",))def test_reach_general(): root = _goto_settings_root() gn = find_node(root, text="General") if root else None # General sub-screen: 'Double back press to exit' appears; 'Reset start guide' leaves. ok = gn is not None and and_reach_surface(gn, "Double back press to exit", "Reset start guide") record("nav_reach_general", ok, "" if ok else "feature_missing: Settings->General did not reach the " "General surface (Double back press to exit absent)", depth=3, jump_kind="reach", expect="General ('Double back press to exit') shown; Settings 'Reset " "start guide' no longer showing")
@and_test(expects=("nav_reach_library_settings",))def test_reach_library_settings(): root = _goto_settings_root() lb = find_node(root, text="Library") if root else None # Library settings sub-screen: 'Create category' appears; 'Reset start guide' leaves. ok = lb is not None and and_reach_surface(lb, "Create category", "Reset start guide") record("nav_reach_library_settings", ok, "" if ok else "feature_missing: Settings->Library did not reach the " "Library-settings surface (Create category absent)", depth=3, jump_kind="reach", expect="Library settings ('Create category') shown; Settings 'Reset " "start guide' no longer showing")
@and_test(expects=("nav_reach_browse_settings",))def test_reach_browse_settings(): root = _goto_settings_root() bw = find_node(root, text="Browse") if root else None # Browse settings sub-screen: 'Add folder' appears; 'Reset start guide' leaves. ok = bw is not None and and_reach_surface(bw, "Add folder", "Reset start guide") record("nav_reach_browse_settings", ok, "" if ok else "feature_missing: Settings->Browse did not reach the " "Browse-settings surface (Add folder absent)", depth=3, jump_kind="reach", expect="Browse settings ('Add folder') shown; Settings 'Reset start " "guide' no longer showing")
@and_test(expects=("nav_backstack_settings_to_library",))def test_backstack_settings_to_library(): # Deepest here: Appearance -> BACK -> Settings root -> BACK -> Library. root = _goto_settings_root() ap = find_node(root, text="Appearance") if root else None deep = ap is not None and and_reach_surface(ap, "Dark theme", "Reset start guide") # Pop 1: Appearance -> Settings root b1 = and_showing() and_back(); settle("tap") a1 = and_showing() to_settings = and_reach(b1, a1, "Reset start guide", "Dark theme") # Pop 2: Settings root -> Library and_back(); settle("tap") post = ui() to_library = (find_node(post, content_desc="Continue reading") is not None and find_node(post, text="Reset start guide") is None) ok = deep and to_settings and to_library record("nav_backstack_settings_to_library", ok, "" if ok else "behavior_wrong: BACK did not unwind Appearance->Settings" "->Library one surface per press", depth=3, jump_kind="reach", expect="First BACK restores Settings ('Reset start guide'), second BACK " "restores Library ('Continue reading')")
# ══════════════════════════════════════════════════════════════════════════════# (C) Library ▸ Book cover ▸ Book Info ▸ Reader — depth 1/2 chains, reach# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_reach_book_info", "nav_reach_book_info_vlm"))def test_reach_book_info(): ok = and_reach_book_info() record("nav_reach_book_info", ok, "" if ok else "setup_failed: could not open Book Info from a Library cover " "('No description.' absent)", depth=1, jump_kind="reach", expect="Book Info ('No description.') shown; Library 'Continue reading' " "no longer showing") vlm_assert("nav_reach_book_info", "Is a single large book-cover image positioned in the upper part of " "this screen, with a button to start/read the book lower down — i.e. " "one book detail page, not a grid of many covers?", RESULTS_DIR, tag="position")
@and_test(expects=("nav_reach_reader", "nav_reach_reader_vlm"))def test_reach_reader(): # Library -> Book Info -> Reader (two hops). hop1 = and_reach_book_info() hop2 = and_reach_reader_from_info(ui()) ok = hop1 and hop2 # Dismiss the one-time immersive "Got it" cling if it rode in on the reader. got = find_node(ui(), text="Got it") if got: tap_node(got) settle("tap") record("nav_reach_reader", ok, "" if ok else "feature_missing: Book Info Start did not reach the Reader " "text surface ('Chapter One' absent)", depth=2, jump_kind="reach", expect="Reader body ('Chapter One') shown; Book Info 'Start' button no " "longer showing") vlm_assert("nav_reach_reader", "Is this an ebook reading page filled mostly with paragraphs of body " "text (a page of prose), rather than a list, a grid, or a form?", RESULTS_DIR, tag="layout")
@and_test(expects=("nav_backstack_reader_to_info",))def test_backstack_reader_to_info(): hop1 = and_reach_book_info() hop2 = and_reach_reader_from_info(ui()) got = find_node(ui(), text="Got it") if got: tap_node(got); settle("tap") # BACK from the reader returns to Book Info (its 'Start' button reappears; # the reader body 'Chapter One' leaves). before = and_showing() and_back(); settle("tap") after = and_showing() to_info = and_reach(before, after, "Start", "Chapter One") ok = hop1 and hop2 and to_info record("nav_backstack_reader_to_info", ok, "" if ok else "behavior_wrong: BACK from the Reader did not return to " "Book Info (Start button not restored)", depth=2, jump_kind="reach", expect="Book Info ('Start') restored after one BACK from the Reader")
@and_test(expects=("nav_backstack_info_to_library",))def test_backstack_info_to_library(): deep = and_reach_book_info() before = and_showing() and_back(); settle("tap") # Book Info -> Library after = and_showing() to_library = and_reach(before, after, "Continue reading", "No description.") ok = deep and to_library record("nav_backstack_info_to_library", ok, "" if ok else "behavior_wrong: BACK from Book Info did not return to the " "Library cover surface", depth=1, jump_kind="reach", expect="Library ('Continue reading') restored after one BACK from Book Info")
# ══════════════════════════════════════════════════════════════════════════════# (D) Reader in-surface panels — Reader settings sheet + Chapters drawer# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_reach_reader_settings_sheet",))def test_reach_reader_settings_sheet(): bars = _open_reader_bars() rs = find_node(bars, content_desc="Reader settings") if bars else None # Reader settings sheet: 'Reading mode' row appears; the 'Reader settings' bar # icon leaves (the bar is replaced by the sheet). ok = rs is not None and and_reach_surface(rs, "Reading mode", "Reader settings") record("nav_reach_reader_settings_sheet", ok, "" if ok else "feature_missing: Reader-settings icon did not open the " "reader settings sheet ('Reading mode' absent)", depth=3, jump_kind="reach", expect="Reader settings sheet ('Reading mode') shown; bar 'Reader " "settings' icon no longer showing")
@and_test(expects=("nav_reach_chapters_drawer",))def test_reach_chapters_drawer(): bars = _open_reader_bars() ch = find_node(bars, content_desc="Chapters") if bars else None # Chapters drawer: its 'Chapters' heading appears; the 'Reader settings' bar # icon leaves. ok = ch is not None and and_reach_surface(ch, "Chapters", "Reader settings") record("nav_reach_chapters_drawer", ok, "" if ok else "feature_missing: Chapters icon did not open the chapters " "drawer ('Chapters' heading absent)", depth=3, jump_kind="reach", expect="Chapters drawer ('Chapters' heading) shown; bar 'Reader " "settings' icon no longer showing")
# ══════════════════════════════════════════════════════════════════════════════# (E) About app ▸ Credits / Open source licenses — depth 2–3 chains, reach# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_reach_about", "nav_reach_about_vlm"))def test_reach_about(): nodes = _open_library() hop1 = and_reach_more_sheet(nodes) hop2 = and_reach_about(ui()) ok = hop1 and hop2 record("nav_reach_about", ok, "" if ok else "feature_missing: More->About app did not reach the About " "screen ('App version' absent)", depth=2, jump_kind="reach", expect="About screen ('App version') shown; More sheet 'Settings' no " "longer showing") vlm_assert("nav_reach_about", "Is an app icon positioned near the TOP of this About screen, with a " "vertical list of tappable link rows below it (e.g. report a bug, " "credits, licenses)?", RESULTS_DIR, tag="position")
@and_test(expects=("nav_reach_credits",))def test_reach_credits(): nodes = _open_library() hop1 = and_reach_more_sheet(nodes) hop2 = and_reach_about(ui()) cr = find_node(ui(), text="Credits") # Credits sub-screen: acknowledgement 'Tachiyomi (Mihon)' appears; the About # 'App version' label leaves. hop3 = cr is not None and and_reach_surface(cr, "Tachiyomi (Mihon)", "App version") ok = hop1 and hop2 and hop3 record("nav_reach_credits", ok, "" if ok else "feature_missing: About->Credits did not reach the Credits " "surface ('Tachiyomi (Mihon)' absent)", depth=3, jump_kind="reach", expect="Credits ('Tachiyomi (Mihon)') shown; About 'App version' no " "longer showing")
@and_test(expects=("nav_reach_licenses",))def test_reach_licenses(): nodes = _open_library() hop1 = and_reach_more_sheet(nodes) hop2 = and_reach_about(ui()) lic = find_node(ui(), text="Open source licenses") # Licenses sub-screen: a library entry 'AboutLibraries...' appears; About # 'App version' leaves. hop3 = lic is not None and and_reach_surface(lic, "AboutLibraries", "App version") ok = hop1 and hop2 and hop3 record("nav_reach_licenses", ok, "" if ok else "feature_missing: About->Open source licenses did not reach " "the licenses surface ('AboutLibraries' absent)", depth=3, jump_kind="reach", expect="Licenses ('AboutLibraries') shown; About 'App version' no longer " "showing")
@and_test(expects=("nav_backstack_credits_to_about",))def test_backstack_credits_to_about(): nodes = _open_library() hop1 = and_reach_more_sheet(nodes) hop2 = and_reach_about(ui()) cr = find_node(ui(), text="Credits") hop3 = cr is not None and and_reach_surface(cr, "Tachiyomi (Mihon)", "App version") # BACK from Credits returns to About ('App version' reappears; the Credits # acknowledgement 'Tachiyomi (Mihon)' leaves). before = and_showing() and_back(); settle("tap") after = and_showing() to_about = and_reach(before, after, "App version", "Tachiyomi (Mihon)") ok = hop1 and hop2 and hop3 and to_about record("nav_backstack_credits_to_about", ok, "" if ok else "behavior_wrong: BACK from Credits did not return to the " "About screen ('App version' not restored)", depth=3, jump_kind="reach", expect="About ('App version') restored after one BACK from Credits")
# ══════════════════════════════════════════════════════════════════════════════# (F) Search open / exit — in-place surface swap, reach# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_reach_search",))def test_reach_search(): nodes = _open_library() srch = find_node(nodes, content_desc="Search") # Search surface: the 'Exit search' affordance appears; the 'Filter' toolbar # icon (present only when NOT searching) leaves. ok = srch is not None and and_reach_surface(srch, "Exit search", "Filter") record("nav_reach_search", ok, "" if ok else "feature_missing: Search icon did not open the in-place " "search surface ('Exit search' absent)", depth=1, jump_kind="reach", expect="Search surface ('Exit search') shown; toolbar 'Filter' no longer " "showing")
@and_test(expects=("nav_backstack_exit_search",))def test_backstack_exit_search(): nodes = _open_library() srch = find_node(nodes, content_desc="Search") deep = srch is not None and and_reach_surface(srch, "Exit search", "Filter") # Exit search restores the normal Library toolbar ('Filter' returns; the # 'Exit search' affordance leaves). ex = find_node(ui(), content_desc="Exit search") restored = ex is not None and and_reach_surface(ex, "Filter", "Exit search") ok = deep and restored record("nav_backstack_exit_search", ok, "" if ok else "behavior_wrong: Exit search did not restore the Library " "toolbar ('Filter' not restored)", depth=1, jump_kind="reach", expect="Library toolbar ('Filter') restored after Exit search")
TESTS = [ # (A) tabs test_reach_history, test_reach_browse, test_reach_library_from_browse, test_backstack_tab_history, # (B) settings tree test_reach_more_sheet, test_reach_settings, test_reach_appearance, test_reach_reader_settings_screen, test_reach_general, test_reach_library_settings, test_reach_browse_settings, test_backstack_settings_to_library, # (C) book info / reader test_reach_book_info, test_reach_reader, test_backstack_reader_to_info, test_backstack_info_to_library, # (D) reader panels test_reach_reader_settings_sheet, test_reach_chapters_drawer, # (E) about tree test_reach_about, test_reach_credits, test_reach_licenses, test_backstack_credits_to_about, # (F) search test_reach_search, test_backstack_exit_search,]
if __name__ == "__main__": run_suite(TESTS, "navigation")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044#!/usr/bin/env python3"""STATES module — CHECKED / SELECTED transitions, page-state, focus, andSETTINGS PERSISTENCE across process death for Book's Story.
Lane: the app's toggles, modes and conditional controls. SOLE OWNER of `checked`and `focused`. Every test reads the state BEFORE (fresh ui()), drives the userpath, reads AFTER, asserts it TRANSITIONED, and asserts the app-authoredCONSEQUENCE — never a bare flip. Persistence tests kill the process(restart_app) and re-assert the state survived (DataStore).
GROUND TRUTH — every state/consequence below was OBSERVED on the running originalwith scratch scripts before it was asserted here:
Appearance (Library ▸ More ▸ Settings ▸ Appearance): * Dark theme segmented System/Disabled/Enabled — a content-desc="Selected" checkmark sits immediately LEFT of the chosen segment's label. System selected by default. Tapping Enabled: (a) marker moves to Enabled, (b) a NEW "Pure dark" segmented section APPEARS (dump-readable consequence), (c) the whole app renders dark. Survives restart_app (verified). * App theme cards Mercury/Neptune/Earth — each is a large clickable card View with its name label BELOW it; the "Selected" checkmark sits INSIDE the chosen card. Mercury selected by default. Tapping the Neptune CARD moves the marker into Neptune and changes the accent colour. * "Show navigation labels" toggle (ON by default). Its Switch does NOT expose `checked` in the tree (Compose renders it as plain Views), so the states assertion is the CONSEQUENCE: the Library/History/Browse text labels under the bottom-nav icons (y>2000) DISAPPEAR when it is OFF. Survives restart. Library settings (▸ Library): * Display mode segmented Grid/List (Grid default, "Selected" marker rule). List → the Library covers restack vertically (same x, different y) instead of side-by-side (same y, different x). Survives restart (verified). * Title position cards Hidden/Below/Inside — these DO expose checkable/checked; Below=true by default. Tapping Hidden flips Hidden=true, Below=false. Reader settings sheet (open a book ▸ tap center ▸ Reader settings icon ▸ Reader tab) — all segmented, same "Selected" marker rule: * Font style Normal/Italic (Normal default). * Text alignment Start/Justify/Center/End. * Progress count Percentage/Quantity (Percentage default). * Chapter title alignment Start/Justify/Center/End. Library Search: tapping the Search icon opens a single EditText that receives focus (focused="true").
The "Selected" marker rule (verified by tapping each control and watching themarker MOVE to the tapped segment): the selected segment is the label whose leftedge is nearest-right of the marker's right edge, on the same row. Assertions areTRANSITIONS (before != after AND after == the segment we tapped), so the semanticdefault never has to be hard-coded.
Depth: Settings sub-screens are depth 2 (Library=0 → Settings root=1 → category=2),backed by and_reach_settings_root() + and_enter_category(). The reader settingssheet is depth 3, backed by and_reach_book_info → and_reach_reader →and_enter_reader_sheet. Never clear_data(); settings persist across restart_app()."""import osimport sysimport time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,F401import book_fixture as bf # shared, validated import helper
COVER = "Cover image not found"BOOK1 = bf.BOOK1_TITLE
TESTS = []
def _t(fn): TESTS.append(fn) return fn
# ── navigation helpers (depth family — name-matched by and_audit_depth) ──────────
def _reach_library(retries: int = 6) -> bool: wait_for_foreground() for _ in range(retries): bf._open_tab("Library") if find_node(ui(), text="Settings") is None: # not yet in a submenu nodes = ui() if find_node(nodes, content_desc="More") is not None: return True settle("tap") return find_node(ui(), content_desc="More") is not None
def and_reach_settings_root() -> bool: """Library ▸ More ▸ Settings. PROVE the jump into the Settings root. Depth 1.""" more = find_node(ui(), content_desc="More") if more is None or not tap_node(more): return False settle("tap") time.sleep(0.6) st = find_node(ui(), text="Settings") if st is None: return False if and_reach_surface(st, target="Appearance", source="Search"): return True # fallback: confirm the root by its category rows ok = find_node(ui(), text="Appearance") is not None and \ find_node(ui(), text="Reader") is not None if ok: and_enter("settings_root") return ok
def and_enter_category(name: str) -> bool: """From the Settings root, open a category sub-screen and confirm the shape changed. Depth 2.""" row = find_node(ui(), text=name) if row is None: return False ok, _note = and_enter_surface(ui(), target_text=name) return ok
def _open_settings_category(name: str) -> bool: """Full path Library → Settings root → category. Leaves depth at 2.""" restart_app() if not _reach_library(): return False if not and_reach_settings_root(): return False return and_enter_category(name)
def and_reach_book_info() -> bool: """Tap the book cover and PROVE the jump into Book Info. Depth 1.""" nodes = ui() cover = find_node(nodes, content_desc=COVER) if cover is None: covers = [n for n in nodes if "Cover image" in (n.get("content-desc") or "")] cover = covers[0] if covers else None if cover is None: return False if and_reach_surface(cover, target="Start", source="Continue reading"): return True return find_node(ui(), text="Move") is not None
def and_reach_reader() -> bool: """From Book Info tap Start; confirm reader body text rendered. Depth 2.""" start = find_node(ui(), text="Start") or find_node(ui(), text="Continue") if start is None or not tap_node(start): return False settle("launch") time.sleep(1.5) got = find_node(ui(), text="Got it") if got: tap_node(got) settle("tap") and_enter("reader") return find_node(ui(), text="Chapter One") is not None
def and_enter_reader_sheet(tab: str = "Reader") -> bool: """Reveal the reader bars, open the Reader settings sheet, switch to `tab`. Confirms the sheet's tab row appeared. Depth 3.""" info = get_screen_info() tap(info["center_x"], info["center_y"]) settle("tap") time.sleep(1) rs = find_node(ui(), content_desc="Reader settings") if rs is None or not tap_node(rs): return False settle("launch") time.sleep(1) nodes = ui() ok = find_node(nodes, text="Colors") is not None and \ find_node(nodes, text="Reader") is not None if not ok: return False and_enter("reader_settings_sheet") t = find_node(ui(), text=tab) if t and not (find_node(ui(), text=tab).get("selected") == "true"): tap_node(t) settle("tap") time.sleep(0.6) return True
def _reach_reader_tab(tab: str = "Reader") -> bool: restart_app() if not _reach_library(): return False if not and_reach_book_info(): return False if not and_reach_reader(): return False return and_enter_reader_sheet(tab)
# ── selection-marker helpers (the "Selected" checkmark rule, verified) ───────────
def _selected_segment(section: str, seg_labels, y_window: int = 200): """Which labelled segment on `section`'s row carries the 'Selected' checkmark.
Rule (verified by tapping each control): the marker sits immediately LEFT of the chosen label, so the selected segment is the label whose left edge is nearest-right of the marker's right edge, on the same row band below the section header. """ nodes = ui() hdr = find_node(nodes, text=section) if hdr is None: return None hy = hdr["_bounds"][3] segs = {} for lbl in seg_labels: for n in find_nodes(nodes, text=lbl): b = n["_bounds"] if hy <= b[1] <= hy + y_window: segs[lbl] = b marker = None for n in nodes: if n.get("content-desc") == "Selected": b = n["_bounds"] if hy <= b[1] <= hy + y_window: marker = b break if marker is None or not segs: return None # nearest label to the RIGHT of the marker (smallest non-negative gap wins, # falling back to absolute nearest so a right-most selection still resolves) right = [(b[0] - marker[2], lbl) for lbl, b in segs.items() if b[0] >= marker[2] - 30] if right: return min(right)[1] return min((abs(b[0] - marker[2]), lbl) for lbl, b in segs.items())[1]
def _tap_segment(section: str, label: str, y_window: int = 200) -> bool: """Tap the segment `label` on `section`'s row (re-dumps for fresh bounds).""" nodes = ui() hdr = find_node(nodes, text=section) if hdr is None: return False hy = hdr["_bounds"][3] for n in find_nodes(nodes, text=label): b = n["_bounds"] if hy <= b[1] <= hy + y_window: return tap_node(n) return False
def _reveal_segments(section: str, seg_labels, extra_swipes: int = 3) -> bool: """Scroll so `section`'s SEGMENTS (not just its header) are on screen. A row at the bottom of a scroll view can have its header visible while its segment pills are still below the fold — scroll_into_view stops at the header, so we nudge down until at least one segment label is present in the dump.""" scroll_into_view(section) for _ in range(extra_swipes + 1): nodes = ui() hdr = find_node(nodes, text=section) if hdr is not None: hy = hdr["_bounds"][3] for lbl in seg_labels: for n in find_nodes(nodes, text=lbl): if hy <= n["_bounds"][1] <= hy + 200: return True scroll_down(0.35) return False
def _app_theme_card(nodes, label: str): """The clickable App-theme card View whose name label sits just below it.""" lab = find_node(nodes, text=label) if lab is None: return None lx = lab["_center"][0] ly = lab["_bounds"][1] best = None for n in nodes: b = n.get("_bounds") if b and n.get("clickable") == "true": if b[0] <= lx <= b[2] and b[3] <= ly + 12 and (ly - b[3]) < 90: best = n return best
def _app_theme_selected(nodes): """Which App-theme card (Mercury/Neptune/Earth) holds the 'Selected' marker.""" hdr = find_node(nodes, text="App theme") if hdr is None: return None hy = hdr["_bounds"][3] marker = None for n in nodes: if n.get("content-desc") == "Selected" and hy < n["_bounds"][1] < 1450: marker = n["_bounds"] break if marker is None: return None mcx = (marker[0] + marker[2]) // 2 for label in ("Mercury", "Neptune", "Earth"): card = _app_theme_card(nodes, label) if card and card["_bounds"][0] <= mcx <= card["_bounds"][2]: return label return None
def _nav_labels_present(): """The set of bottom-nav TEXT labels (y>2000) currently under the icons.""" nodes = ui() out = set() for lbl in ("Library", "History", "Browse"): for n in find_nodes(nodes, text=lbl): b = n.get("_bounds") if b and b[1] > 2000: out.add(lbl) break return out
def _nav_labels_toggle(): """Tap the 'Show navigation labels' clickable row (must be on the Appearance screen). Returns True if tapped.""" scroll_into_view("Show navigation labels") nodes = ui() lab = find_node(nodes, text="Show navigation labels") if lab is None: return False ly = lab["_bounds"][1] for n in nodes: b = n.get("_bounds") if (b and n.get("clickable") == "true" and b[0] < 50 and b[2] > 1000 and abs(b[1] - (ly - 20)) < 130): return tap_node(n) return False
def _cover_layout(): """Classify the Library cover layout: 'grid' = >=2 covers sharing a y-band but spread in x; 'list' = >=2 covers sharing an x-band but stacked in y; else ''.""" nodes = ui() pts = [n["_center"] for n in nodes if (n.get("content-desc") or "") == COVER] if len(pts) < 2: return "" xs = [p[0] for p in pts] ys = [p[1] for p in pts] x_spread = max(xs) - min(xs) y_spread = max(ys) - min(ys) if x_spread > 150 and y_spread < 120: return "grid" if y_spread > 150 and x_spread < 120: return "list" return ""
def _title_pos_checked(nodes): """{'Hidden':'true'/'false', ...} for the Library Title-position cards.""" out = {} for lbl in ("Hidden", "Below", "Inside"): n = find_node(nodes, text=lbl) if n is None: continue lx, ly = n["_center"] for c in nodes: b = c.get("_bounds") if (b and c.get("checkable") == "true" and b[0] <= lx <= b[2] and b[1] <= ly <= b[3]): out[lbl] = c.get("checked") break return out
def _tap_title_pos(nodes, label: str) -> bool: n = find_node(nodes, text=label) if n is None: return False lx, ly = n["_center"] for c in nodes: b = c.get("_bounds") if (b and c.get("checkable") == "true" and b[0] <= lx <= b[2] and b[1] <= ly <= b[3]): return tap_node(c) return tap_node(n)
def _shot(name): p = os.path.join(RESULTS_DIR, "screenshots", f"_states_{name}.png") screencap(p) return p
def _open_appearance() -> bool: return _open_settings_category("Appearance")
# ══════════════════════════════════════════════════════════════════════════════# 1. Dark theme — flagship: transition + consequence + persistence + VLM(x3)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("states_dark_theme_enable", "states_dark_theme_enable_vlm"))def test_dark_theme_enable(): """Dark theme System → Enabled: the 'Selected' marker moves to Enabled AND a new 'Pure dark' section appears (the app-authored dark-mode consequence). Restores to System. Depth 2.""" name = "states_dark_theme_enable" exp = "Dark theme selected System->Enabled; 'Pure dark' section now showing" if not _open_appearance(): record(name, False, "setup_failed: could not reach Appearance", depth=2, jump_kind="transition", expect=exp) record(name + "_vlm", False, "setup_failed: could not reach Appearance", depth=2, jump_kind="none", tag="color") return segs = ["System", "Disabled", "Enabled"] before = _selected_segment("Dark theme", segs) pure_before = find_node(ui(), text="Pure dark") is not None _tap_segment("Dark theme", "Enabled") settle("tap") time.sleep(0.8) after = _selected_segment("Dark theme", segs) pure_after = find_node(ui(), text="Pure dark") is not None ok = (before == "System" and after == "Enabled" and not pure_before and pure_after) record(name, ok, "" if ok else f"behavior_wrong: dark selected {before!r}->{after!r}, 'Pure dark' " f"{pure_before}->{pure_after}; expected System->Enabled with Pure dark appearing", depth=2, jump_kind="transition", expect=exp) _shot("dark_enabled") vlm_assert(name, "Is the background of this settings screen a dark/near-black colour " "with light-coloured text (dark mode), rather than a white/light " "background?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="color") # restore to System if _open_appearance(): _tap_segment("Dark theme", "System") settle("tap")
@_t@and_test(expects=("states_dark_theme_persists", "states_dark_theme_persists_vlm"))def test_dark_theme_persists(): """Enable dark theme, kill the process (restart_app), re-open Appearance and assert Enabled is STILL selected AND still renders dark — DataStore persistence across process death. Restores to System. Depth 2.""" name = "states_dark_theme_persists" exp = "after process death Dark theme is STILL Enabled; app still renders dark" segs = ["System", "Disabled", "Enabled"] if not _open_appearance(): record(name, False, "setup_failed: could not reach Appearance", depth=2, jump_kind="transition", expect=exp) record(name + "_vlm", False, "setup_failed: could not reach Appearance", depth=2, jump_kind="none", tag="color") return _tap_segment("Dark theme", "Enabled") settle("tap") time.sleep(0.6) set_ok = _selected_segment("Dark theme", segs) == "Enabled" # process death + relaunch, then re-open Appearance reopened = _open_appearance() persisted = _selected_segment("Dark theme", segs) if reopened else None pure = find_node(ui(), text="Pure dark") is not None ok = set_ok and reopened and persisted == "Enabled" and pure record(name, ok, "" if ok else f"behavior_wrong: set Enabled={set_ok}, after restart selected=" f"{persisted!r} pure_dark={pure}; expected Enabled to persist", depth=2, jump_kind="transition", expect=exp) _shot("dark_persisted") vlm_assert(name, "After the app was restarted, is this settings screen still rendered " "in dark mode — a dark/near-black background with light text (not a " "white/light background)?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="color") # restore to System so later tests start light if _open_appearance(): _tap_segment("Dark theme", "System") settle("tap")
@_t@and_test(expects=("states_dark_theme_highlight_vlm",))def test_dark_theme_highlight_vlm(): """The chosen Dark-theme segment (Enabled) is visually highlighted with a coloured/filled pill distinct from the other two segments — a rendered selection property the dump's marker alone cannot confirm. Restores. Depth 2.""" name = "states_dark_theme_highlight" if not _open_appearance(): record(name + "_vlm", False, "setup_failed: could not reach Appearance", depth=2, jump_kind="none", tag="shape") return _tap_segment("Dark theme", "Enabled") settle("tap") time.sleep(0.6) _shot("dark_highlight") vlm_assert(name, "In the 'Dark theme' row (segments System, Disabled, Enabled), is the " "'Enabled' segment visually highlighted with a coloured/filled " "background pill that the other two segments do NOT have?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="shape") if _open_appearance(): _tap_segment("Dark theme", "System") settle("tap")
# ══════════════════════════════════════════════════════════════════════════════# 2. App theme cards — Mercury -> Neptune (marker moves) + accent-colour VLM(x2)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("states_app_theme_select", "states_app_theme_select_vlm"))def test_app_theme_select(): """App theme Mercury → Neptune: tapping the Neptune CARD moves the 'Selected' checkmark into Neptune (before != after, after == Neptune) and changes the accent colour. Restores to Mercury. Depth 2.""" name = "states_app_theme_select" exp = "App theme selected Mercury->Neptune (marker moves into the Neptune card)" if not _open_appearance(): record(name, False, "setup_failed: could not reach Appearance", depth=2, jump_kind="transition", expect=exp) record(name + "_vlm", False, "setup_failed: could not reach Appearance", depth=2, jump_kind="none", tag="color") return scroll_into_view("App theme") nodes = ui() before = _app_theme_selected(nodes) card = _app_theme_card(nodes, "Neptune") if card is None or not tap_node(card): record(name, False, "setup_failed: Neptune card not tappable", depth=2, jump_kind="transition", expect=exp) record(name + "_vlm", False, "setup_failed: Neptune card not tappable", depth=2, jump_kind="none", tag="color") return settle("tap") time.sleep(0.8) after = _app_theme_selected(ui()) ok = before == "Mercury" and after == "Neptune" record(name, ok, "" if ok else f"behavior_wrong: app theme selected {before!r}->{after!r}; " f"expected Mercury->Neptune", depth=2, jump_kind="transition", expect=exp) _shot("app_theme_neptune") vlm_assert(name, "In this 'App theme' setting, is the currently selected theme card " "(the one with a check mark) labelled 'Neptune' and showing a " "blue/indigo colour swatch?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="color") # restore Mercury nodes = ui() m = _app_theme_card(nodes, "Mercury") if m: tap_node(m) settle("tap")
@_t@and_test(expects=("states_app_theme_ring_vlm",))def test_app_theme_ring_vlm(): """The selected App-theme card is drawn with a highlight ring / check-mark badge that the unselected cards lack — a rendered selection cue. Depth 2.""" name = "states_app_theme_ring" if not _open_appearance(): record(name + "_vlm", False, "setup_failed: could not reach Appearance", depth=2, jump_kind="none", tag="shape") return scroll_into_view("App theme") _shot("app_theme_ring") vlm_assert(name, "In this 'App theme' card row (Mercury, Neptune, Earth), does exactly " "one card show a check-mark / selection badge marking it as the " "chosen theme?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="shape")
# ══════════════════════════════════════════════════════════════════════════════# 3. Show navigation labels — consequence (labels vanish) + persistence + VLM# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("states_nav_labels_hide", "states_nav_labels_hide_vlm"))def test_nav_labels_hide(): """'Show navigation labels' OFF: the Library/History/Browse TEXT labels under the bottom-nav icons disappear. The Switch does not expose `checked`, so the app-authored CONSEQUENCE (labels gone) is the state assertion. Restores. Depth 2.""" name = "states_nav_labels_hide" exp = "nav-bar text labels present -> gone after toggling 'Show navigation labels' off" # baseline: confirm labels present on the Library restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=2, jump_kind="transition", expect=exp) record(name + "_vlm", False, "setup_failed: Library not reachable", depth=2, jump_kind="none", tag="position") return before = _nav_labels_present() if not (and_reach_settings_root() and and_enter_category("Appearance")): record(name, False, "setup_failed: could not reach Appearance", depth=2, jump_kind="transition", expect=exp) record(name + "_vlm", False, "setup_failed: could not reach Appearance", depth=2, jump_kind="none", tag="position") return if not _nav_labels_toggle(): record(name, False, "setup_failed: could not toggle 'Show navigation labels'", depth=2, jump_kind="transition", expect=exp) record(name + "_vlm", False, "setup_failed: toggle not found", depth=2, jump_kind="none", tag="position") return settle("tap") # back to Library and read the labels restart_app() _reach_library() after = _nav_labels_present() ok = before == {"Library", "History", "Browse"} and after == set() record(name, ok, "" if ok else f"behavior_wrong: nav labels {sorted(before)}->{sorted(after)}; " f"expected all three present then all gone", depth=2, jump_kind="transition", expect=exp) _shot("nav_labels_off") vlm_assert(name, "Look at the bottom navigation bar of this app. Are the icons shown " "WITHOUT any text labels underneath them (no 'Library'/'History'/" "'Browse' words under the bottom-bar icons)?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="position") # restore labels ON if _reach_library() and and_reach_settings_root() and and_enter_category("Appearance"): _nav_labels_toggle() settle("tap")
@_t@and_test(expects=("states_nav_labels_persist",))def test_nav_labels_persist(): """Toggle nav labels OFF, kill the process, and confirm they are STILL hidden on the Library after relaunch — the setting persists across process death. Restores labels ON. Depth 2.""" name = "states_nav_labels_persist" exp = "nav labels hidden survive process death (still gone after restart)" restart_app() if not (_reach_library() and and_reach_settings_root() and and_enter_category("Appearance")): record(name, False, "setup_failed: could not reach Appearance", depth=2, jump_kind="transition", expect=exp) return if not _nav_labels_toggle(): record(name, False, "setup_failed: could not toggle nav labels", depth=2, jump_kind="transition", expect=exp) return settle("tap") # process death, relaunch, check Library restart_app() _reach_library() after = _nav_labels_present() ok = after == set() record(name, ok, "" if ok else f"behavior_wrong: after restart nav labels are {sorted(after)}; " f"expected still hidden (empty)", depth=2, jump_kind="transition", expect=exp) # restore labels ON if _reach_library() and and_reach_settings_root() and and_enter_category("Appearance"): _nav_labels_toggle() settle("tap")
# ══════════════════════════════════════════════════════════════════════════════# 4. Library Display mode Grid -> List — consequence (layout) + persist + VLM(x3)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("states_display_mode_list", "states_display_mode_list_grid_vlm", "states_display_mode_list_list_vlm"))def test_display_mode_list(): """Display mode Grid → List: the 'Selected' marker moves to List AND the Library covers restack vertically (list) instead of side-by-side (grid) — the app-authored layout consequence. Restores to Grid. Depth 2.""" name = "states_display_mode_list" exp = "Display mode Grid->List; Library covers restack from a row to a column" bf.import_book(BOOK1, bf.BOOK1_FILE) bf.import_book(bf.BOOK2_TITLE, bf.BOOK2_FILE) # baseline grid layout on the Library restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=2, jump_kind="transition", expect=exp) record(name + "_grid_vlm", False, "setup_failed: Library not reachable", depth=0, jump_kind="none", tag="layout") record(name + "_list_vlm", False, "setup_failed: Library not reachable", depth=2, jump_kind="none", tag="layout") return grid_layout = _cover_layout() _shot("library_grid") vlm_assert(name + "_grid", "On this Library screen, are the book covers arranged side by side in " "a GRID (two or more covers in the same horizontal row), rather than " "stacked vertically in a single-column list?", RESULTS_DIR, expect="YES", depth=0, jump_kind="none", tag="layout") # flip to List if not (and_reach_settings_root() and and_enter_category("Library")): record(name, False, "setup_failed: could not reach Library settings", depth=2, jump_kind="transition", expect=exp) record(name + "_list_vlm", False, "setup_failed: could not reach Library settings", depth=2, jump_kind="none", tag="layout") return scroll_into_view("Display mode") before = _selected_segment("Display mode", ["Grid", "List"]) _tap_segment("Display mode", "List") settle("tap") time.sleep(0.6) after = _selected_segment("Display mode", ["Grid", "List"]) # observe the Library layout after the change restart_app() _reach_library() list_layout = _cover_layout() ok = (before == "Grid" and after == "List" and grid_layout == "grid" and list_layout == "list") record(name, ok, "" if ok else f"behavior_wrong: selected {before!r}->{after!r}, layout " f"{grid_layout!r}->{list_layout!r}; expected Grid->List and grid->list", depth=2, jump_kind="transition", expect=exp) _shot("library_list") vlm_assert(name + "_list", "On this Library screen, are the book covers now stacked vertically " "in a single-column LIST (each book on its own row, one above the " "other), rather than side by side in a grid?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="layout") # restore to Grid if _reach_library() and and_reach_settings_root() and and_enter_category("Library"): scroll_into_view("Display mode") _tap_segment("Display mode", "Grid") settle("tap")
@_t@and_test(expects=("states_display_mode_persists", "states_display_mode_persists_vlm"))def test_display_mode_persists(): """Set Display mode to List, kill the process, and confirm List is STILL selected AND the Library still renders as a list after relaunch. Restores to Grid. Depth 2.""" name = "states_display_mode_persists" exp = "after process death Display mode is STILL List; Library still a column" bf.import_book(BOOK1, bf.BOOK1_FILE) bf.import_book(bf.BOOK2_TITLE, bf.BOOK2_FILE) if not _open_settings_category("Library"): record(name, False, "setup_failed: could not reach Library settings", depth=2, jump_kind="transition", expect=exp) record(name + "_vlm", False, "setup_failed: could not reach Library settings", depth=2, jump_kind="none", tag="layout") return scroll_into_view("Display mode") _tap_segment("Display mode", "List") settle("tap") time.sleep(0.6) set_ok = _selected_segment("Display mode", ["Grid", "List"]) == "List" # process death; re-open Library settings and check the marker reopened = _open_settings_category("Library") if reopened: scroll_into_view("Display mode") persisted = _selected_segment("Display mode", ["Grid", "List"]) if reopened else None # and the Library layout itself restart_app() _reach_library() layout = _cover_layout() _shot("library_list_persist") ok = set_ok and persisted == "List" and layout == "list" record(name, ok, "" if ok else f"behavior_wrong: set List={set_ok}, after restart selected={persisted!r} " f"layout={layout!r}; expected List to persist as a column", depth=2, jump_kind="transition", expect=exp) vlm_assert(name, "After the app was restarted, on this Library screen are the book " "covers still stacked vertically in a single-column LIST (one book " "per row) rather than in a side-by-side grid?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="layout") # restore to Grid if _reach_library() and and_reach_settings_root() and and_enter_category("Library"): scroll_into_view("Display mode") _tap_segment("Display mode", "Grid") settle("tap")
@_t@and_test(expects=("states_display_highlight_vlm",))def test_display_highlight_vlm(): """The chosen Display-mode segment is drawn as a coloured/filled pill distinct from the other — a rendered selection colour. Depth 2.""" name = "states_display_highlight" if not _open_settings_category("Library"): record(name + "_vlm", False, "setup_failed: could not reach Library settings", depth=2, jump_kind="none", tag="color") return scroll_into_view("Display mode") _shot("display_highlight") vlm_assert(name, "In the 'Display mode' row (segments 'Grid' and 'List'), is exactly " "one of the two segments visually highlighted with a coloured/filled " "background pill (the selected one) while the other is plain?", RESULTS_DIR, expect="YES", depth=2, jump_kind="none", tag="color")
# ══════════════════════════════════════════════════════════════════════════════# 5. Library Title position — a dump-readable CHECKED transition (Below -> Hidden)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("states_title_position_toggle",))def test_title_position_toggle(): """Title position cards Hidden/Below/Inside expose checkable/checked. Below is checked by default; tapping Hidden flips Hidden=true and Below=false (a single exclusive checked group). Restores to Below. Depth 2.""" name = "states_title_position_toggle" exp = "Title position checked: Below true->false, Hidden false->true" if not _open_settings_category("Library"): record(name, False, "setup_failed: could not reach Library settings", depth=2, jump_kind="transition", expect=exp) return scroll_into_view("Title position") before = _title_pos_checked(ui()) if not _tap_title_pos(ui(), "Hidden"): record(name, False, "setup_failed: Hidden card not tappable", depth=2, jump_kind="transition", expect=exp) return settle("tap") time.sleep(0.5) after = _title_pos_checked(ui()) ok = (before.get("Below") == "true" and before.get("Hidden") == "false" and after.get("Hidden") == "true" and after.get("Below") == "false") record(name, ok, "" if ok else f"behavior_wrong: Title position checked {before}->{after}; " f"expected Below true->false and Hidden false->true", depth=2, jump_kind="transition", expect=exp) # restore Below scroll_into_view("Title position") _tap_title_pos(ui(), "Below") settle("tap")
# ══════════════════════════════════════════════════════════════════════════════# 6. Reader settings segmented controls (depth 3) — marker transitions + VLM(x2)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("states_font_style_italic", "states_font_style_italic_highlight_vlm"))def test_font_style_italic(): """Reader ▸ Font style Normal → Italic: the 'Selected' marker moves to Italic (before Normal, after Italic). Depth 3.""" name = "states_font_style_italic" exp = "Font style selected Normal->Italic (marker moves to Italic)" if not _reach_reader_tab("Reader"): record(name, False, "setup_failed: could not reach reader settings Reader tab", depth=3, jump_kind="transition", expect=exp) record(name + "_highlight_vlm", False, "setup_failed: reader Reader tab unreachable", depth=3, jump_kind="none", tag="shape") return scroll_into_view("Font style") # Font style persists via DataStore; force a known Normal baseline so the # Normal->Italic transition is observable regardless of prior runs' state. if _selected_segment("Font style", ["Normal", "Italic"]) != "Normal": _tap_segment("Font style", "Normal") settle("tap") time.sleep(0.4) scroll_into_view("Font style") before = _selected_segment("Font style", ["Normal", "Italic"]) _tap_segment("Font style", "Italic") settle("tap") time.sleep(0.6) after = _selected_segment("Font style", ["Normal", "Italic"]) ok = before == "Normal" and after == "Italic" record(name, ok, "" if ok else f"behavior_wrong: font style selected {before!r}->{after!r}; " f"expected Normal->Italic", depth=3, jump_kind="transition", expect=exp) _shot("font_style_italic") vlm_assert(name + "_highlight", "In the 'Font style' row (segments 'Normal' and 'Italic'), is the " "'Italic' segment the one visually highlighted with a coloured/filled " "background pill (marking it selected) rather than 'Normal'?", RESULTS_DIR, expect="YES", depth=3, jump_kind="none", tag="shape") # restore Normal so this test does not perturb later runs scroll_into_view("Font style") _tap_segment("Font style", "Normal") settle("tap")
@_t@and_test(expects=("states_progress_count_change", "states_progress_count_change_highlight_vlm"))def test_progress_count_change(): """Reader ▸ Progress count Percentage → Quantity: the 'Selected' marker moves to Quantity (before Percentage, after Quantity). Depth 3.""" name = "states_progress_count_change" exp = "Progress count selected Percentage->Quantity (marker moves)" if not _reach_reader_tab("Reader"): record(name, False, "setup_failed: could not reach reader settings Reader tab", depth=3, jump_kind="transition", expect=exp) record(name + "_highlight_vlm", False, "setup_failed: reader Reader tab unreachable", depth=3, jump_kind="none", tag="color") return if not _reveal_segments("Progress count", ["Percentage", "Quantity"]): record(name, False, "setup_failed: Progress count segments not reachable", depth=3, jump_kind="transition", expect=exp) record(name + "_highlight_vlm", False, "setup_failed: Progress count segments not reachable", depth=3, jump_kind="none", tag="color") return # Progress count persists via DataStore; force a known Percentage baseline so # the Percentage->Quantity transition is observable regardless of prior state. if _selected_segment("Progress count", ["Percentage", "Quantity"]) != "Percentage": _tap_segment("Progress count", "Percentage") settle("tap") time.sleep(0.4) _reveal_segments("Progress count", ["Percentage", "Quantity"]) before = _selected_segment("Progress count", ["Percentage", "Quantity"]) _tap_segment("Progress count", "Quantity") settle("tap") time.sleep(0.6) after = _selected_segment("Progress count", ["Percentage", "Quantity"]) ok = before == "Percentage" and after == "Quantity" record(name, ok, "" if ok else f"behavior_wrong: progress count selected {before!r}->{after!r}; " f"expected Percentage->Quantity", depth=3, jump_kind="transition", expect=exp) _shot("progress_quantity") vlm_assert(name + "_highlight", "In the 'Progress count' row (segments 'Percentage' and 'Quantity'), " "is the 'Quantity' segment the one visually highlighted with a " "coloured/filled background pill (marking it selected)?", RESULTS_DIR, expect="YES", depth=3, jump_kind="none", tag="color") # restore Percentage so this test does not perturb later runs _reveal_segments("Progress count", ["Percentage", "Quantity"]) _tap_segment("Progress count", "Percentage") settle("tap")
@_t@and_test(expects=("states_text_alignment_change", "states_text_align_highlight_vlm"))def test_text_alignment_change(): """Reader ▸ Text alignment: selecting 'Center' moves the 'Selected' marker to Center (before != Center, after == Center). Depth 3.""" name = "states_text_alignment_change" exp = "Text alignment selection moves to Center (marker on a different segment)" if not _reach_reader_tab("Reader"): record(name, False, "setup_failed: could not reach reader settings Reader tab", depth=3, jump_kind="transition", expect=exp) record("states_text_align_highlight_vlm", False, "setup_failed: reader Reader tab unreachable", depth=3, jump_kind="none", tag="shape") return scroll_into_view("Text alignment") labels = ["Start", "Justify", "Center", "End"] before = _selected_segment("Text alignment", labels) _tap_segment("Text alignment", "Center") settle("tap") time.sleep(0.6) after = _selected_segment("Text alignment", labels) ok = after == "Center" and before != "Center" record(name, ok, "" if ok else f"behavior_wrong: text alignment selected {before!r}->{after!r}; " f"expected a move to Center", depth=3, jump_kind="transition", expect=exp) _shot("text_align_center") vlm_assert("states_text_align_highlight", "In the 'Text alignment' row (segments Start, Justify, Center, End), " "is the 'Center' segment the one visually highlighted with a " "coloured/filled background pill (marking it selected)?", RESULTS_DIR, expect="YES", depth=3, jump_kind="none", tag="shape") # restore Start (the default) so a re-run does not begin on Center scroll_into_view("Text alignment") _tap_segment("Text alignment", "Start") settle("tap")
@_t@and_test(expects=("states_chapter_title_align",))def test_chapter_title_align(): """Reader ▸ Chapter title alignment: selecting 'Center' moves the 'Selected' marker to Center (before != Center, after == Center). Depth 3.""" name = "states_chapter_title_align" exp = "Chapter title alignment selection moves to Center" if not _reach_reader_tab("Reader"): record(name, False, "setup_failed: could not reach reader settings Reader tab", depth=3, jump_kind="transition", expect=exp) return scroll_into_view("Chapter title alignment") labels = ["Start", "Justify", "Center", "End"] before = _selected_segment("Chapter title alignment", labels) _tap_segment("Chapter title alignment", "Center") settle("tap") time.sleep(0.6) after = _selected_segment("Chapter title alignment", labels) ok = after == "Center" and before != "Center" record(name, ok, "" if ok else f"behavior_wrong: chapter title alignment selected {before!r}->{after!r}; " f"expected a move to Center", depth=3, jump_kind="transition", expect=exp) # restore Start so a re-run does not begin on Center scroll_into_view("Chapter title alignment") _tap_segment("Chapter title alignment", "Start") settle("tap")
# ══════════════════════════════════════════════════════════════════════════════# 7. Focus — Library Search field receives focus (states owns `focused`)# ══════════════════════════════════════════════════════════════════════════════
@_t@and_test(expects=("states_search_focus",))def test_search_focus(): """Tapping the Library Search icon opens a search EditText that HOLDS focus (focused='true') — the app-authored focus target after that action. Depth 0.""" name = "states_search_focus" exp = "after tapping Search, the search EditText reports focused=true" restart_app() if not _reach_library(): record(name, False, "setup_failed: Library not reachable", depth=0, jump_kind="transition", expect=exp) return # no EditText focused before opening search before_focused = any(e.get("focused") == "true" for e in find_by_class(ui(), "EditText")) s = find_node(ui(), content_desc="Search") if s is None or not tap_node(s): record(name, False, "feature_missing: no Search control on the Library", depth=0, jump_kind="transition", expect=exp) return settle("tap") time.sleep(0.8) edits = find_by_class(ui(), "EditText") after_focused = any(e.get("focused") == "true" for e in edits) ok = (not before_focused) and len(edits) >= 1 and after_focused record(name, ok, "" if ok else f"behavior_wrong: EditText present={len(edits)}, focused before=" f"{before_focused} after={after_focused}; expected an unfocused->focused " f"search field to appear", depth=0, jump_kind="transition", expect=exp)
if __name__ == "__main__": if not device_online(): print("Device offline — aborting (a whole module of setup_failed would be " "misattributed to the app).") sys.exit(2) run_suite(TESTS, "states")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734"""Structure lane for Book's Story (ebook reader).
This module owns exactly two things:
(1) THE GATE — the app launches into the foreground and its top-level surfaces exist: the main Compose container, the top app-bar action host (Search / Filter / More), and the bottom-nav host (Library / History / Browse). These are jump_kind="none", depth=0, and are kept to <=30% of the suite (3 of 19 rule tests).
(2) TREE-SHAPE DELTAS — an interaction that changes the tree's SHAPE: a search field that adds an EditText, a bottom sheet / dialog that adds a new window layer, an empty<->populated list, a mode switch that adds a class of widget. Each is recorded as jump_kind="transition" with the shape DELTA I OBSERVED on the running original, and is REVERSED to assert it restores. surface_changed(before, after) is the honest primitive here; this lane never claims `reach` (that is navigation's).
Everything asserted below was observed on the running original app. Toggles inthis Jetpack-Compose app render as `android.view.View` (NOT android.widget.Switch),so shape counts use and_showing() size and specific key presence/absence ratherthan find_by_class(nodes,"Switch").
A real book is imported via the shared book_fixture helper (never inlined); thekit pushes the fixture bytes before the first test through run_suite()."""import osimport sysimport time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,F401import book_fixture as bf # shared import-a-book helper
RESULTS_DIR = sys.argv[2] if len(sys.argv) > 2 else os.path.dirname( os.path.abspath(__file__))
BOOK = bf.BOOK1_TITLE # "testbook"
# ── local helpers ─────────────────────────────────────────────────────────────
def _covers(nodes): """The Library book-cover cards (icon-only, content-desc 'Cover image ...').""" return [n for n in nodes if "Cover image" in (n.get("content-desc") or "")]
def _open_library(): """Bring the app to the Library tab from a cold restart. Returns node list.""" restart_app() wait_for_foreground() time.sleep(1) bf._open_tab("Library") return ui()
def _restored(before_keys, after_keys, slack=4): """True if the surface returned to (approximately) its pre-trigger shape.""" return len(set(before_keys) ^ set(after_keys)) <= slack
# ══════════════════════════════════════════════════════════════════════════════# (1) THE GATE — jump_kind="none", depth=0 (3 tests -> 16% of 19, under 30%)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("structure_gate_launch",))def test_gate_launch(): if not device_online(): record("structure_gate_launch", False, "setup_failed: device offline (tunnel dropped)", depth=0, jump_kind="none") return nodes = _open_library() fg = wait_for_foreground() # Single-activity Compose app: the root is a ComposeView inside a ViewGroup. container = (find_by_class(nodes, "ComposeView") or find_by_class(nodes, "FrameLayout") or find_by_class(nodes, "ViewGroup")) ok = bool(fg and container) record("structure_gate_launch", ok, "" if ok else "setup_failed: app did not reach the foreground with a " "main container", depth=0, jump_kind="none")
@and_test(expects=("structure_gate_topbar", "structure_gate_topbar_vlm"))def test_gate_topbar(): nodes = _open_library() # The top app-bar action host: three icon-only controls by content-desc. have = [find_node(nodes, content_desc=cd) is not None for cd in ("Search", "Filter", "More")] ok = all(have) record("structure_gate_topbar", ok, "" if ok else f"setup_failed: top-bar actions missing " f"(Search/Filter/More present={have})", depth=0, jump_kind="none") vlm_assert("structure_gate_topbar", "Are there exactly three icon buttons grouped together in the " "top-right corner of the screen (in the app's top bar)?", RESULTS_DIR, tag="position")
@and_test(expects=("structure_gate_bottomnav", "structure_gate_bottomnav_vlm"))def test_gate_bottomnav(): nodes = _open_library() # Bottom-nav labels sit near the bottom (y>2000); the same words appear as # a screen title at the top, so disambiguate by y-bound via bf._tab. tabs = [bf._tab(nodes, lbl) for lbl in ("Library", "History", "Browse")] ok = all(t is not None for t in tabs) record("structure_gate_bottomnav", ok, "" if ok else f"setup_failed: bottom-nav tabs missing " f"(found={[t is not None for t in tabs]})", depth=0, jump_kind="none") vlm_assert("structure_gate_bottomnav", "Is there a bottom navigation bar with exactly 3 evenly spaced " "items (each an icon with a label) across the bottom of the screen?", RESULTS_DIR, tag="position")
# ══════════════════════════════════════════════════════════════════════════════# (2) IN-PLACE SHAPE DELTAS — jump_kind="transition", depth=0# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("structure_search_shape",))def test_search_adds_editable_field(): """Tapping Search adds an EditText layer + an 'Exit search' control; exiting removes it. OBSERVED delta: EditText 0 -> 1, restored on Exit search.""" nodes = _open_library() et_before = len(find_by_class(nodes, "EditText")) before = and_showing(nodes) if not tap_node(find_node(nodes, content_desc="Search")): record("structure_search_shape", False, "setup_failed: Search action not tappable", depth=0, jump_kind="transition", expect="EditText 0->1 on Search, restored on Exit search") return settle("tap") mid = ui() et_after = len(find_by_class(mid, "EditText")) exit_present = find_node(mid, content_desc="Exit search") is not None opened = (et_after == et_before + 1) and exit_present # Reverse: exit search must remove the field. ex = find_node(mid, content_desc="Exit search") if ex: tap_node(ex) settle("tap") after = ui() et_end = len(find_by_class(after, "EditText")) restored = (et_end == et_before) and _restored(before, and_showing(after)) ok = opened and restored record("structure_search_shape", ok, "" if ok else f"behavior_wrong: search field delta not as observed " f"(before={et_before} open={et_after} end={et_end} " f"exit={exit_present})", depth=0, jump_kind="transition", expect="EditText 0->1 on Search, restored on Exit search")
@and_test(expects=("structure_filter_sheet", "structure_filter_sheet_vlm"))def test_filter_opens_sheet(): """Filter opens a bottom sheet that adds a Sort/Display option cluster and a 'Close sheet' control; BACK restores the Library shape.""" nodes = _open_library() before = and_showing(nodes) if not tap_node(find_node(nodes, content_desc="Filter")): record("structure_filter_sheet", False, "setup_failed: Filter action not tappable", depth=0, jump_kind="transition", expect="Sort-sheet appears (Sort/Display/Alphabetically), restored on back") vlm_assert("structure_filter_sheet", "Is there a bottom sheet panel anchored to the bottom edge of " "the screen, overlaying the content above it?", RESULTS_DIR, tag="position") return settle("tap") after = ui() a = and_showing(after) opened = (surface_changed(before, a) and find_node_ci(after, "Sort") is not None and find_node_ci(after, "Display") is not None and find_node(after, text="Alphabetically") is not None) # Reverse: BACK closes the sheet (no dangerous control tapped). back() settle("tap") end = ui() restored = (find_node(end, text="Alphabetically") is None and _restored(before, and_showing(end))) ok = opened and restored record("structure_filter_sheet", ok, "" if ok else "behavior_wrong: Filter sheet did not open/restore as " "observed", depth=0, jump_kind="transition", expect="Sort-sheet appears (Sort/Display/Alphabetically), restored on back") # VLM screenshot must show the sheet, so re-open it for the picture. n2 = _open_library() tap_node(find_node(n2, content_desc="Filter")) settle("tap") vlm_assert("structure_filter_sheet", "Is there a bottom sheet panel anchored to the bottom edge of the " "screen, overlaying the content above it?", RESULTS_DIR, tag="position")
@and_test(expects=("structure_more_sheet",))def test_more_opens_sheet(): """More opens a compact bottom sheet with two rows (About app, Settings) plus a drag handle / close control; BACK restores the Library shape.""" nodes = _open_library() before = and_showing(nodes) if not tap_node(find_node(nodes, content_desc="More")): record("structure_more_sheet", False, "setup_failed: More action not tappable", depth=0, jump_kind="transition", expect="More-sheet appears (About app + Settings), restored on back") return settle("tap") after = ui() opened = (surface_changed(before, and_showing(after)) and find_node_ci(after, "About app") is not None and find_node_ci(after, "Settings") is not None) back() settle("tap") end = ui() restored = (find_node_ci(end, "About app") is None and _restored(before, and_showing(end))) ok = opened and restored record("structure_more_sheet", ok, "" if ok else "behavior_wrong: More sheet did not open/restore as " "observed", depth=0, jump_kind="transition", expect="More-sheet appears (About app + Settings), restored on back")
@and_test(expects=("structure_filter_tab_swap",))def test_filter_tab_swaps_option_class(): """Inside the Filter sheet, switching the Sort tab to the Display tab swaps one whole class of options for another: the sort options (Alphabetically / Author / Last read / Progress) disappear and the display options (Display mode / Grid / List / Title position) appear. In-place shape delta.""" nodes = _open_library() if not tap_node(find_node(nodes, content_desc="Filter")): record("structure_filter_tab_swap", False, "setup_failed: Filter action not tappable", depth=0, jump_kind="transition", expect="Sort tab -> Display tab swaps sort options for display options") return settle("tap") sort_nodes = ui() sort_keys = and_showing(sort_nodes) had_sort = find_node(sort_nodes, text="Alphabetically") is not None disp_tab = find_node(sort_nodes, text="Display") if not disp_tab or not tap_node(disp_tab): record("structure_filter_tab_swap", False, "setup_failed: Display tab not tappable inside Filter sheet", depth=0, jump_kind="transition", expect="Sort tab -> Display tab swaps sort options for display options") return settle("tap") disp_nodes = ui() gained_display = (find_node(disp_nodes, text="Display mode") is not None and find_node(disp_nodes, text="Title position") is not None) lost_sort = find_node(disp_nodes, text="Alphabetically") is None swapped = surface_changed(sort_keys, and_showing(disp_nodes), min_delta=4) ok = had_sort and gained_display and lost_sort and swapped record("structure_filter_tab_swap", ok, "" if ok else f"behavior_wrong: Sort/Display tab swap not as observed " f"(had_sort={had_sort} gained_display={gained_display} " f"lost_sort={lost_sort})", depth=0, jump_kind="transition", expect="Sort tab -> Display tab swaps sort options for display options")
@and_test(expects=("structure_selection_mode", "structure_selection_mode_vlm"))def test_longpress_enters_selection_shape(): """Long-pressing a cover switches the top bar into selection mode: a '1 selected' title and a new action cluster (Select all / Move / Delete / Clear) appear. BACK restores the Library shape (never tap Delete/Clear).""" nodes = _open_library() covers = _covers(nodes) if not covers: record("structure_selection_mode", False, "setup_failed: no book cover present (import missing)", depth=0, jump_kind="transition", expect="long-press -> '1 selected' + selection actions, restored on back") vlm_assert("structure_selection_mode", "Does the top bar show a selection count (like '1 selected') " "with several action icons to its right?", RESULTS_DIR, tag="position") return before = and_showing(nodes) long_press(covers[0]) settle("tap") mid = ui() entered = (find_node(mid, text="1 selected") is not None and find_node(mid, content_desc="Select all books") is not None and surface_changed(before, and_showing(mid))) # Reverse via BACK — 'Clear selected items' is a DANGEROUS_TEXT. back() settle("tap") end = ui() restored = (find_node(end, text="1 selected") is None and _restored(before, and_showing(end))) ok = entered and restored record("structure_selection_mode", ok, "" if ok else "behavior_wrong: selection-mode shape not as observed", depth=0, jump_kind="transition", expect="long-press -> '1 selected' + selection actions, restored on back") # Re-enter for the VLM screenshot. n2 = _open_library() cv = _covers(n2) if cv: long_press(cv[0]) settle("tap") vlm_assert("structure_selection_mode", "Does the top bar show a selection count (like '1 selected') with " "several action icons to its right?", RESULTS_DIR, tag="position")
@and_test(expects=("structure_tab_history",))def test_tab_history_changes_surface(): """Switching to the History tab replaces the Library grid surface with the History surface (a 'Today' date group + per-row 'Delete history element').""" nodes = _open_library() before = and_showing(nodes) covers_before = len(_covers(nodes)) tab = bf._tab(nodes, "History") if not tab or not tap_node(tab): record("structure_tab_history", False, "setup_failed: History tab not tappable", depth=0, jump_kind="transition", expect="Library grid -> History surface (Today group), Library covers gone") return settle("tap") after = ui() a = and_showing(after) # History surface: a 'Today' date header / history-row control appears AND # the Library covers vanish. got_history = (find_node(after, text="Today") is not None or find_node(after, content_desc="Delete history element") is not None or find_node(after, content_desc="Delete whole history") is not None) covers_gone = len(_covers(after)) < covers_before or covers_before == 0 ok = got_history and surface_changed(before, a) and covers_gone record("structure_tab_history", ok, "" if ok else f"behavior_wrong: History surface not as observed " f"(got_history={got_history} covers_gone={covers_gone})", depth=0, jump_kind="transition", expect="Library grid -> History surface (Today group), Library covers gone")
@and_test(expects=("structure_tab_browse",))def test_tab_browse_changes_surface(): """Switching to the Browse tab replaces the Library surface with the Browse surface (the scan CTA / empty-state, or a scanned file list). In every case the Library covers are gone and the surface changed materially.""" nodes = _open_library() before = and_showing(nodes) covers_before = len(_covers(nodes)) tab = bf._tab(nodes, "Browse") if not tab or not tap_node(tab): record("structure_tab_browse", False, "setup_failed: Browse tab not tappable", depth=0, jump_kind="transition", expect="Library grid -> Browse surface, covers gone") return settle("tap") time.sleep(1) after = ui() is_browse = (find_node_ci(after, "Set up scanning") is not None or find_node(after, text=bf.BOOK1_FILE) is not None or find_node_ci(after, "Expand the library's book collection with " "your downloads") is not None) covers_gone = len(_covers(after)) < covers_before or covers_before == 0 ok = is_browse and surface_changed(before, and_showing(after)) and covers_gone record("structure_tab_browse", ok, "" if ok else "behavior_wrong: Browse surface not as observed", depth=0, jump_kind="transition", expect="Library grid -> Browse surface, covers gone")
@and_test(expects=("structure_search_empty",))def test_search_query_empties_list(): """A no-match query collapses the populated grid to empty: typing 'zzz' in the search field drops the cover count from >0 to 0; clearing (Exit search) restores the covers. Empty<->populated is a tree-SHAPE delta.""" nodes = _open_library() covers_before = len(_covers(nodes)) if covers_before == 0: record("structure_search_empty", False, "setup_failed: no books present to filter (import missing)", depth=0, jump_kind="transition", expect="search 'zzz' -> 0 covers, restored on exit search") return if not tap_node(find_node(nodes, content_desc="Search")): record("structure_search_empty", False, "setup_failed: Search action not tappable", depth=0, jump_kind="transition", expect="search 'zzz' -> 0 covers, restored on exit search") return settle("tap") ets = find_by_class(ui(), "EditText") if not ets: record("structure_search_empty", False, "setup_failed: search field not present after tapping Search", depth=0, jump_kind="transition", expect="search 'zzz' -> 0 covers, restored on exit search") return type_text(ets[0], "zzz") settle("text") time.sleep(1) covers_empty = len(_covers(ui())) # Reverse: exit search restores the full grid. ex = find_node(ui(), content_desc="Exit search") if ex: tap_node(ex) settle("tap") time.sleep(0.5) covers_restored = len(_covers(ui())) ok = (covers_empty == 0) and (covers_restored >= covers_before) record("structure_search_empty", ok, "" if ok else f"behavior_wrong: list did not empty/restore " f"(before={covers_before} empty={covers_empty} " f"restored={covers_restored})", depth=0, jump_kind="transition", expect="search 'zzz' -> 0 covers, restored on exit search")
# ══════════════════════════════════════════════════════════════════════════════# (3) DEPTH>=1 SHAPE DELTAS — backed by a real navigation call (and_enter*)# ══════════════════════════════════════════════════════════════════════════════
def and_enter_bookinfo(): """Open a book's Book Info by tapping its cover. Backs a depth>=1 claim. Returns (ok, nodes_after).""" nodes = _open_library() covers = _covers(nodes) if not covers: return False, nodes before = and_showing(nodes) if not tap_node(covers[0]): return False, nodes settle("launch") time.sleep(1) after = ui() if surface_changed(before, and_showing(after)): and_enter("book_info") return True, after return False, after
@and_test(expects=("structure_bookinfo_shape", "structure_bookinfo_shape_vlm"))def test_bookinfo_shape(): """Tapping a cover opens the Book Info surface (depth 1): Start / Move / Delete buttons, an Author row, 'No description.', plus a 'Go back' and 'File details' top-bar host. New class of widgets vs the Library grid.""" ok_nav, nodes = and_enter_bookinfo() if not ok_nav: record("structure_bookinfo_shape", False, "setup_failed: could not open Book Info (import missing?)", depth=1, jump_kind="transition", expect="cover tap -> Book Info (Start/Move/Delete/Author), depth 1") vlm_assert("structure_bookinfo_shape", "Is there a large primary action button spanning most of the " "screen width near the bottom of this detail screen?", RESULTS_DIR, depth=1, tag="size") return have = { "Start": find_node_ci(nodes, "Start") is not None, "Move": find_node(nodes, text="Move") is not None, "Delete": find_node(nodes, text="Delete") is not None, "Author": find_node_ci(nodes, "Author") is not None, "desc": find_node(nodes, text="No description.") is not None, "back": find_node(nodes, content_desc="Go back") is not None, } ok = all(have.values()) record("structure_bookinfo_shape", ok, "" if ok else f"behavior_wrong: Book Info shape not as observed {have}", depth=1, jump_kind="transition", expect="cover tap -> Book Info (Start/Move/Delete/Author), depth 1") vlm_assert("structure_bookinfo_shape", "Is there a large primary action button spanning most of the screen " "width near the bottom of this book-detail screen?", RESULTS_DIR, depth=1, tag="size")
def and_enter_settings(): """Library -> More -> Settings. Backs a depth>=1 claim. Returns (ok, nodes).""" nodes = _open_library() if not tap_node(find_node(nodes, content_desc="More")): return False, nodes settle("tap") mid = ui() st = find_node_ci(mid, "Settings") if not st or not tap_node(st): return False, mid settle("launch") time.sleep(0.5) after = ui() if find_node_ci(after, "Appearance") is not None: and_enter("settings_root") return True, after return False, after
@and_test(expects=("structure_settings_root",))def test_settings_root_shape(): """More -> Settings opens the Settings root (depth 1): a vertical list of the five category rows (General / Appearance / Reader / Library / Browse) with a 'Go back' top bar. A distinct surface from any sheet.""" ok_nav, nodes = and_enter_settings() if not ok_nav: record("structure_settings_root", False, "setup_failed: could not open Settings root", depth=1, jump_kind="transition", expect="More->Settings -> 5 category rows, depth 1") return rows = [find_node_ci(nodes, lbl) is not None for lbl in ("General", "Appearance", "Reader", "Library", "Browse")] back_ok = find_node(nodes, content_desc="Go back") is not None ok = all(rows) and back_ok record("structure_settings_root", ok, "" if ok else f"behavior_wrong: Settings root shape not as observed " f"(rows={rows} back={back_ok})", depth=1, jump_kind="transition", expect="More->Settings -> 5 category rows, depth 1")
def and_reach_appearance(): """Library -> More -> Settings -> Appearance. Two surfaces deep -> depth 2.""" ok, _ = and_enter_settings() if not ok: return False, ui() appr = find_node_ci(ui(), "Appearance") if not appr or not tap_node(appr): return False, ui() settle("launch") time.sleep(0.5) after = ui() if find_node_ci(after, "Dark theme") is not None: and_enter("appearance") return True, after return False, after
@and_test(expects=("structure_appearance_puredark", "structure_appearance_dark_vlm"))def test_appearance_dark_adds_puredark(): """A mode switch that adds a class of widget (depth 2): on Appearance, the Dark-theme segmented is System/Disabled/Enabled and there is NO 'Pure dark' row. Selecting 'Enabled' adds a whole new 'Pure dark' (Disabled/Enabled/ Saver) segmented block; selecting 'System' again REMOVES it (restores).""" ok_nav, nodes = and_reach_appearance() if not ok_nav: record("structure_appearance_puredark", False, "setup_failed: could not reach Appearance settings", depth=2, jump_kind="transition", expect="Enabled adds 'Pure dark' block, removed again on System (depth 2)") vlm_assert("structure_appearance_dark", "Is the overall background of this screen dark (near-black or " "very dark grey) rather than white?", RESULTS_DIR, depth=2, tag="color") return pure_before = find_node_ci(nodes, "Pure dark") is not None en = find_node(nodes, text="Enabled") added = False if en and tap_node(en): settle("tap") time.sleep(1) added = find_node_ci(ui(), "Pure dark") is not None # Capture the dark VLM shot while the app is dark. vlm_assert("structure_appearance_dark", "Is the overall background of this screen dark (near-black or very " "dark grey) rather than white?", RESULTS_DIR, depth=2, tag="color") # Reverse: back to System removes the Pure dark block (leave app light). removed = False sysbtn = find_node(ui(), text="System") if sysbtn and tap_node(sysbtn): settle("tap") time.sleep(1) removed = find_node_ci(ui(), "Pure dark") is None ok = (not pure_before) and added and removed record("structure_appearance_puredark", ok, "" if ok else f"behavior_wrong: Pure-dark block delta not as observed " f"(before={pure_before} added={added} removed={removed})", depth=2, jump_kind="transition", expect="Enabled adds 'Pure dark' block, removed again on System (depth 2)")
@and_test(expects=("structure_reader_open", "structure_reader_open_vlm"))def test_reader_open_shape(): """Opening the reader (depth 2) is the deepest shape delta: the immersive Reader surface renders the book body as dump-readable text — a 'Chapter One' heading and a long paragraph node — which no other surface has.""" ok = bf.open_reader(BOOK) # imports if needed, dismisses the cling if ok: and_enter("book_info") and_enter("reader") nodes = ui() has_heading = find_node(nodes, text="Chapter One") is not None long_body = [n for n in nodes if len(n.get("text", "")) > 40] rendered = has_heading and len(long_body) > 0 verdict = bool(ok and rendered) record("structure_reader_open", verdict, "" if verdict else "feature_missing: reader did not render book text " "(no 'Chapter One' heading / body paragraph)", depth=2, jump_kind="transition", expect="reader renders 'Chapter One' heading + body paragraph, depth 2") vlm_assert("structure_reader_open", "Does a block of body text (multiple lines of a paragraph) fill " "most of the screen area?", RESULTS_DIR, depth=2, tag="size")
@and_test(expects=("structure_reader_settings_sheet",))def test_reader_settings_sheet_shape(): """Inside the reader (depth 2), tapping the reader-settings icon adds a bottom sheet layer with the General / Reader / Colors tab cluster (depth 3). A new window layer over the immersive page.""" if not bf.open_reader(BOOK): record("structure_reader_settings_sheet", False, "setup_failed: reader would not open", depth=3, jump_kind="transition", expect="reader -> Reader settings sheet (General/Reader/Colors), depth 3") return and_enter("book_info") and_enter("reader") bf.reader_show_menu() # taps center to reveal the bars time.sleep(1) menu = ui() before = and_showing(menu) rs = find_node(menu, content_desc="Reader settings") if not rs or not tap_node(rs): record("structure_reader_settings_sheet", False, "setup_failed: Reader settings icon not found in reader bars", depth=3, jump_kind="transition", expect="reader -> Reader settings sheet (General/Reader/Colors), depth 3") return settle("launch") time.sleep(1) after = ui() and_enter("reader_settings") got_tabs = (find_node_ci(after, "General") is not None and find_node_ci(after, "Colors") is not None and find_node_ci(after, "Reading mode") is not None) ok = got_tabs and surface_changed(before, and_showing(after)) record("structure_reader_settings_sheet", ok, "" if ok else "behavior_wrong: Reader settings sheet not as observed", depth=3, jump_kind="transition", expect="reader -> Reader settings sheet (General/Reader/Colors), depth 3")
@and_test(expects=("structure_chapters_drawer",))def test_chapters_drawer_shape(): """Inside the reader (depth 2), tapping the Chapters icon opens a chapter list layer (depth 3) whose 'Chapter One' entry appears — a distinct surface from the reading page.""" if not bf.open_reader(BOOK): record("structure_chapters_drawer", False, "setup_failed: reader would not open", depth=3, jump_kind="transition", expect="reader -> Chapters drawer (chapter list), depth 3") return and_enter("book_info") and_enter("reader") bf.reader_show_menu() time.sleep(1) menu = ui() before = and_showing(menu) ch = find_node(menu, content_desc="Chapters") if not ch or not tap_node(ch): record("structure_chapters_drawer", False, "setup_failed: Chapters icon not found in reader bars", depth=3, jump_kind="transition", expect="reader -> Chapters drawer (chapter list), depth 3") return settle("launch") time.sleep(1) after = ui() and_enter("chapters") got_drawer = find_node(after, text="Chapter One") is not None ok = got_drawer and surface_changed(before, and_showing(after)) record("structure_chapters_drawer", ok, "" if ok else "behavior_wrong: Chapters drawer not as observed", depth=3, jump_kind="transition", expect="reader -> Chapters drawer (chapter list), depth 3")
# ── VLM #8 (library grid layout) ──────────────────────────────────────────────
@and_test(expects=("structure_library_grid_vlm",))def test_library_grid_vlm(): """VLM-only: the populated Library shows the two book covers side by side in a grid row. Exact rendered SHAPE the dump cannot fully express.""" nodes = _open_library() covers = _covers(nodes) if len(covers) < 2: # Try to ensure the second book is present, then re-open. bf.import_book(bf.BOOK2_TITLE, bf.BOOK2_FILE) _open_library() vlm_assert("structure_library_grid", "Are there two book cover cards displayed side by side in the same " "row (a grid layout), rather than stacked vertically?", RESULTS_DIR, tag="shape")
# ══════════════════════════════════════════════════════════════════════════════
TESTS = [ # GATE (jump_kind="none") test_gate_launch, test_gate_topbar, test_gate_bottomnav, # in-place shape deltas (depth 0) test_search_adds_editable_field, test_filter_opens_sheet, test_more_opens_sheet, test_filter_tab_swaps_option_class, test_longpress_enters_selection_shape, test_tab_history_changes_surface, test_tab_browse_changes_surface, test_search_query_empties_list, # depth>=1 shape deltas (backed by and_enter*/and_reach*) test_bookinfo_shape, test_settings_root_shape, test_appearance_dark_adds_puredark, test_reader_open_shape, test_reader_settings_sheet_shape, test_chapters_drawer_shape, # VLM-only grid layout test_library_grid_vlm,]
if __name__ == "__main__": run_suite(TESTS, "structure")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745#!/usr/bin/env python3"""TEXT module — CONTENT / OUTPUT strings an interaction PRODUCES for Book's Story.
Lane: SOLE OWNER of exact-string equality. Every case is TRIGGER -> OBSERVATION:drive the user path, read the produced string out of a FRESH ui(), and assert thewords match what the ORIGINAL app rendered. The discriminating half is the CHANGE:each string is asserted ABSENT on the Library at launch and PRESENT only after thetrigger, so a dead shell that renders nothing (or renders a hardcoded label atlaunch) FAILS instead of passing.
GROUND TRUTH — every string below was OBSERVED on the running original withscratch dumps before it was hardcoded here (see the recon report + explore runs):
Library (depth 0), empty state after clear_data: * subtitle TextView "Read your favorite books and sort them between categories" * CTA TextView "Add a book" * top-bar title "Library" Library ▸ Search icon (content-desc "Search") -> in-place search field whose placeholder is a TextView "Search…" (real ellipsis U+2026, not "..."), plus a content-desc "Exit search". Absent until Search is tapped. Library ▸ Filter icon -> bottom sheet, tabs "Sort"/"Display", sort options "Alphabetically"/"Last read"/"Progress"/"Author". Library ▸ More icon -> bottom sheet items "About app" and "Settings". Book Info (depth 1, tap a cover): title "testbook", Author label (content-desc "Author" on an icon) with value "Unknown", "0%", "No description.", "Start". Settings root (depth 1, More ▸ Settings): rows General "App language", Appearance "Theme, colors", Reader "Font, text", Library "Categories, display, tabs", Browse "Scan, display"; title "Settings". About app (depth 2, More ▸ About app): rows "Report a bug", "Contributors", "Open source licenses", "Credits", "Help translate", "Support development"; title "About app". (The version string "Book's Story v1.8.0" is an upstream constant and is NEVER asserted.) Reader (depth 2, open a book): heading "Chapter One" + first paragraph starting "The quick brown fox jumps over the lazy dog." rendered in the view tree. Tap center -> top bar shows book title "testbook" and chapter "Chapter One". Browse tab (granted): folder-path header "/storage/emulated/0/Download/Books". History tab (after a book has been opened): date-group header "Today" + book title "testbook". (The per-row timestamp is a clock value -> NOT asserted.)
Depth is backed by real navigation: file-local and_reach_* helpers each take abefore/after surface snapshot and prove the TARGET element appeared (and_reach),counting the surface via and_enter. VLM BUDGET FOR THIS FILE: 0 — every stringhere is dump-readable from the view tree, so there are no vlm_assert calls."""import osimport sysimport time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,F401import book_fixture as bf # shared, validated import helper
BOOK1 = bf.BOOK1_TITLE # "testbook"BOOK2 = bf.BOOK2_TITLE # "alpha_wonderland"
# Exact strings OBSERVED on the original (see module docstring).SEARCH_HINT = "Search…" # real ellipsis, not "..."EMPTY_SUBTITLE = "Read your favorite books and sort them between categories"EMPTY_CTA = "Add a book"NO_DESCRIPTION = "No description."FOLDER_PATH = "/storage/emulated/0/Download/Books"FIRST_SENTENCE = "The quick brown fox jumps over the lazy dog."
TESTS = []
def _t(fn): TESTS.append(fn) return fn
# ── local helpers ────────────────────────────────────────────────────────────def all_text(nodes): """Every visible text string in the tree, joined — for substring probes.""" return " | ".join(n.get("text", "") for n in nodes if n.get("text"))
def all_desc(nodes): """Every content-desc in the tree, joined — labels ride on content-desc for Compose icons (e.g. the Book Info "Author" label).""" return " | ".join(n.get("content-desc", "") for n in nodes if n.get("content-desc"))
def has_text(nodes, s): """Case-sensitive substring across text, then case-insensitive exact via the kit — a faithful recreation may differ in casing but not in the words.""" return (s in all_text(nodes)) or (find_node_ci(nodes, s) is not None)
def _open_library(): """Land on the Library tab from a fresh launch.""" restart_app() wait_for_foreground() bf._open_tab("Library") time.sleep(0.5)
def and_reach_sheet(content_desc, target): """Tap a Library top-bar icon (Filter/More) and PROVE its bottom sheet surfaced by `target` appearing. Counts one surface. Returns (ok, note).""" nodes = ui() trig = find_node(nodes, content_desc=content_desc) if not trig: return False, f"setup_failed: '{content_desc}' icon not on the Library top bar" before = and_showing(nodes) if not tap_node(trig): return False, f"setup_failed: '{content_desc}' icon not tappable" settle("tap") time.sleep(0.8) after = and_showing() if not (and_reach(before, after, target) or surface_changed(before, after)): return False, f"behavior_wrong: no sheet opened after tapping '{content_desc}'" and_enter(content_desc) return True, ""
def and_reach_settings_root(): """Library ▸ More ▸ Settings. Crosses one surface (the Settings root screen). Returns (ok, note).""" ok, note = and_reach_sheet("More", "Settings") if not ok: return False, note sett = find_node(ui(), text="Settings") if not sett: return False, "setup_failed: 'Settings' item missing from the More sheet" before = and_showing() tap_node(sett) settle("launch") time.sleep(0.8) after = and_showing() if not and_reach(before, after, "App language"): return False, "behavior_wrong: Settings root did not open (no category rows)" and_enter("Settings") return True, ""
def and_reach_about(): """Library ▸ More ▸ About app. Crosses one surface (the About screen). Returns (ok, note).""" ok, note = and_reach_sheet("More", "About app") if not ok: return False, note ab = find_node(ui(), text="About app") if not ab: return False, "setup_failed: 'About app' item missing from the More sheet" before = and_showing() tap_node(ab) settle("launch") time.sleep(0.8) after = and_showing() if not and_reach(before, after, "Report a bug"): return False, "behavior_wrong: About screen did not open" and_enter("About app") return True, ""
def and_reach_book_info(title): """Library -> Book Info by tapping the cover, PROVING the jump (the 'No description.' / 'Start' surface appeared and the Library tab bar vanished). Crosses one surface. Returns (ok, note).""" before = and_showing() if not bf.open_book_info(title): return False, "setup_failed: Book Info did not open" after = and_showing() # Book Info is proven by its unique controls appearing (Start/Move) while the # Library's bottom-nav 'Browse' tab disappears. if not (and_reach(before, after, "Start", source="Browse") or and_reach(before, after, "Move")): return False, "behavior_wrong: Book Info surface did not appear" and_enter("Book Info") return True, ""
def and_reach_reader(title): """Library -> Book Info -> Reader, PROVING the reader rendered book text ('Chapter One' appeared and the Book Info 'Start' button vanished). Crosses two surfaces (Book Info, then Reader). Returns (ok, note).""" ok, note = and_reach_book_info(title) if not ok: return False, note before = and_showing() start = find_node(ui(), text="Start") or find_node(ui(), text="Continue") if not start: return False, "setup_failed: no Start/Continue button on Book Info" tap_node(start) settle("launch") time.sleep(2) got = find_node(ui(), text="Got it") # one-time immersive-mode system cling if got: tap_node(got) settle("tap") time.sleep(1) after = and_showing() if not and_reach(before, after, "Chapter One", source="Start"): return False, "behavior_wrong: reader did not render book text" and_enter("Reader") return True, ""
def and_reach_history_tab(): """Switch from Library to the History tab. Counts one surface. Returns bool.""" before = and_showing() if not bf._open_tab("History"): return False time.sleep(0.8) after = and_showing() ok = and_reach(before, after, "History") if ok: and_enter("History") return ok
def and_reach_browse_tab(): """Switch from Library to the Browse tab. Counts one surface. Returns bool.""" before = and_showing() if not bf._open_tab("Browse"): return False time.sleep(0.8) after = and_showing() ok = surface_changed(before, after) if ok: and_enter("Browse") return ok
# ══════════════════════════════════════════════════════════════════════════════# 1. Library empty-state subtitle# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_empty_state_subtitle",))def test_empty_state_subtitle(): name = "text_empty_state_subtitle" # Wipe to a virgin library so the empty state renders (the grant/library are # re-imported by later tests via bf.import_book). clear_data() restart_app() wait_for_foreground() time.sleep(1.5) nodes = ui() ok = EMPTY_SUBTITLE in all_text(nodes) record(name, ok, "" if ok else f"feature_missing: empty-library subtitle not found; " f"got {all_text(nodes)[:120]!r}", depth=0, jump_kind="none", expect=EMPTY_SUBTITLE)
# ══════════════════════════════════════════════════════════════════════════════# 2. Library empty-state CTA label "Add a book"# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_empty_state_cta",))def test_empty_state_cta(): name = "text_empty_state_cta" clear_data() restart_app() wait_for_foreground() time.sleep(1.5) nodes = ui() n = find_node(nodes, text=EMPTY_CTA) or find_node_ci(nodes, EMPTY_CTA) ok = n is not None record(name, ok, "" if ok else "feature_missing: 'Add a book' CTA not on the empty library", depth=0, jump_kind="none", expect=EMPTY_CTA)
# ══════════════════════════════════════════════════════════════════════════════# 3. Search field placeholder "Search…" (produced by tapping Search)# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_search_hint",))def test_search_hint(): name = "text_search_hint" _open_library() absent = SEARCH_HINT not in all_text(ui()) trig = find_node(ui(), content_desc="Search") if not trig: record(name, False, "setup_failed: Search icon not on the Library top bar", depth=0, jump_kind="value", expect=f"placeholder {SEARCH_HINT!r}") return tap_node(trig) settle("tap") time.sleep(0.8) present = SEARCH_HINT in all_text(ui()) ok = absent and present record(name, ok, "" if ok else "behavior_wrong: search placeholder 'Search…' did not " "appear after tapping Search", depth=0, jump_kind="value", expect=f"search field placeholder reads {SEARCH_HINT!r}")
# ══════════════════════════════════════════════════════════════════════════════# 4. Filter sheet tab labels "Sort" / "Display"# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_filter_tabs",))def test_filter_tabs(): name = "text_filter_tabs" _open_library() absent = not has_text(ui(), "Display") ok_open, note = and_reach_sheet("Filter", "Sort") if not ok_open: record(name, False, note, depth=1, jump_kind="reach", expect="Filter sheet tabs 'Sort' and 'Display'") return nodes = ui() got_sort = has_text(nodes, "Sort") got_display = has_text(nodes, "Display") ok = absent and got_sort and got_display record(name, ok, "" if ok else f"behavior_wrong: Filter sheet tabs missing " f"(Sort={got_sort} Display={got_display})", depth=1, jump_kind="reach", expect="Filter sheet tabs 'Sort' and 'Display'")
# ══════════════════════════════════════════════════════════════════════════════# 5. Filter sheet sort-option labels (Alphabetically / Last read / Progress / Author)# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_filter_sort_options",))def test_filter_sort_options(): name = "text_filter_sort_options" _open_library() absent = not has_text(ui(), "Alphabetically") ok_open, note = and_reach_sheet("Filter", "Sort") if not ok_open: record(name, False, note, depth=1, jump_kind="reach", expect="sort options Alphabetically/Last read/Progress/Author") return nodes = ui() want = ["Alphabetically", "Last read", "Progress", "Author"] missing = [w for w in want if not has_text(nodes, w)] ok = absent and not missing record(name, ok, "" if ok else f"behavior_wrong: missing sort options {missing}", depth=1, jump_kind="reach", expect="sort options 'Alphabetically', 'Last read', 'Progress', 'Author'")
# ══════════════════════════════════════════════════════════════════════════════# 6. More sheet items "About app" and "Settings"# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_more_sheet_items",))def test_more_sheet_items(): name = "text_more_sheet_items" _open_library() absent = not (has_text(ui(), "About app") and has_text(ui(), "Settings")) ok_open, note = and_reach_sheet("More", "About app") if not ok_open: record(name, False, note, depth=1, jump_kind="reach", expect="More sheet items 'About app' and 'Settings'") return nodes = ui() got_about = has_text(nodes, "About app") got_settings = has_text(nodes, "Settings") ok = absent and got_about and got_settings record(name, ok, "" if ok else f"behavior_wrong: More sheet items missing " f"(About app={got_about} Settings={got_settings})", depth=1, jump_kind="reach", expect="More sheet items 'About app' and 'Settings'")
# ══════════════════════════════════════════════════════════════════════════════# 7. Book Info — "No description." (produced on the Book Info surface)# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_bookinfo_no_description",))def test_bookinfo_no_description(): name = "text_bookinfo_no_description" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=1, jump_kind="reach", expect=NO_DESCRIPTION) return _open_library() absent = NO_DESCRIPTION not in all_text(ui()) ok_nav, note = and_reach_book_info(BOOK1) if not ok_nav: record(name, False, note, depth=1, jump_kind="reach", expect=NO_DESCRIPTION) return present = NO_DESCRIPTION in all_text(ui()) ok = absent and present record(name, ok, "" if ok else "behavior_wrong: Book Info did not render 'No description.'", depth=1, jump_kind="reach", expect=NO_DESCRIPTION)
# ══════════════════════════════════════════════════════════════════════════════# 8. Book Info — Author label "Author" + value "Unknown"# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_bookinfo_author",))def test_bookinfo_author(): name = "text_bookinfo_author" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=1, jump_kind="reach", expect="Author label + value 'Unknown'") return _open_library() ok_nav, note = and_reach_book_info(BOOK1) if not ok_nav: record(name, False, note, depth=1, jump_kind="reach", expect="Author label + value 'Unknown'") return nodes = ui() # "Author" is a content-desc on an icon; "Unknown" is the value TextView. got_author = ("Author" in all_desc(nodes)) or has_text(nodes, "Author") got_unknown = has_text(nodes, "Unknown") ok = got_author and got_unknown record(name, ok, "" if ok else f"behavior_wrong: Author label/value wrong " f"(Author={got_author} Unknown={got_unknown})", depth=1, jump_kind="reach", expect="Author label present with value 'Unknown'")
# ══════════════════════════════════════════════════════════════════════════════# 9. Book Info — "Start" button label# ══════════��═══════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_bookinfo_start_button",))def test_bookinfo_start_button(): name = "text_bookinfo_start_button" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=1, jump_kind="reach", expect="button label 'Start'") return _open_library() absent = not has_text(ui(), "Start") ok_nav, note = and_reach_book_info(BOOK1) if not ok_nav: record(name, False, note, depth=1, jump_kind="reach", expect="button label 'Start'") return n = find_node(ui(), text="Start") or find_node_ci(ui(), "Start") ok = absent and (n is not None) record(name, ok, "" if ok else "behavior_wrong: Book Info has no 'Start' button label", depth=1, jump_kind="reach", expect="button label 'Start'")
# ══════════════════════════════════════════════════════════════════════════════# 10-13. Settings root category subtitles (four separate produced strings)# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_settings_general_subtitle",))def test_settings_general_subtitle(): name = "text_settings_general_subtitle" _open_library() absent = not has_text(ui(), "App language") ok_nav, note = and_reach_settings_root() if not ok_nav: record(name, False, note, depth=1, jump_kind="reach", expect="General row subtitle 'App language'") return ok = absent and has_text(ui(), "App language") record(name, ok, "" if ok else "behavior_wrong: General subtitle 'App language' not on Settings", depth=1, jump_kind="reach", expect="General row subtitle 'App language'")
@_t@and_test(expects=("text_settings_appearance_subtitle",))def test_settings_appearance_subtitle(): name = "text_settings_appearance_subtitle" _open_library() absent = not has_text(ui(), "Theme, colors") ok_nav, note = and_reach_settings_root() if not ok_nav: record(name, False, note, depth=1, jump_kind="reach", expect="Appearance row subtitle 'Theme, colors'") return ok = absent and has_text(ui(), "Theme, colors") record(name, ok, "" if ok else "behavior_wrong: Appearance subtitle 'Theme, colors' not on Settings", depth=1, jump_kind="reach", expect="Appearance row subtitle 'Theme, colors'")
@_t@and_test(expects=("text_settings_reader_subtitle",))def test_settings_reader_subtitle(): name = "text_settings_reader_subtitle" _open_library() absent = not has_text(ui(), "Font, text") ok_nav, note = and_reach_settings_root() if not ok_nav: record(name, False, note, depth=1, jump_kind="reach", expect="Reader row subtitle 'Font, text'") return ok = absent and has_text(ui(), "Font, text") record(name, ok, "" if ok else "behavior_wrong: Reader subtitle 'Font, text' not on Settings", depth=1, jump_kind="reach", expect="Reader row subtitle 'Font, text'")
@_t@and_test(expects=("text_settings_library_subtitle",))def test_settings_library_subtitle(): name = "text_settings_library_subtitle" _open_library() absent = not has_text(ui(), "Categories, display, tabs") ok_nav, note = and_reach_settings_root() if not ok_nav: record(name, False, note, depth=1, jump_kind="reach", expect="Library row subtitle 'Categories, display, tabs'") return ok = absent and has_text(ui(), "Categories, display, tabs") record(name, ok, "" if ok else "behavior_wrong: Library subtitle 'Categories, display, tabs' " "not on Settings", depth=1, jump_kind="reach", expect="Library row subtitle 'Categories, display, tabs'")
# ══════════════════════════════════════════════════════════════════════════════# 14-16. About app row labels (three separate produced strings)# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_about_report_bug",))def test_about_report_bug(): name = "text_about_report_bug" _open_library() absent = not has_text(ui(), "Report a bug") ok_nav, note = and_reach_about() if not ok_nav: record(name, False, note, depth=2, jump_kind="reach", expect="About row label 'Report a bug'") return ok = absent and has_text(ui(), "Report a bug") record(name, ok, "" if ok else "behavior_wrong: 'Report a bug' row not on the About screen", depth=2, jump_kind="reach", expect="About row label 'Report a bug'")
@_t@and_test(expects=("text_about_licenses",))def test_about_licenses(): name = "text_about_licenses" _open_library() absent = not has_text(ui(), "Open source licenses") ok_nav, note = and_reach_about() if not ok_nav: record(name, False, note, depth=2, jump_kind="reach", expect="About row label 'Open source licenses'") return ok = absent and has_text(ui(), "Open source licenses") record(name, ok, "" if ok else "behavior_wrong: 'Open source licenses' row not on the About screen", depth=2, jump_kind="reach", expect="About row label 'Open source licenses'")
@_t@and_test(expects=("text_about_support_development",))def test_about_support_development(): name = "text_about_support_development" _open_library() absent = not has_text(ui(), "Support development") ok_nav, note = and_reach_about() if not ok_nav: record(name, False, note, depth=2, jump_kind="reach", expect="About row label 'Support development'") return ok = absent and has_text(ui(), "Support development") record(name, ok, "" if ok else "behavior_wrong: 'Support development' row not on the About screen", depth=2, jump_kind="reach", expect="About row label 'Support development'")
# ══════════════════════════════════════════════════════════════════════════════# 17. Reader — "Chapter One" heading (produced in the Reader view tree)# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_reader_chapter_heading",))def test_reader_chapter_heading(): name = "text_reader_chapter_heading" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=2, jump_kind="reach", expect="reader heading 'Chapter One'") return _open_library() absent = not has_text(ui(), "Chapter One") ok_nav, note = and_reach_reader(BOOK1) if not ok_nav: record(name, False, note, depth=2, jump_kind="reach", expect="reader heading 'Chapter One'") return present = has_text(ui(), "Chapter One") ok = absent and present record(name, ok, "" if ok else "behavior_wrong: reader did not render the 'Chapter One' heading", depth=2, jump_kind="reach", expect="reader heading 'Chapter One'")
# ══════════════════════════════════════════════════════════════════════════════# 18. Reader — first paragraph sentence (dump-readable body content)# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_reader_first_paragraph",))def test_reader_first_paragraph(): name = "text_reader_first_paragraph" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=2, jump_kind="value", expect=FIRST_SENTENCE) return _open_library() absent = FIRST_SENTENCE not in all_text(ui()) ok_nav, note = and_reach_reader(BOOK1) if not ok_nav: record(name, False, note, depth=2, jump_kind="value", expect=FIRST_SENTENCE) return present = FIRST_SENTENCE in all_text(ui()) ok = absent and present record(name, ok, "" if ok else "behavior_wrong: reader body did not contain the first " "paragraph sentence", depth=2, jump_kind="value", expect=f"reader body contains {FIRST_SENTENCE!r}")
# ══════════════════════════════════════════════════════════════════════════════# 19. Reader top bar — book title "testbook" + chapter "Chapter One"# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_reader_topbar_title",))def test_reader_topbar_title(): name = "text_reader_topbar_title" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=2, jump_kind="value", expect=f"reader top bar shows title {BOOK1!r} and 'Chapter One'") return _open_library() ok_nav, note = and_reach_reader(BOOK1) if not ok_nav: record(name, False, note, depth=2, jump_kind="value", expect=f"reader top bar shows title {BOOK1!r} and 'Chapter One'") return nodes = bf.reader_show_menu() # The reader toolbar sits at the very top (y < 230); the book text starts # below it. Read the title + chapter labels from the toolbar band only. topbar = [n for n in nodes if n.get("text") and n.get("_bounds", (0, 9999, 0, 0))[1] < 230] top_text = " | ".join(n.get("text", "") for n in topbar) got_title = BOOK1 in top_text or (find_node_ci(topbar, BOOK1) is not None) got_chapter = "Chapter One" in top_text ok = got_title and got_chapter record(name, ok, "" if ok else f"behavior_wrong: reader top bar missing title/chapter " f"(title={got_title} chapter={got_chapter}); band={top_text!r}", depth=2, jump_kind="value", expect=f"reader top bar shows title {BOOK1!r} and chapter 'Chapter One'")
# ══════════════════════════════════════════════════════════════════════════════# 20. History — date-group header "Today" produced after reading a book# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_history_today_group",))def test_history_today_group(): name = "text_history_today_group" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=1, jump_kind="reach", expect="History date-group header 'Today'") return # Ensure a history entry exists by opening the reader once. if not bf.open_reader(BOOK1): record(name, False, "setup_failed: could not open the reader to seed history", depth=1, jump_kind="reach", expect="History date-group header 'Today'") return _open_library() absent = not has_text(ui(), "Today") if not and_reach_history_tab(): record(name, False, "setup_failed: could not switch to the History tab", depth=1, jump_kind="reach", expect="History date-group header 'Today'") return present = has_text(ui(), "Today") ok = absent and present record(name, ok, "" if ok else "behavior_wrong: History did not show the 'Today' date group", depth=1, jump_kind="reach", expect="History date-group header 'Today'")
# ══════════════════════════════════════════════════════════════════════════════# 21. History — book title "testbook" listed under the history entry# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_history_book_title",))def test_history_book_title(): name = "text_history_book_title" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=1, jump_kind="reach", expect=f"History lists book title {BOOK1!r}") return if not bf.open_reader(BOOK1): record(name, False, "setup_failed: could not open the reader to seed history", depth=1, jump_kind="reach", expect=f"History lists book title {BOOK1!r}") return _open_library() if not and_reach_history_tab(): record(name, False, "setup_failed: could not switch to the History tab", depth=1, jump_kind="reach", expect=f"History lists book title {BOOK1!r}") return nodes = ui() # The title must appear alongside the "Today" group (i.e. as a history row). ok = has_text(nodes, "Today") and (find_node(nodes, text=BOOK1) is not None) record(name, ok, "" if ok else f"behavior_wrong: History did not list the book title {BOOK1!r}", depth=1, jump_kind="reach", expect=f"History lists book title {BOOK1!r}")
# ══════════════════════════════════════════════════════════════════════════════# 22. Browse — granted folder-path header# ══════════════════════════════════════════════════════════════════════════════@_t@and_test(expects=("text_browse_folder_path",))def test_browse_folder_path(): name = "text_browse_folder_path" ok_imp, imp_note = bf.import_book(BOOK1, bf.BOOK1_FILE) if not ok_imp: record(name, False, f"setup_failed: could not import {BOOK1} ({imp_note})", depth=1, jump_kind="reach", expect=FOLDER_PATH) return _open_library() absent = FOLDER_PATH not in all_text(ui()) if not and_reach_browse_tab(): record(name, False, "setup_failed: could not switch to the Browse tab", depth=1, jump_kind="reach", expect=FOLDER_PATH) return present = FOLDER_PATH in all_text(ui()) ok = absent and present record(name, ok, "" if ok else f"behavior_wrong: Browse did not show the folder path {FOLDER_PATH!r}", depth=1, jump_kind="reach", expect=FOLDER_PATH)
if __name__ == "__main__": if not device_online(): print("Device offline — aborting.") sys.exit(2) run_suite(TESTS, "text")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887{ "manifest_version": 1, "kit_api_version": 1, "task_id": "book-story", "baseline_model": "claude-opus-4-8", "baseline_package": "", "total": 138, "manifest_sha": "eab8271e17ca", "tests": [ { "name": "computation::computation_bg_color_red", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_bg_swatch_vlm", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_book_info_progress", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_font_color_red", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_font_size_label", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_font_swatch_vlm", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_letter_spacing_label", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_library_count_badge", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_reader_progress", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_search_alpha", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_search_book", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_search_clear_restores", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_search_count_badge", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_search_no_match", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_search_testbook", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_search_wonderland", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_size_percent_label", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_swatches_differ_vlm", "module": "computation", "baseline_status": "passed" }, { "name": "interaction::interaction_book_info_actions_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_book_survives_process_death", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_book_survives_process_death_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_clear_selection_exits", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_history_entry_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_history_survives_process_death", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_library_two_cards_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_longpress_enters_selection", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_longpress_selection_actions", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_longpress_selection_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_move_sheet_opens", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_multi_record_integrity", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_multi_record_survives_death", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_open_reader_shows_text", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_reader_page_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_reading_creates_history", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_second_book_survives_process_death", "module": "interaction", "baseline_status": "passed" }, { "name": "navigation::nav_backstack_credits_to_about", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_backstack_exit_search", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_backstack_info_to_library", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_backstack_reader_to_info", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_backstack_settings_to_library", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_backstack_tab_history", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_about", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_about_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_appearance", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_book_info", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_book_info_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_browse", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_browse_settings", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_chapters_drawer", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_credits", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_general", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_history", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_history_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_library_from_browse", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_library_settings", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_licenses", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_more_sheet", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_more_sheet_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_reader", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_reader_settings_screen", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_reader_settings_sheet", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_reader_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_search", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_settings", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_settings_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "states::states_app_theme_ring_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_app_theme_select", "module": "states", "baseline_status": "passed" }, { "name": "states::states_app_theme_select_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_chapter_title_align", "module": "states", "baseline_status": "passed" }, { "name": "states::states_dark_theme_enable", "module": "states", "baseline_status": "passed" }, { "name": "states::states_dark_theme_enable_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_dark_theme_highlight_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_dark_theme_persists", "module": "states", "baseline_status": "passed" }, { "name": "states::states_dark_theme_persists_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_display_highlight_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_display_mode_list", "module": "states", "baseline_status": "passed" }, { "name": "states::states_display_mode_list_grid_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_display_mode_list_list_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_display_mode_persists", "module": "states", "baseline_status": "passed" }, { "name": "states::states_display_mode_persists_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_font_style_italic", "module": "states", "baseline_status": "passed" }, { "name": "states::states_font_style_italic_highlight_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_nav_labels_hide", "module": "states", "baseline_status": "passed" }, { "name": "states::states_nav_labels_hide_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_nav_labels_persist", "module": "states", "baseline_status": "passed" }, { "name": "states::states_progress_count_change", "module": "states", "baseline_status": "passed" }, { "name": "states::states_progress_count_change_highlight_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_search_focus", "module": "states", "baseline_status": "passed" }, { "name": "states::states_text_align_highlight_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_text_alignment_change", "module": "states", "baseline_status": "passed" }, { "name": "states::states_title_position_toggle", "module": "states", "baseline_status": "passed" }, { "name": "structure::structure_appearance_dark_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_appearance_puredark", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_bookinfo_shape", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_bookinfo_shape_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_chapters_drawer", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_filter_sheet", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_filter_sheet_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_filter_tab_swap", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_gate_bottomnav", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_gate_bottomnav_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_gate_launch", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_gate_topbar", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_gate_topbar_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_library_grid_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_more_sheet", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_reader_open", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_reader_open_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_reader_settings_sheet", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_search_empty", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_search_shape", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_selection_mode", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_selection_mode_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_settings_root", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_tab_browse", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_tab_history", "module": "structure", "baseline_status": "passed" }, { "name": "text::text_about_licenses", "module": "text", "baseline_status": "passed" }, { "name": "text::text_about_report_bug", "module": "text", "baseline_status": "passed" }, { "name": "text::text_about_support_development", "module": "text", "baseline_status": "passed" }, { "name": "text::text_bookinfo_author", "module": "text", "baseline_status": "passed" }, { "name": "text::text_bookinfo_no_description", "module": "text", "baseline_status": "passed" }, { "name": "text::text_bookinfo_start_button", "module": "text", "baseline_status": "passed" }, { "name": "text::text_browse_folder_path", "module": "text", "baseline_status": "passed" }, { "name": "text::text_empty_state_cta", "module": "text", "baseline_status": "passed" }, { "name": "text::text_empty_state_subtitle", "module": "text", "baseline_status": "passed" }, { "name": "text::text_filter_sort_options", "module": "text", "baseline_status": "passed" }, { "name": "text::text_filter_tabs", "module": "text", "baseline_status": "passed" }, { "name": "text::text_history_book_title", "module": "text", "baseline_status": "passed" }, { "name": "text::text_history_today_group", "module": "text", "baseline_status": "passed" }, { "name": "text::text_more_sheet_items", "module": "text", "baseline_status": "passed" }, { "name": "text::text_reader_chapter_heading", "module": "text", "baseline_status": "passed" }, { "name": "text::text_reader_first_paragraph", "module": "text", "baseline_status": "passed" }, { "name": "text::text_reader_topbar_title", "module": "text", "baseline_status": "passed" }, { "name": "text::text_search_hint", "module": "text", "baseline_status": "passed" }, { "name": "text::text_settings_appearance_subtitle", "module": "text", "baseline_status": "passed" }, { "name": "text::text_settings_general_subtitle", "module": "text", "baseline_status": "passed" }, { "name": "text::text_settings_library_subtitle", "module": "text", "baseline_status": "passed" }, { "name": "text::text_settings_reader_subtitle", "module": "text", "baseline_status": "passed" } ], "ignored": [], "vlm_assertions": [ { "name": "computation::computation_bg_swatch_vlm", "module": "computation", "tag": "color" }, { "name": "computation::computation_font_swatch_vlm", "module": "computation", "tag": "color" }, { "name": "computation::computation_swatches_differ_vlm", "module": "computation", "tag": "color" }, { "name": "interaction::interaction_book_survives_process_death_vlm", "module": "interaction", "tag": "layout" }, { "name": "interaction::interaction_longpress_selection_vlm", "module": "interaction", "tag": "shape" }, { "name": "interaction::interaction_history_entry_vlm", "module": "interaction", "tag": "layout" }, { "name": "interaction::interaction_library_two_cards_vlm", "module": "interaction", "tag": "layout" }, { "name": "interaction::interaction_reader_page_vlm", "module": "interaction", "tag": "layout" }, { "name": "interaction::interaction_book_info_actions_vlm", "module": "interaction", "tag": "layout" }, { "name": "navigation::nav_reach_history_vlm", "module": "navigation", "tag": "layout" }, { "name": "navigation::nav_reach_more_sheet_vlm", "module": "navigation", "tag": "position" }, { "name": "navigation::nav_reach_settings_vlm", "module": "navigation", "tag": "position" }, { "name": "navigation::nav_reach_book_info_vlm", "module": "navigation", "tag": "position" }, { "name": "navigation::nav_reach_reader_vlm", "module": "navigation", "tag": "layout" }, { "name": "navigation::nav_reach_about_vlm", "module": "navigation", "tag": "position" }, { "name": "states::states_dark_theme_enable_vlm", "module": "states", "tag": "color" }, { "name": "states::states_dark_theme_persists_vlm", "module": "states", "tag": "color" }, { "name": "states::states_dark_theme_highlight_vlm", "module": "states", "tag": "shape" }, { "name": "states::states_app_theme_select_vlm", "module": "states", "tag": "color" }, { "name": "states::states_app_theme_ring_vlm", "module": "states", "tag": "shape" }, { "name": "states::states_nav_labels_hide_vlm", "module": "states", "tag": "position" }, { "name": "states::states_display_mode_list_grid_vlm", "module": "states", "tag": "layout" }, { "name": "states::states_display_mode_list_list_vlm", "module": "states", "tag": "layout" }, { "name": "states::states_display_mode_persists_vlm", "module": "states", "tag": "layout" }, { "name": "states::states_display_highlight_vlm", "module": "states", "tag": "color" }, { "name": "states::states_font_style_italic_highlight_vlm", "module": "states", "tag": "shape" }, { "name": "states::states_progress_count_change_highlight_vlm", "module": "states", "tag": "color" }, { "name": "states::states_text_align_highlight_vlm", "module": "states", "tag": "shape" }, { "name": "structure::structure_gate_topbar_vlm", "module": "structure", "tag": "position" }, { "name": "structure::structure_gate_bottomnav_vlm", "module": "structure", "tag": "position" }, { "name": "structure::structure_filter_sheet_vlm", "module": "structure", "tag": "position" }, { "name": "structure::structure_selection_mode_vlm", "module": "structure", "tag": "position" }, { "name": "structure::structure_bookinfo_shape_vlm", "module": "structure", "tag": "size" }, { "name": "structure::structure_appearance_dark_vlm", "module": "structure", "tag": "color" }, { "name": "structure::structure_reader_open_vlm", "module": "structure", "tag": "size" }, { "name": "structure::structure_library_grid_vlm", "module": "structure", "tag": "shape" } ], "vlm_total": 36, "n_vlm_unverified": 0, "vlm_log_found": true}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756{ "schema_version": 2, "instance_id": "android/acclorite-book-story", "grading": { "mode": "inline", "model": null, "scored_separately": true }, "totals": { "assertions": 37, "with_verdict": 36, "calibrated": 0, "usable": null, "scored_records": 36, "unbacked_records": 0 }, "assertions": [ { "id": "structure_gate_topbar_vlm", "screenshot": "structure_gate_topbar_vlm.png", "assertion": "Are there exactly three icon buttons grouped together in the top-right corner of the screen (in the app's top bar)?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "structure_gate_topbar", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_gate_bottomnav_vlm", "screenshot": "structure_gate_bottomnav_vlm.png", "assertion": "Is there a bottom navigation bar with exactly 3 evenly spaced items (each an icon with a label) across the bottom of the screen?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "structure_gate_bottomnav", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_filter_sheet_vlm", "screenshot": "structure_filter_sheet_vlm.png", "assertion": "Is there a bottom sheet panel anchored to the bottom edge of the screen, overlaying the content above it?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "structure_filter_sheet", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_selection_mode_vlm", "screenshot": "structure_selection_mode_vlm.png", "assertion": "Does the top bar show a selection count (like '1 selected') with several action icons to its right?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "structure_selection_mode", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_bookinfo_shape_vlm", "screenshot": "structure_bookinfo_shape_vlm.png", "assertion": "Is there a large primary action button spanning most of the screen width near the bottom of this book-detail screen?", "form": "question", "expected": true, "aspect": "size", "modality": null, "links_to": "structure_bookinfo_shape", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_appearance_dark_vlm", "screenshot": "structure_appearance_dark_vlm.png", "assertion": "Is the overall background of this screen dark (near-black or very dark grey) rather than white?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "structure_appearance_dark", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_reader_open_vlm", "screenshot": "structure_reader_open_vlm.png", "assertion": "Does a block of body text (multiple lines of a paragraph) fill most of the screen area?", "form": "question", "expected": true, "aspect": "size", "modality": null, "links_to": "structure_reader_open", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_library_grid_vlm", "screenshot": "structure_library_grid_vlm.png", "assertion": "Are there two book cover cards displayed side by side in the same row (a grid layout), rather than stacked vertically?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "structure_library_grid", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_history_vlm", "screenshot": "nav_reach_history_vlm.png", "assertion": "Is this a reading-history screen showing either a list of book entries grouped by date, or a centered empty-state illustration with a message — and NOT a grid of book covers?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_reach_history", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_more_sheet_vlm", "screenshot": "nav_reach_more_sheet_vlm.png", "assertion": "Is there a small menu panel anchored to the BOTTOM edge of the screen (a bottom sheet with a drag handle), rather than a full-screen page?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "nav_reach_more_sheet", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_settings_vlm", "screenshot": "nav_reach_settings_vlm.png", "assertion": "Is this a full-screen settings page showing a vertical list of category rows (each a title with a smaller subtitle beneath it), with a back arrow at the top-left?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_reach_settings", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_book_info_vlm", "screenshot": "nav_reach_book_info_vlm.png", "assertion": "Does this screen show a single large book-cover image near the top together with an action button to start/read the book, i.e. a book detail page (not a grid of many covers)?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_reach_book_info", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_reader_vlm", "screenshot": "nav_reach_reader_vlm.png", "assertion": "Is this an ebook reading page filled mostly with paragraphs of body text (a page of prose), rather than a list, a grid, or a form?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_reach_reader", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_reader_settings_sheet_vlm", "screenshot": "nav_reach_reader_settings_sheet_vlm.png", "assertion": "Is there a settings panel anchored to the BOTTOM portion of the screen (a bottom sheet with option rows), overlaying the page beneath it?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "nav_reach_reader_settings_sheet", "rigor": null, "verdict": null, "calibration": null }, { "id": "nav_reach_about_vlm", "screenshot": "nav_reach_about_vlm.png", "assertion": "Does this About screen show an app icon near the top followed by a vertical list of tappable link rows (e.g. report a bug, credits, licenses)?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_reach_about", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_book_survives_process_death_vlm", "screenshot": "interaction_book_survives_process_death_vlm.png", "assertion": "After relaunching the app, does the Library screen still show at least one book card (a cover tile with a title label beneath it)?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "interaction_book_survives_process_death", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_longpress_selection_vlm", "screenshot": "interaction_longpress_selection_vlm.png", "assertion": "One of the book covers is now selected. Does exactly one book cover show a selection indicator on it (a check mark or a highlighted/outlined overlay) that the other cover does not have?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "interaction_longpress_selection", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_history_entry_vlm", "screenshot": "interaction_history_entry_vlm.png", "assertion": "This is a reading-history screen. Is there a list row that shows a small book cover thumbnail on the left with a book title and a time (HH:MM) beside it?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "interaction_history_entry", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_library_two_cards_vlm", "screenshot": "interaction_library_two_cards_vlm.png", "assertion": "How many distinct book cards (each a cover tile with its own title label) are shown in this library grid? Answer YES only if there are exactly two.", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "interaction_library_two_cards", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_reader_page_vlm", "screenshot": "interaction_reader_page_vlm.png", "assertion": "Is this screen showing a page of readable book text (multiple lines/paragraphs of body text with margins), rather than an empty screen, a list, or a dialog?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "interaction_reader_page", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_book_info_actions_vlm", "screenshot": "interaction_book_info_actions_vlm.png", "assertion": "This is a book-detail screen. Does it show the book's title near the top and two labelled action buttons reading 'Move' and 'Delete'?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "interaction_book_info_actions", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "computation_bg_swatch_vlm", "screenshot": "computation_bg_swatch_vlm.png", "assertion": "In the 'Background color' section of this colour settings screen, is the colour preview swatch rendered white or a very pale/near-white shade (not a dark or saturated colour)?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "computation_bg_swatch", "rigor": { "jump_kind": "none", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "computation_font_swatch_vlm", "screenshot": "computation_font_swatch_vlm.png", "assertion": "In the 'Font color' section of this colour settings screen, is the colour preview swatch rendered a dark, near-black colour (not white or a pale shade)?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "computation_font_swatch", "rigor": { "jump_kind": "none", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "computation_swatches_differ_vlm", "screenshot": "computation_swatches_differ_vlm.png", "assertion": "This colour settings screen shows a light/pale 'Background color' preview swatch and a dark 'Font color' preview swatch. Are those two preview swatches clearly different colours from each other (one light, one dark)?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "computation_swatches_differ", "rigor": { "jump_kind": "none", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_dark_theme_enable_vlm", "screenshot": "states_dark_theme_enable_vlm.png", "assertion": "Is the background of this settings screen a dark/near-black colour with light-coloured text (dark mode), rather than a white/light background?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_dark_theme_enable", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_dark_theme_persists_vlm", "screenshot": "states_dark_theme_persists_vlm.png", "assertion": "After the app was restarted, is this settings screen still rendered in dark mode — a dark/near-black background with light text (not a white/light background)?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_dark_theme_persists", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_dark_theme_highlight_vlm", "screenshot": "states_dark_theme_highlight_vlm.png", "assertion": "In the 'Dark theme' row (segments System, Disabled, Enabled), is the 'Enabled' segment visually highlighted with a coloured/filled background pill that the other two segments do NOT have?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "states_dark_theme_highlight", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_app_theme_select_vlm", "screenshot": "states_app_theme_select_vlm.png", "assertion": "In this 'App theme' setting, is the currently selected theme card (the one with a check mark) labelled 'Neptune' and showing a blue/indigo colour swatch?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_app_theme_select", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_app_theme_ring_vlm", "screenshot": "states_app_theme_ring_vlm.png", "assertion": "In this 'App theme' card row (Mercury, Neptune, Earth), does exactly one card show a check-mark / selection badge marking it as the chosen theme?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "states_app_theme_ring", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_nav_labels_hide_vlm", "screenshot": "states_nav_labels_hide_vlm.png", "assertion": "Look at the bottom navigation bar of this app. Are the icons shown WITHOUT any text labels underneath them (no 'Library'/'History'/'Browse' words under the bottom-bar icons)?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "states_nav_labels_hide", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_display_mode_list_grid_vlm", "screenshot": "states_display_mode_list_grid_vlm.png", "assertion": "On this Library screen, are the book covers arranged side by side in a GRID (two or more covers in the same horizontal row), rather than stacked vertically in a single-column list?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "states_display_mode_list_grid", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_display_mode_list_list_vlm", "screenshot": "states_display_mode_list_list_vlm.png", "assertion": "On this Library screen, are the book covers now stacked vertically in a single-column LIST (each book on its own row, one above the other), rather than side by side in a grid?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "states_display_mode_list_list", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_display_mode_persists_vlm", "screenshot": "states_display_mode_persists_vlm.png", "assertion": "After the app was restarted, on this Library screen are the book covers still stacked vertically in a single-column LIST (one book per row) rather than in a side-by-side grid?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "states_display_mode_persists", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_display_highlight_vlm", "screenshot": "states_display_highlight_vlm.png", "assertion": "In the 'Display mode' row (segments 'Grid' and 'List'), is exactly one of the two segments visually highlighted with a coloured/filled background pill (the selected one) while the other is plain?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_display_highlight", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_font_style_italic_highlight_vlm", "screenshot": "states_font_style_italic_highlight_vlm.png", "assertion": "In the 'Font style' row (segments 'Normal' and 'Italic'), is the 'Italic' segment the one visually highlighted with a coloured/filled background pill (marking it selected) rather than 'Normal'?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "states_font_style_italic_highlight", "rigor": { "jump_kind": "none", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_progress_count_change_highlight_vlm", "screenshot": "states_progress_count_change_highlight_vlm.png", "assertion": "In the 'Progress count' row (segments 'Percentage' and 'Quantity'), is the 'Quantity' segment the one visually highlighted with a coloured/filled background pill (marking it selected)?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_progress_count_change_highlight", "rigor": { "jump_kind": "none", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_text_align_highlight_vlm", "screenshot": "states_text_align_highlight_vlm.png", "assertion": "In the 'Text alignment' row (segments Start, Justify, Center, End), is the 'Center' segment the one visually highlighted with a coloured/filled background pill (marking it selected)?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "states_text_align_highlight", "rigor": { "jump_kind": "none", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null } ], "merged_from_files": 1, "source_shapes": { "list": 1 }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.12345678910{ "schema_version": 1, "instance_id": "android/alialbaali-noto", "platform": "android", "repo": "https://github.com/alialbaali/Noto", "commit": "a1863c169f12d6852edc1c03d080a050647d3964", "patches": [], "package": "com.noto.debug", "license": null}123456789#!/usr/bin/env bash# TEMPLATE (rb_unify) — review before use.set -euo pipefail: "${RB_PACKAGE:?must be exported by the runner from instance.json}"D="$(cd "$(dirname "$0")" && pwd)"; SER="${DEVICE_SERIAL:-emulator-5554}"APK="$(find "$D" -name '*.apk' | head -1)"[ -n "$APK" ] || { echo "ERROR: no apk found; extract reference.tar.gz first" >&2; exit 1; }adb -s "$SER" install -r -g "$APK"adb -s "$SER" shell monkey -p "$RB_PACKAGE" -c android.intent.category.LAUNCHER 1123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233{ "module": "computation", "total": 22, "passed": 22, "failed": 0, "pass_rate": 1.0, "rule": { "total": 19, "passed": 19, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 3, "passed": 3, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.1579, "audit": { "kit_api_version": 1, "existence": 0, "liveness": 0, "interactive": 22, "depth_ge1": 22, "depth_ge2": 18, "value": 22, "vlm_fine": 0 }, "results": [ { "test": "computation_wc_empty", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "0 Words" }, { "test": "computation_wc_one", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "1 Word" }, { "test": "computation_wc_two", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "2 Words" }, { "test": "computation_wc_three", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "3 Words" }, { "test": "computation_wc_four", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "4 Words" }, { "test": "computation_wc_four_vlm", "passed": true, "message": "VLM: Q='In this note editor screen, is the text '4 Words' displayed in the header row near the top (next to the folder title)?' A=YES expect=YES", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "VLM YES: In this note editor screen, is the text '4 Words' displayed in the header row near the top (next to the folder title)?", "tag": "content" }, { "test": "computation_wc_five", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "5 Words" }, { "test": "computation_wc_seven_single_chars", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "7 Words" }, { "test": "computation_wc_multi_space", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "2 Words" }, { "test": "computation_wc_lead_trail_space", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "2 Words" }, { "test": "computation_wc_punctuation", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "2 Words" }, { "test": "computation_wc_title_excluded_empty", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "0 Words" }, { "test": "computation_wc_title_excluded_body", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "2 Words" }, { "test": "computation_folder_count_one", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "1 Note" }, { "test": "computation_folder_count_two", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "2 Notes" }, { "test": "computation_folder_count_three", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "3 Notes" }, { "test": "computation_home_cards_count", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "All=2, Recent=2" }, { "test": "computation_home_cards_count_vlm", "passed": true, "message": "VLM: Q='On this home screen, does the 'All' library card show the number 2 as its note count?' A=YES expect=YES", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "VLM YES: On this home screen, does the 'All' library card show the number 2 as its note count?", "tag": "content" }, { "test": "computation_folders_count_one", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "1 Folder" }, { "test": "computation_folders_count_two", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "2 Folders" }, { "test": "computation_reading_paging", "passed": true, "message": "", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "1 / 1 Note" }, { "test": "computation_reading_paging_vlm", "passed": true, "message": "VLM: Q='In this full-screen reading view, is the paging indicator '1 / 1 Note' displayed (showing you are on note 1 of 1)?' A=YES expect=YES", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "VLM YES: In this full-screen reading view, is the paging indicator '1 / 1 Note' displayed (showing you are on note 1 of 1)?", "tag": "content" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228{ "module": "interaction", "total": 21, "passed": 21, "failed": 0, "pass_rate": 1.0, "rule": { "total": 14, "passed": 14, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 7, "passed": 7, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.5, "audit": { "kit_api_version": 1, "existence": 0, "liveness": 0, "interactive": 21, "depth_ge1": 20, "depth_ge2": 10, "value": 15, "vlm_fine": 5 }, "results": [ { "test": "interaction_create_note", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "note 'Groceries' in list" }, { "test": "interaction_second_create_two_rows", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "both FirstNote & SecondNote present" }, { "test": "interaction_multi_record_integrity", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "3 notes A/B/C present" }, { "test": "interaction_duplicate_note", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "two 'DupMe' rows after Duplicate" }, { "test": "interaction_duplicate_note_vlm", "passed": true, "message": "VLM: Q='Are there two note cards with the same title text positioned immediately one above the other (adjacent) in the note list?' A=YES expect=YES", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "VLM YES: Are there two note cards with the same title text positioned immediately one above the other (adjacent) in the note list?", "tag": "position" }, { "test": "interaction_edit_note_body_persists", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "note body 'alpha beta'" }, { "test": "interaction_create_folder", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "folder 'Projects' on HOME" }, { "test": "interaction_create_two_folders", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "both 'Projects' & 'Ideas' on HOME" }, { "test": "interaction_note_survives_process_death", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "'Persist1' survives restart" }, { "test": "interaction_folder_survives_process_death", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "'KeepMe' folder survives restart" }, { "test": "interaction_edited_body_survives_process_death", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "body 'saved body xyz' after restart" }, { "test": "interaction_selection_check_dark_vlm", "passed": true, "message": "VLM: Q='The selected note row shows a small circular check/tick badge in its corner: is that badge a SOLID DARK/BLACK filled circle (not a hollow outline)?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: The selected note row shows a small circular check/tick badge in its corner: is that badge a SOLID DARK/BLACK filled circle (not a hollow outline)?", "tag": "color" }, { "test": "interaction_selection_check_badge_vlm", "passed": true, "message": "VLM: Q='Does exactly one note row show a filled circular check/tick badge in its corner marking it as selected, while the other row has none?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Does exactly one note row show a filled circular check/tick badge in its corner marking it as selected, while the other row has none?", "tag": "shape" }, { "test": "interaction_selection_action_bar_vlm", "passed": true, "message": "VLM: Q='Is a bottom action bar with several selection action icons (reminder, pin, share, archive and a more-options button) rendered along the bottom of the screen?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is a bottom action bar with several selection action icons (reminder, pin, share, archive and a more-options button) rendered along the bottom of the screen?", "tag": "layout" }, { "test": "interaction_multi_select_count", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "2 selected" }, { "test": "interaction_pin_note", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "'Pinned' section appears" }, { "test": "interaction_pinned_section_vlm", "passed": true, "message": "VLM: Q='Is there a 'Pinned' section heading near the top of the note list with a note shown directly beneath it, positioned above the rest of the notes?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is there a 'Pinned' section heading near the top of the note list with a note shown directly beneath it, positioned above the rest of the notes?", "tag": "position" }, { "test": "interaction_note_options_grid_vlm", "passed": true, "message": "VLM: Q='Does this bottom sheet titled 'Note options' show a grid/list of several labeled action tiles such as Add reminder, Reading Mode, Pin, Share, Archive, Duplicate, Copy, Move to and Delete?' A=YES expect=YES", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "VLM YES: Does this bottom sheet titled 'Note options' show a grid/list of several labeled action tiles such as Add reminder, Reading Mode, Pin, Share, Archive, Duplicate, Copy, Move to and Delete?", "tag": "layout" }, { "test": "interaction_move_note_between_folders", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "MoveMe left General, in Dest" }, { "test": "interaction_new_folder_note_roundtrip", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "'Day1' in fresh folder 'Trip'" }, { "test": "interaction_created_note_card_vlm", "passed": true, "message": "VLM: Q='In the note card, is the title line ('CardTitle') rendered in a LARGER or bolder font than, and positioned above, the body-preview line ('card body preview')?' A=YES expect=YES", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "VLM YES: In the note card, is the title line ('CardTitle') rendered in a LARGER or bolder font than, and positioned above, the body-preview line ('card body preview')?", "tag": "size" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263{ "module": "navigation", "total": 25, "passed": 25, "failed": 0, "pass_rate": 1.0, "rule": { "total": 19, "passed": 19, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 6, "passed": 6, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.3158, "audit": { "kit_api_version": 1, "existence": 0, "liveness": 0, "interactive": 25, "depth_ge1": 25, "depth_ge2": 10, "value": 0, "vlm_fine": 3 }, "results": [ { "test": "nav_reach_folder", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "folder note-list shown (fab 'Create note' appeared); HOME sheet title 'Noto Debug' gone" }, { "test": "nav_reach_home_from_folder", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "HOME sheet title 'Noto Debug' reappeared; folder fab 'Create note' gone" }, { "test": "nav_reach_settings", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Settings surface visible ('About' row appeared); 'Noto Debug' gone" }, { "test": "nav_reach_settings_vlm", "passed": true, "message": "VLM: Q='Is a settings screen showing a vertical list of labelled rows, each row with a small leading icon on its left?' A=YES expect=YES", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "VLM YES: Is a settings screen showing a vertical list of labelled rows, each row with a small leading icon on its left?", "tag": "layout" }, { "test": "nav_reach_recent", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Recent screen shown (grouping header 'Today' appeared); HOME sheet 'Noto Debug' gone" }, { "test": "nav_reach_all", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "All-notes screen shown (bottom-bar 'Collapse' appeared); 'Noto Debug' gone" }, { "test": "nav_reach_archived", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Archived screen shown (bottom-bar 'Collapse' appeared); 'Noto Debug' gone" }, { "test": "nav_reach_more_menu", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "home more menu shown ('Folders vault' appeared); HOME fab 'Create folder' gone" }, { "test": "nav_reach_more_menu_vlm", "passed": true, "message": "VLM: Q='Is a small menu sheet showing a short vertical list of text entries (vault / archive / settings), overlaying the screen near the bottom?' A=YES expect=YES", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "VLM YES: Is a small menu sheet showing a short vertical list of text entries (vault / archive / settings), overlaying the screen near the bottom?", "tag": "layout" }, { "test": "nav_reach_search", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "in-folder search field (til_search) appeared; folder 'Folder options' action gone" }, { "test": "nav_reach_notes_view", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "Notes-view dialog shown ('Apply' appeared); folder fab 'Create note' gone" }, { "test": "nav_reach_notes_view_vlm", "passed": true, "message": "VLM: Q='Is a bottom sheet dialog anchored to the lower portion of the screen, overlaying a dimmed screen behind it?' A=YES expect=YES", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "VLM YES: Is a bottom sheet dialog anchored to the lower portion of the screen, overlaying a dimmed screen behind it?", "tag": "position" }, { "test": "nav_reach_folder_options", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "folder-options sheet shown ('New note shortcut' appeared); fab 'Create note' gone" }, { "test": "nav_chain_editor", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "note editor shown (Body field appeared); folder fab 'Create note' gone" }, { "test": "nav_chain_editor_vlm", "passed": true, "message": "VLM: Q='Is there a back-arrow icon at the very top-left of the screen, next to the folder title in the toolbar?' A=YES expect=YES", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "VLM YES: Is there a back-arrow icon at the very top-left of the screen, next to the folder title in the toolbar?", "tag": "position" }, { "test": "nav_chain_general_settings", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "General settings shown ('Theme' row appeared); Settings-only 'Support Noto' gone" }, { "test": "nav_chain_theme_dialog", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Theme dialog shown (option 'Light' appeared); General row 'Language' gone" }, { "test": "nav_chain_note_options", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "Note-options sheet shown ('Note options' title appeared); selection subtitle '… Selected' gone" }, { "test": "nav_chain_reading_mode", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "Reading Mode shown (paging arrow 'Next' appeared); 'Note options' gone" }, { "test": "nav_chain_reading_mode_vlm", "passed": true, "message": "VLM: Q='Is there a solid black rounded-square button with a white pencil icon centered along the very bottom of the screen, with a small paging arrow to its left and another to its right?' A=YES expect=YES", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "VLM YES: Is there a solid black rounded-square button with a white pencil icon centered along the very bottom of the screen, with a small paging arrow to its left and another to its right?", "tag": "position" }, { "test": "nav_back_editor_to_home", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "HOME sheet 'Noto Debug' restored after BACK; editor Body field gone" }, { "test": "nav_back_settings_to_folder", "passed": true, "message": "", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "folder fab 'Create note' restored after BACK; Settings 'About' gone" }, { "test": "nav_back_general_to_settings", "passed": true, "message": "", "depth": 2, "jump_kind": "reach", "tier": 2, "expect": "Settings 'Support Noto' restored after BACK; General 'Theme' row gone" }, { "test": "nav_back_reading_to_folder", "passed": true, "message": "", "depth": 3, "jump_kind": "reach", "tier": 2, "expect": "folder fab 'Create note' restored after BACK; reading-mode 'Next' arrow gone" }, { "test": "nav_folder_bottom_bar_vlm", "passed": true, "message": "VLM: Q='Is there a horizontal row of action icons along the bottom of the screen (a menu/hamburger, a plus/add, and search), forming a bottom app bar?' A=YES expect=YES", "depth": 1, "jump_kind": "reach", "tier": 2, "expect": "VLM YES: Is there a horizontal row of action icons along the bottom of the screen (a menu/hamburger, a plus/add, and search), forming a bottom app bar?", "tag": "layout" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295{ "module": "states", "total": 28, "passed": 28, "failed": 0, "pass_rate": 1.0, "rule": { "total": 17, "passed": 17, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 11, "passed": 11, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.6471, "audit": { "kit_api_version": 1, "existence": 0, "liveness": 0, "interactive": 28, "depth_ge1": 26, "depth_ge2": 16, "value": 10, "vlm_fine": 9 }, "results": [ { "test": "states_selection_on", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "iv_selected absent -> present; subtitle gains ' • 1 Selected'" }, { "test": "states_selection_on_vlm", "passed": true, "message": "VLM: Q='Does exactly one note row show a solid, filled circular check/selection badge (a coloured circle with a checkmark) on it?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Does exactly one note row show a solid, filled circular check/selection badge (a coloured circle with a checkmark) on it?", "tag": "shape" }, { "test": "states_selection_bar_vlm", "passed": true, "message": "VLM: Q='Is a horizontal action bar of icon buttons (reminder, pin, share, archive) shown along the bottom of the screen?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is a horizontal action bar of icon buttons (reminder, pin, share, archive) shown along the bottom of the screen?", "tag": "layout" }, { "test": "states_selection_off", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "subtitle ' • 1 Selected' -> no 'Selected'; iv_selected removed" }, { "test": "states_multiselect_two", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "'1 Selected' / 1 badge -> '2 Selected' / 2 badges" }, { "test": "states_selection_count_increment", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "subtitle '• 1 Selected' -> '• 2 Selected'" }, { "test": "states_all_chip_active", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "tv_all_label 'All' + ib_new_label present as the active filter row" }, { "test": "states_all_chip_active_vlm", "passed": true, "message": "VLM: Q='Near the top of the note list, the row starts with an 'All' label and a neighbouring icon button. Is the 'All' label drawn as a FILLED solid (dark) pill/box with light text, while the neighbouring button is only an OUTLINED (unfilled, white-interior) box?' A=YES expect=YES", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "VLM YES: Near the top of the note list, the row starts with an 'All' label and a neighbouring icon button. Is the 'All' label drawn as a FILLED solid (dark) pill/box with light text, while the neighbouring button is only an OUTLINED (unfilled, white-interior) box?", "tag": "color" }, { "test": "states_undo_disabled_vlm", "passed": true, "message": "VLM: Q='In the bottom toolbar of this note editor, does the Undo (left curved arrow) icon look greyed-out / dimmed compared with the other toolbar icons?' A=YES expect=YES", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: In the bottom toolbar of this note editor, does the Undo (left curved arrow) icon look greyed-out / dimmed compared with the other toolbar icons?", "tag": "color" }, { "test": "states_undo_enable", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "ib_undo enabled 'false' -> 'true' after an edit" }, { "test": "states_redo_stays_disabled", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "after an edit: ib_redo enabled 'false' (nothing to redo), ib_undo 'true'" }, { "test": "states_undo_history_disabled", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "fresh note: ib_undo_history & ib_redo_history enabled 'false'" }, { "test": "states_theme_light_vlm", "passed": true, "message": "VLM: Q='Is the overall app background LIGHT (white / very pale) with dark text, rather than a dark/black background?' A=YES expect=YES", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is the overall app background LIGHT (white / very pale) with dark text, rather than a dark/black background?", "tag": "color" }, { "test": "states_theme_selected_mark_vlm", "passed": true, "message": "VLM: Q='In this Theme option list, is the 'Light' option visibly marked as the current selection (a filled radio dot or a highlighted row) while the other options are not?' A=YES expect=YES", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "VLM YES: In this Theme option list, is the 'Light' option visibly marked as the current selection (a filled radio dot or a highlighted row) while the other options are not?", "tag": "shape" }, { "test": "states_theme_persists_vlm", "passed": true, "message": "VLM: Q='Is the overall app background still LIGHT (white / very pale) with dark text after the app was restarted?' A=YES expect=YES", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is the overall app background still LIGHT (white / very pale) with dark text after the app was restarted?", "tag": "color" }, { "test": "states_theme_persists", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "Theme row 'Light' after selection AND still 'Light' after relaunch" }, { "test": "states_theme_dark_vlm", "passed": true, "message": "VLM: Q='Is the overall app background now DARK (near-black / very dark) with light-coloured text?' A=YES expect=YES", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is the overall app background now DARK (near-black / very dark) with light-coloured text?", "tag": "color" }, { "test": "states_show_count_thumb_vlm", "passed": true, "message": "VLM: Q='On the 'Show notes count' settings row, is there a switch whose thumb is toward the RIGHT / in the ON position (the track filled/coloured)?' A=YES expect=YES", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: On the 'Show notes count' settings row, is there a switch whose thumb is toward the RIGHT / in the ON position (the track filled/coloured)?", "tag": "position" }, { "test": "states_show_count_toggle", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "HOME note-count nodes present -> absent after toggling off" }, { "test": "states_show_count_persists", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "HOME count nodes absent both before AND after relaunch" }, { "test": "states_notes_view_current_state", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "Filtering=Inclusive, Sorting=Creation date, Ordering=Descending, Grouping=None" }, { "test": "states_ordering_toggle", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "order value 'Descending' -> 'Ascending' (Ascending text appears)" }, { "test": "states_reading_paging_position", "passed": true, "message": "", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "tv_notes_count desc == '1 / M Note(s)' (paging at position 1)" }, { "test": "states_reading_paging_vlm", "passed": true, "message": "VLM: Q='In this full-screen reading view, near the top under the folder name, is a page-position indicator rendered showing something like '1 / 1 Note' or '1 / 2 Note'?' A=YES expect=YES", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "VLM YES: In this full-screen reading view, near the top under the folder name, is a page-position indicator rendered showing something like '1 / 1 Note' or '1 / 2 Note'?", "tag": "layout" }, { "test": "states_body_focus", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "et_note_body focused 'false' -> 'true'; soft keyboard visible" }, { "test": "states_title_focus", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "et_note_title focused 'true' & et_note_body focused 'false'" }, { "test": "states_home_cards", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "All / Recent / Scheduled / Archived cards all present on HOME" }, { "test": "states_home_cards_vlm", "passed": true, "message": "VLM: Q='Near the top of this screen are four library cards. Do they have FOUR DISTINCT accent colours (for example blue, amber/yellow, red, and purple) rather than all being the same colour?' A=YES expect=YES", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "VLM YES: Near the top of this screen are four library cards. Do they have FOUR DISTINCT accent colours (for example blue, amber/yellow, red, and purple) rather than all being the same colour?", "tag": "color" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229{ "module": "structure", "total": 21, "passed": 21, "failed": 0, "pass_rate": 1.0, "rule": { "total": 13, "passed": 13, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 8, "passed": 8, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.6154, "audit": { "kit_api_version": 1, "existence": 11, "liveness": 0, "interactive": 10, "depth_ge1": 10, "depth_ge2": 5, "value": 0, "vlm_fine": 6 }, "results": [ { "test": "structure_gate_home_sheet", "passed": true, "message": "", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "" }, { "test": "structure_gate_default_folder", "passed": true, "message": "", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "" }, { "test": "structure_gate_library_grid_count", "passed": true, "message": "", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "" }, { "test": "structure_folder_replaces_home", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "folder note-list subtree (notes_view/fab Create note/Folders bar) replaces home sheet" }, { "test": "structure_editor_subtree_appears", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "et_note_title+et_note_body+bab_toolbar(4 ImageButtons) appear only after fab Create note" }, { "test": "structure_selection_bar_appears", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "selection bar (add_reminder/pin/share/fab_selection) absent->present on long-press" }, { "test": "structure_notesview_sheet_appears", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "notes-view bottom-sheet subtree (Filtering/Sorting/Apply rows) added over folder screen" }, { "test": "structure_newfolder_dialog_appears", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "new-folder dialog subtree (et Title field + btn_create) added over home sheet" }, { "test": "structure_note_options_sheet_appears", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "Note options sheet ('Note options' title + >=5 action rows), clickable count increases" }, { "test": "structure_reading_mode_subtree", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "reading-mode subtree fab_next+fab_previous+fab 'Edit' appears after Reading Mode" }, { "test": "structure_settings_list_appears", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "Settings list subtree (rows incl. General + About) replaces home sheet" }, { "test": "structure_general_settings_rows", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "General-settings rows subtree (rows incl. Theme + Language) appears" }, { "test": "structure_editor_toolbar_shape", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "bab_toolbar contains exactly 4 ImageButtons (undo_history/undo/redo/redo_history)" }, { "test": "structure_home_grid_vlm", "passed": true, "message": "VLM: Q='In the lower white panel of this note-taking app, is there a 2 by 2 grid of exactly four rectangular cards labelled All, Recent, Scheduled and Archived?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In the lower white panel of this note-taking app, is there a 2 by 2 grid of exactly four rectangular cards labelled All, Recent, Scheduled and Archived?", "tag": "layout" }, { "test": "structure_home_cards_color_vlm", "passed": true, "message": "VLM: Q='Are the four library cards color-coded so that each card's outline, icon and label use a DIFFERENT accent color (one blue, one amber/orange, one red, one purple)?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Are the four library cards color-coded so that each card's outline, icon and label use a DIFFERENT accent color (one blue, one amber/orange, one red, one purple)?", "tag": "color" }, { "test": "structure_home_fab_position_vlm", "passed": true, "message": "VLM: Q='Is there a solid dark (black) rounded-square floating button showing a small plus/add icon in the BOTTOM-RIGHT corner of the screen?' A=YES expect=YES", "depth": 0, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is there a solid dark (black) rounded-square floating button showing a small plus/add icon in the BOTTOM-RIGHT corner of the screen?", "tag": "position" }, { "test": "structure_editor_title_above_body_vlm", "passed": true, "message": "VLM: Q='In this note editor, is the single-line 'Title' input field positioned ABOVE the larger multi-line 'Body' input area?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In this note editor, is the single-line 'Title' input field positioned ABOVE the larger multi-line 'Body' input area?", "tag": "position" }, { "test": "structure_editor_toolbar_row_vlm", "passed": true, "message": "VLM: Q='Just ABOVE the on-screen keyboard on this note editor, is there a single horizontal row of exactly four evenly spaced icon buttons (undo/redo style arrows)?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Just ABOVE the on-screen keyboard on this note editor, is there a single horizontal row of exactly four evenly spaced icon buttons (undo/redo style arrows)?", "tag": "position" }, { "test": "structure_reading_mode_fullscreen_vlm", "passed": true, "message": "VLM: Q='Does this screen show the note's title and text as static (non-editable) content on a large, mostly empty full-screen page with no 'Title'/'Body' input boxes and no on-screen keyboard?' A=YES expect=YES", "depth": 3, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Does this screen show the note's title and text as static (non-editable) content on a large, mostly empty full-screen page with no 'Title'/'Body' input boxes and no on-screen keyboard?", "tag": "layout" }, { "test": "structure_folder_label_row_vlm", "passed": true, "message": "VLM: Q='Directly beneath the folder's 'General' title and note-count, is there a horizontal row with a filled dark pill labelled 'All' next to a small outlined add (+) button?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Directly beneath the folder's 'General' title and note-count, is there a horizontal row with a filled dark pill labelled 'All' next to a small outlined add (+) button?", "tag": "position" }, { "test": "structure_newfolder_swatches_vlm", "passed": true, "message": "VLM: Q='In this 'New folder' dialog, under a 'Color' label, is there a row of several small circular color swatches in different colors?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: In this 'New folder' dialog, under a 'Color' label, is there a row of several small circular color swatches in different colors?", "tag": "shape" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851#!/usr/bin/env python3"""Android TestGen Kit — the single source of every test helper, so a test'sNAVIGATION DEPTH and JUMP RIGOR are DECLARED (not inferred), uniformly recorded,and self-auditable.
LOCATION AT RUNTIME: alongside the generated test files (testgen: $TESTGEN_DIR/eval/,eval: the restored eval dir). READ-ONLY — never edit, copy, or reimplement it.`import` it from every test file:
import os, sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from android_testgen_kit import * # noqa: F403
WHY THIS EXISTS Helpers used to be re-emitted verbatim into every generated test file (~370 lines x 6 files). That blew the output-token ceiling, forced a "write the script in pieces" protocol, let each copy drift, and duplicated one API key into every file. Everything mechanical now lives here; prompts carry only judgement.
Two orthogonal properties decide whether a suite really exercises an app: * navigation DEPTH — how many SURFACES you cross before the assertion (0 = first screen, 1 = one page/dialog/sheet, 2+ = deeper) * jump RIGOR — what the assertion after the trigger actually checks Prose alone let these drift, so every behavioral test DECLARES both:
@and_test(expects=("interaction_create_note", "interaction_create_note_vlm")) def test_create_note(): ... record("interaction_create_note", ok, "behavior_wrong: ...", depth=1, jump_kind="value", expect="list shows 'Milk'")
jump_kind (verbatim strings — audit/stats key off them): "none" no trigger; existence/gate only -> tier 0 "liveness" only "did not crash / still foreground" -> tier 1 (weak; never ship) "reach" a real surface jump: the TARGET surface's element APPEARED *and* the SOURCE surface's DISAPPEARED -> tier 2 "transition" a state flip (checked/enabled/selected/mode) with before->after -> tier 2 "value" a specific expected value/content was asserted -> tier 3
WHAT A "SURFACE" IS ON ANDROID NOT the Activity — single-Activity Compose/Fragment apps never change it, so get_current_activity() cannot discriminate. A surface is the SET of visible discriminating element keys: and_showing() -> {"Button|Save", "TextView|Total"}. and_reach(before, after, target, source) therefore proves a real jump; reading a flat tree for an always-present element cannot fake it.
DETERMINISTIC DENOMINATOR Scoring is eval_pass_case / origin_total_case, so a test function MUST contribute the same number of records on every code path. @and_test(expects=(...)) owns the try/except and back-fills any declared-but-unrecorded name as a failure, and record() refuses duplicates. N is a literal in the decorator.
PORTABILITY (the same file scores the ORIGINAL and the RECREATION, whose packagename differs): always use the module-level PACKAGE (argv[1]). Never write a packagename, an .apk path, a /data/data path, or a pixel coordinate as a literal. python3 android_testgen_kit.py lint_sources <dir> # flags all of those
SELF-AUDIT (report-only — these are GOALS, never a gate that blocks delivery): python3 android_testgen_kit.py audit <results_dir> python3 android_testgen_kit.py lint <results_dir> python3 android_testgen_kit.py lint_sources <testgen_dir> python3 android_testgen_kit.py audit_depth <testgen_dir> [results_dir]"""from __future__ import annotations
import astimport base64import functoolsimport globimport hashlibimport jsonimport mathimport osimport reimport shleximport subprocessimport sysimport timeimport urllib.errorimport urllib.request
KIT_API_VERSION = 1
# ── Runtime context ────────────────────────────────────────────────────────────# argv[1] = package under test (ORIGINAL during testgen, RECREATION during eval).# argv[2] / $RESULTS_DIR = where the eval JSON + screenshots go.PACKAGE = sys.argv[1] if len(sys.argv) > 1 else os.environ.get("PACKAGE", "")RESULTS_DIR = ( sys.argv[2] if len(sys.argv) > 2 else os.environ.get("RESULTS_DIR", "/workspace/testgen/eval"))ADB = os.environ.get("ADB_PATH", "adb")DEVICE = os.environ.get("DEVICE_SERIAL", "emulator-5554")
# Known emulator packages (from adb-tips). Used by type_text, never by tests.CLIPPER_PKG = "ca.zgrs.clipper"ADB_KEYBOARD_IME = "com.android.adbkeyboard/.AdbIME"
# ── Settling table (adb-tips §5). ANDROID_REMOTE=1 doubles it for tunnelled adb. ─_REMOTE = os.environ.get("ANDROID_REMOTE", "") in ("1", "true", "yes")_SETTLE_MULT = 2.0 if _REMOTE else 1.0SETTLE = { "launch": 3.0, "tap": 1.0, "key": 0.5, "keyboard": 0.5, "dump": 1.0, "ime": 0.5, "text": 0.5, "swipe": 1.0, "dump_retry": 2.0,}
JUMP_KINDS = {"none": 0, "liveness": 1, "reach": 2, "transition": 2, "value": 3}
# Double-axis quota TARGETS (fractions). rb_audit REPORTS these; they are NOT a# gate. Tune here only — never restate them in a prompt.QUOTAS = { "existence_max": 0.30, # jump_kind=="none" share of ALL tests "interactive_min": 0.60, # reach|transition|value share of ALL tests "depth_ge1_min": 0.40, # depth>=1 share of INTERACTIVE tests "depth_ge2_min": 0.15, # depth>=2 share of INTERACTIVE tests "value_min": 0.25, # jump_kind=="value" share of INTERACTIVE tests # Suite-wide VLM budget, measured as vlm records / ALL records. The right # share is app-dependent (a chart/canvas app earns more than a list app) and # individual modules may legitimately contribute zero, so this is a BAND on # the whole suite, never a per-module requirement. "vlm_share_min": 0.30, "vlm_share_max": 0.50, "vlm_fine_min": 0.66, # fine-grained share of VLM records}
# Depth family (naming convention — see and_audit_depth). A test "crosses a# surface" iff it calls a member of this family; and_back* pops one. Semantic# aliases (and_enter_settings, and_reach_detail) match BY PREFIX, so the kit stays# small and the authored tests stay diverse.DEPTH_FWD_RE = re.compile(r"^and_(enter|reach)[a-z0-9_]*$")DEPTH_BACK_RE = re.compile(r"^and_back[a-z0-9_]*$")DEPTH_RESET_RE = re.compile(r"^and_reset_depth$")
# VLM tags. The fine-grained ones test an exact rendered property; and_audit# computes the >=2/3 fine share from these instead of trusting self-report.VLM_FINE_TAGS = {"color", "shape", "position", "size"}VLM_TAGS = VLM_FINE_TAGS | {"layout", "content"}
# Failure-message taxonomy. and_lint flags a failed record that uses none of them.FAIL_PREFIXES = ("setup_failed:", "feature_missing:", "behavior_wrong:", "exception:")
# Never tap these (tests mutate real device state).DANGEROUS_TEXTS = [ "delete", "remove", "clear", "reset", "erase", "discard", "uninstall", "sign out", "log out", "logout", "format", "wipe", "revoke", "deactivate", "删除", "移除", "清空", "清除", "重置", "退出登录", "注销", "格式化",]
_MODULE_ALIAS = { "states": "states", "state": "states", "structure": "structure", "structures": "structure", "navigation": "navigation", "nav": "navigation", "interaction": "interaction", "interactions": "interaction", "computation": "computation", "computations": "computation", "text": "text", "texts": "text",}
_DEPTH = 0 # surface counter for and_enter/and_back_results: list[dict] = []_seen: set[str] = set()_module: str = ""_screen_info: dict | None = None
def require_kit(min_version: int) -> None: """Fail loudly at import time if the kit is older than the test expects.""" if KIT_API_VERSION < min_version: raise RuntimeError( f"android_testgen_kit v{KIT_API_VERSION} is older than the required " f"v{min_version}; the restored testcase bundle and the kit disagree" )
def _infer_module() -> str: stem = os.path.splitext(os.path.basename(sys.argv[0] or ""))[0] if stem.startswith("test_android_"): return _MODULE_ALIAS.get(stem[len("test_android_"):], stem[len("test_android_"):]) return ""
def init(module: str = "", package: str = "", results_dir: str = "") -> None: """Optional. Overrides the values inferred from argv/env.""" global _module, PACKAGE, RESULTS_DIR if module: _module = _MODULE_ALIAS.get(module, module) if package: PACKAGE = package if results_dir: RESULTS_DIR = results_dir
_module = _infer_module()
def tier_of(jump_kind: str) -> int: return JUMP_KINDS.get(jump_kind, 2)
def settle(kind: str = "tap") -> None: """Sleep the calibrated settling time for `kind` (see SETTLE).""" time.sleep(SETTLE.get(kind, 1.0) * _SETTLE_MULT)
# ══════════════════════════════════════════════════════════════════════════════# (1) Results / recording# ══════════════════════════════════════════════════════════════════════════════
def record(test_name, passed, message="", *, depth=None, jump_kind="none", expect="", tag=None, backfilled=False) -> bool: """Record ONE test result. Returns bool(passed).
The three positional parameters are unchanged from the legacy inline helper. Everything new is keyword-only with a default, so old call sites still work.
depth surfaces this test crossed before asserting (see and_enter/and_reach) jump_kind none | liveness | reach | transition | value expect MANDATORY for reach/transition/value — the exact target you OBSERVED on the original app (and_lint flags an empty one) tag for VLM records: color|shape|position|size|layout|content message on failure, start it with setup_failed: / feature_missing: / behavior_wrong: / exception: """ if test_name in _seen: print(f" [DUP ] {_module}:{test_name} refused (already recorded) — " f"a duplicate would drift the denominator") return bool(passed) if jump_kind not in JUMP_KINDS: jump_kind = "none" d = _DEPTH if depth is None else int(depth) p = bool(passed) rec = { "test": test_name, "passed": p, "message": str(message), "depth": max(0, d), "jump_kind": jump_kind, "tier": tier_of(jump_kind), "expect": str(expect), } if tag: rec["tag"] = str(tag) if backfilled: rec["backfilled"] = True _results.append(rec) _seen.add(test_name) print(f" [{'PASS' if p else 'FAIL'}] {_module}:{test_name} " f"(depth={rec['depth']}, {jump_kind})" + (f" {message}" if message and not p else "")) _flush() return p
def _payload(module_name: str) -> dict: """The eval JSON. Shape is byte-compatible with the legacy helper: the aggregator reads module/total/passed/pass_rate, and the results extraction reads the rule/vlm sub-objects. New keys ride inside results[] + `audit`.""" rule = [r for r in _results if not r["test"].endswith("_vlm")] vlm = [r for r in _results if r["test"].endswith("_vlm")] rt, rp = len(rule), sum(1 for r in rule if r["passed"]) vt, vp = len(vlm), sum(1 for r in vlm if r["passed"]) total, passed = len(_results), sum(1 for r in _results if r["passed"]) fine = sum(1 for r in vlm if r.get("tag") in VLM_FINE_TAGS) inter = [r for r in _results if r["jump_kind"] in ("reach", "transition", "value")] return { "module": module_name, "total": total, "passed": passed, "failed": total - passed, "pass_rate": round(passed / total, 4) if total else 0, "rule": {"total": rt, "passed": rp, "failed": rt - rp, "pass_rate": round(rp / rt, 4) if rt else 0}, "vlm": {"total": vt, "passed": vp, "failed": vt - vp, "pass_rate": round(vp / vt, 4) if vt else 0}, "vlm_ratio": round(vt / rt, 4) if rt else 0, "audit": { "kit_api_version": KIT_API_VERSION, "existence": sum(1 for r in _results if r["jump_kind"] == "none"), "liveness": sum(1 for r in _results if r["jump_kind"] == "liveness"), "interactive": len(inter), "depth_ge1": sum(1 for r in inter if r["depth"] >= 1), "depth_ge2": sum(1 for r in inter if r["depth"] >= 2), "value": sum(1 for r in inter if r["jump_kind"] == "value"), "vlm_fine": fine, }, "results": _results, }
def _write_json(path: str, data: dict) -> None: """Atomic write, so a mid-run SIGKILL never leaves a truncated JSON.""" os.makedirs(os.path.dirname(path) or ".", exist_ok=True) tmp = path + ".tmp" with open(tmp, "w") as f: json.dump(data, f, indent=2, ensure_ascii=False) os.replace(tmp, path)
def _flush() -> None: """Persist after EVERY record, so a timeout/emulator hang leaves N results instead of zero. save_results() stays the documented finalizer.""" if not _module: return try: _write_json(os.path.join(RESULTS_DIR, f"android_{_module}_eval.json"), _payload(_module)) except Exception: pass
def save_results(module_name: str) -> dict: """MANDATORY finalizer. Authoritatively rewrites the eval JSON under the confirmed module name, prints the summary, and runs the in-process audit. Idempotent.""" global _module _module = _MODULE_ALIAS.get(module_name, module_name) out = _payload(_module) path = os.path.join(RESULTS_DIR, f"android_{_module}_eval.json") _write_json(path, out) print(f"Results: {out['passed']}/{out['total']} passed " f"(rule: {out['rule']['passed']}/{out['rule']['total']}, " f"vlm: {out['vlm']['passed']}/{out['vlm']['total']}) -> {path}") try: and_audit(RESULTS_DIR) and_lint(RESULTS_DIR) except Exception as exc: print(f"[audit] skipped: {exc}") return out
def declared_names() -> list[str]: """Every record name produced so far. The eval run MUST produce this same set against the recreation — a missing feature FAILS, it never vanishes from the denominator.""" return [r["test"] for r in _results]
def and_test(*, expects, module: str = ""): """Wrap a test function so it contributes EXACTLY len(expects) records on every code path — the deterministic-denominator guarantee.
Any name in `expects` still unrecorded when the function returns or raises is back-filled as a failure. The literal also lets and_audit_depth attribute records to this function exactly.
@and_test(expects=("states_toggle_dark", "states_toggle_dark_vlm")) def test_toggle_dark(): ... """ names = tuple(expects)
def deco(fn): @functools.wraps(fn) def wrapper(*a, **kw): if module: init(module=module) err = "" try: return fn(*a, **kw) except Exception as exc: err = f"{type(exc).__name__}: {exc}" print(f" [EXC ] {fn.__name__}: {err}") return None finally: for n in names: if n not in _seen: record(n, False, f"exception: not_reached ({err})" if err else "setup_failed: not_reached (no exception raised)", backfilled=True) wrapper._and_expects = names return wrapper return deco
def run_suite(tests, module: str) -> dict: """Run every test, then finalize. Each test owns its own entry point, so one failure never cascades.""" init(module=module) n_fix = len(fixture_names()) print(f"=== {module}: {len(tests)} tests | package={PACKAGE}" + (f" | fixtures={n_fix}" if n_fix else "") + " ===") if n_fix and not push_fixtures(): print(" [fixtures] WARNING: not all fixtures reached the device — every " "test that opens one will record setup_failed") for t in tests: and_reset_depth() try: t() except Exception as exc: print(f" [EXC ] {getattr(t, '__name__', t)}: {exc}") return save_results(module)
# ══════════════════════════════════════════════════════════════════════════════# (2) Device & adb primitives# ══════════════════════════════════════════════════════════════════════════════
def adb_shell(*args, timeout: int = 30) -> str: """`adb -s $DEVICE shell ...` -> stdout. The -s serial is ALWAYS injected, so a multi-device host can never dispatch to the wrong emulator.""" try: r = subprocess.run([ADB, "-s", DEVICE, "shell", *[str(a) for a in args]], capture_output=True, text=True, timeout=timeout) return r.stdout.strip() except subprocess.TimeoutExpired: return "" except Exception: return ""
def adb_raw(*args, timeout: int = 30) -> str: """`adb -s $DEVICE ...` (no `shell`) — for install/pull/exec-out.""" try: r = subprocess.run([ADB, "-s", DEVICE, *[str(a) for a in args]], capture_output=True, text=True, timeout=timeout) return r.stdout.strip() except Exception: return ""
def device_online() -> bool: try: out = subprocess.run([ADB, "devices"], capture_output=True, text=True, timeout=15).stdout except Exception: return False return any(ln.startswith(DEVICE) and ln.rstrip().endswith("device") for ln in out.splitlines()[1:])
def get_screen_info() -> dict: """Cached screen geometry. EVERY coordinate must be derived from this, never written as a literal — density and font scale differ across devices.""" global _screen_info if _screen_info: return _screen_info m = re.search(r"(\d+)x(\d+)", adb_shell("wm", "size")) w, h = (int(m.group(1)), int(m.group(2))) if m else (1080, 2400) md = re.search(r"(\d+)", adb_shell("wm", "density")) _screen_info = {"width": w, "height": h, "density": int(md.group(1)) if md else 440, "center_x": w // 2, "center_y": h // 2} return _screen_info
def screencap(path: str) -> bool: """Screenshot to a local path. exec-out first; falls back to on-device screencap + pull, which is what survives a tunnelled adb connection.""" os.makedirs(os.path.dirname(path) or ".", exist_ok=True) try: with open(path, "wb") as f: subprocess.run([ADB, "-s", DEVICE, "exec-out", "screencap", "-p"], stdout=f, timeout=20) if os.path.getsize(path) > 0: return True except Exception: pass remote = "/sdcard/_kit_shot.png" adb_shell("screencap", "-p", remote) adb_raw("pull", remote, path, timeout=40) adb_shell("rm", "-f", remote) return os.path.exists(path) and os.path.getsize(path) > 0
# ── Fixtures: sample files a file/image/document app needs to have anything to# open. These MUST be a pipeline artifact, not something you push by hand while# exploring: testgen and eval run in DIFFERENT jobs on DIFFERENT emulators, so a# hand-pushed file is gone by eval and every test that opens it records# setup_failed — blaming the recreation for a harness gap.## authoring (once, during recon): write the files into <EVAL_OUT>/fixtures/# consuming (every test run): run_suite() pushes them before the first test## The directory rides along with the test files into the testcases bank, so the# bytes are restored on every later eval. Sub-directories are preserved, so# fixtures/docs/a.pdf lands at /sdcard/Download/docs/a.pdf.FIXTURES_DEVICE_DIR = "/sdcard/Download"_fixtures_pushed = False
def fixtures_dir() -> str: """The host fixtures directory, or "" when this app needs none.
The script's own directory comes FIRST: at eval, RESULTS_DIR is a separate eval_results/ dir, while the fixtures were restored next to the test files. """ for cand in (os.environ.get("FIXTURES_DIR", ""), os.path.join(os.path.dirname(os.path.abspath(sys.argv[0] or ".")), "fixtures"), os.path.join(RESULTS_DIR, "fixtures")): if cand and os.path.isdir(cand): return cand return ""
def fixture_names() -> list[str]: """Fixture paths relative to fixtures_dir(), e.g. ["doc.pdf", "docs/b.epub"].""" src = fixtures_dir() if not src: return [] out = [] for root, _dirs, files in os.walk(src): for fn in sorted(files): if fn.startswith("."): continue out.append(os.path.relpath(os.path.join(root, fn), src)) return sorted(out)
def fixture_on_device(name: str, dest: str = FIXTURES_DEVICE_DIR) -> str: """Where `name` lives on the device after push_fixtures().""" return f"{dest.rstrip('/')}/{name}"
def push_fixtures(dest: str = FIXTURES_DEVICE_DIR, *, force: bool = False) -> bool: """Mirror the host fixtures onto the device. Idempotent and safe to call from every test — a file already there with the same size is not re-pushed, so the six module processes cost one real push between them.
Returns True when the device holds every fixture (including the vacuous case of an app that needs none). """ global _fixtures_pushed if _fixtures_pushed and not force: return True src = fixtures_dir() names = fixture_names() if not src or not names: _fixtures_pushed = True return True ok = True pushed = 0 for rel in names: local = os.path.join(src, rel) remote = fixture_on_device(rel, dest) try: want = os.path.getsize(local) except OSError: ok = False continue got = adb_shell("stat", "-c", "%s", remote) if not force and got.isdigit() and int(got) == want: continue parent = remote.rsplit("/", 1)[0] if parent: adb_shell("mkdir", "-p", parent) adb_raw("push", local, remote, timeout=120) check = adb_shell("stat", "-c", "%s", remote) if check.isdigit() and int(check) == want: pushed += 1 else: ok = False print(f" [fixtures] FAILED to push {rel} -> {remote}") if pushed: # Make the files visible to gallery/media-backed pickers. Both forms are # API-level dependent and neither is required for plain SAF browsing, so # failures here are not fatal. adb_shell("content", "call", "--uri", "content://media/external/file", "--method", "scan_volume", "--arg", "external_primary") adb_shell("am", "broadcast", "-a", "android.intent.action.MEDIA_SCANNER_SCAN_FILE", "-d", f"file://{dest}") print(f" [fixtures] pushed {pushed}/{len(names)} fixture(s) to {dest}") _fixtures_pushed = ok return ok
# ══════════════════════════════════════════════════════════════════════════════# (3) UI tree query & element matching# ══════════════════════════════════════════════════════════════════════════════
def dump_xml(retries: int = 3, settle_first: bool = True) -> str: """uiautomator dump -> XML text. Retries because the dump fails outright while an animation is in flight.""" if settle_first: settle("dump") remote = "/sdcard/_kit_ui.xml" for attempt in range(retries): adb_shell("uiautomator", "dump", remote) xml = adb_shell("cat", remote, timeout=60) if "<node" in xml: return xml settle("dump_retry") return ""
def parse_nodes(xml_str: str) -> list[dict]: """XML -> list of attribute dicts, each with _bounds and _center.""" nodes = [] for m in re.finditer(r"<node\s+([^>]+?)/?>", xml_str): attrs_str = m.group(1) attrs = {am.group(1): am.group(2) for am in re.finditer(r'([\w-]+)="([^"]*)"', attrs_str)} b = re.search(r'bounds="\[(\d+),(\d+)\]\[(\d+),(\d+)\]"', attrs_str) if b: x1, y1, x2, y2 = (int(v) for v in b.groups()) attrs["_bounds"] = (x1, y1, x2, y2) attrs["_center"] = ((x1 + x2) // 2, (y1 + y2) // 2) nodes.append(attrs) return nodes
def ui(retries: int = 3) -> list[dict]: """THE entry point for a fresh tree. Call it again after ANY state change — a scroll, navigation, dialog, or keyboard invalidates every prior coordinate.""" return parse_nodes(dump_xml(retries=retries))
def find_nodes(nodes, **criteria) -> list[dict]: """Nodes matching ALL criteria, EXACT string match. `True`/`False` match the "true"/"false" attribute strings. Underscores in keys become dashes (content_desc -> content-desc).""" out = [] for n in nodes: ok = True for k, v in criteria.items(): key = k.replace("_", "-") if "_" in k and k != "class" else k if key not in n: ok = False break if v is True and n[key] != "true": ok = False break if v is False and n[key] != "false": ok = False break if v is not True and v is not False and n[key] != v: ok = False break if ok: out.append(n) return out
def find_node(nodes, **criteria) -> dict | None: f = find_nodes(nodes, **criteria) return f[0] if f else None
def find_by_class(nodes, widget_class: str) -> list[dict]: """Partial class-name match, e.g. "Switch", "EditText", "RecyclerView".""" return [n for n in nodes if widget_class in n.get("class", "")]
def find_node_ci(nodes, text: str) -> dict | None: """Case-insensitive text or content-desc match. Use for user-visible labels whose casing a faithful recreation may legitimately differ on.""" t = text.strip().lower() for n in nodes: if (n.get("text", "").strip().lower() == t or n.get("content-desc", "").strip().lower() == t): return n return None
def node_by_id(nodes, rid_suffix: str) -> dict | None: """Match the LAST segment of resource-id, so the package prefix (which differs between original and recreation) is never compared.""" for n in nodes: rid = n.get("resource-id", "") if rid and rid.rsplit("/", 1)[-1] == rid_suffix: return n return None
def find_closest_match(nodes, original_node) -> dict | None: """Re-locate a node in a fresh dump by similarity (class/text/desc/position).""" best, best_score = None, 0 for n in nodes: score = 0 if n.get("class") == original_node.get("class"): score += 3 if n.get("text") and n.get("text") == original_node.get("text"): score += 5 if (n.get("content-desc") and n.get("content-desc") == original_node.get("content-desc")): score += 4 if "_center" in n and "_center" in original_node: if (abs(n["_center"][0] - original_node["_center"][0]) < 100 and abs(n["_center"][1] - original_node["_center"][1]) < 100): score += 2 if score > best_score: best, best_score = n, score return best if best_score >= 3 else None
def node_key(n: dict) -> str: """"{shortClass}|{identity}" — the surface-membership key. Identity priority: text -> content-desc -> resource-id suffix. Returns "" for anonymous nodes (pure layout containers), which are excluded from a surface.""" cls = n.get("class", "").rsplit(".", 1)[-1] ident = (n.get("text", "").strip() or n.get("content-desc", "").strip() or n.get("resource-id", "").rsplit("/", 1)[-1]) return f"{cls}|{ident}" if ident else ""
def and_showing(nodes=None) -> set[str]: """Snapshot the current SURFACE as a set of discriminating element keys. Only on-screen, non-degenerate, identity-bearing nodes count. Take one before and one after a trigger and feed them to and_reach().""" nodes = ui() if nodes is None else nodes s = get_screen_info() out = set() for n in nodes: b = n.get("_bounds") if not b: continue x1, y1, x2, y2 = b if (x2 - x1) < 5 or (y2 - y1) < 5: continue if x2 <= 0 or y2 <= 0 or x1 >= s["width"] or y1 >= s["height"]: continue k = node_key(n) if k: out.add(k) return out
def and_reach(before, after, target: str, source: str | None = None) -> bool: """TRUE-JUMP verdict: the TARGET surface's element newly APPEARED and (if given) the SOURCE surface's element DISAPPEARED. This is what separates a real surface jump from reading an element that was in the tree all along.""" before, after = set(before or []), set(after or []) t = target.strip().lower() appeared = any(t in k.lower() for k in (after - before)) if source is None: return appeared s = source.strip().lower() return (appeared and any(s in k.lower() for k in before) and not any(s in k.lower() for k in after))
def surface_changed(before, after, min_delta: int = 2) -> bool: """Weaker than and_reach: the surface changed materially but you are not naming the target. Use for shape deltas, never to claim a `reach`.""" return len(set(before or []) ^ set(after or [])) >= min_delta
def and_surface_id(nodes=None) -> str: """A stable-ish fingerprint of the current surface, for "did this change?".""" keys = sorted(and_showing(nodes)) return f"{len(keys)}:{hash(tuple(keys)) & 0xFFFFFF:06x}"
# ══════════════════════════════════════════════════════════════════════════════# (4) Interaction# ══════════════════════════════════════════════════════════════════════════════
def tap(x, y) -> None: adb_shell("input", "tap", int(x), int(y)) settle("tap")
def tap_node(node) -> bool: """Tap a node's centre, validating bounds against the real screen first.""" if not node or "_center" not in node: return False x, y = node["_center"] s = get_screen_info() if x < 0 or x > s["width"] or y < 0 or y > s["height"]: return False if "_bounds" in node: x1, y1, x2, y2 = node["_bounds"] if (x2 - x1) < 5 or (y2 - y1) < 5: return False tap(x, y) return True
def tap_text(nodes, text: str) -> bool: n = find_node(nodes, text=text) or find_node_ci(nodes, text) return tap_node(n) if n else False
def is_safe(node) -> bool: """False for destructive controls. Tests mutate real device state, so every exploratory tap must go through this.""" blob = " ".join([node.get("text", ""), node.get("content-desc", ""), node.get("resource-id", "")]).lower() return not any(d in blob for d in DANGEROUS_TEXTS)
def safe_tap(node) -> bool: return tap_node(node) if node and is_safe(node) else False
def long_press(node, ms: int = 800) -> bool: """Long-press = a zero-distance swipe with a duration.""" if not node or "_center" not in node: return False x, y = node["_center"] adb_shell("input", "swipe", x, y, x, y, int(ms)) settle("tap") return True
def swipe(x1, y1, x2, y2, ms: int = 300) -> None: adb_shell("input", "swipe", int(x1), int(y1), int(x2), int(y2), int(ms)) settle("swipe")
def scroll_down(frac: float = 0.5) -> None: s = get_screen_info() swipe(s["center_x"], int(s["height"] * 0.7), s["center_x"], int(s["height"] * (0.7 - frac)))
def scroll_up(frac: float = 0.5) -> None: s = get_screen_info() swipe(s["center_x"], int(s["height"] * 0.3), s["center_x"], int(s["height"] * (0.3 + frac)))
def open_drawer() -> None: s = get_screen_info() swipe(5, s["center_y"], int(s["width"] * 0.8), s["center_y"], ms=400)
def scroll_into_view(text: str, max_swipes: int = 4) -> dict | None: """Scroll until `text` is on screen, RE-DUMPING between swipes. This encodes "after a scroll every previous coordinate is invalid" as code.""" for _ in range(max_swipes + 1): nodes = ui() n = find_node(nodes, text=text) or find_node_ci(nodes, text) if n: return n scroll_down(0.4) return None
def press_key(keycode) -> None: adb_shell("input", "keyevent", keycode) settle("key")
def back() -> None: """Raw BACK. Use and_back() when you are leaving a surface you entered.""" press_key("KEYCODE_BACK")
def home() -> None: press_key("KEYCODE_HOME")
def enter() -> None: press_key("KEYCODE_ENTER")
def keyboard_visible() -> bool: return "mInputShown=true" in adb_shell("dumpsys", "input_method")
def hide_keyboard() -> bool: """Dismiss the soft keyboard without navigating away. Tries, in order: the collapse affordance, an empty region, then BACK — and BACK is only accepted if the surface did NOT change, because BACK can navigate instead.""" if not keyboard_visible(): return True nodes = ui() for n in nodes: blob = (n.get("content-desc", "") + n.get("resource-id", "")).lower() if any(w in blob for w in ("hide", "collapse", "close_keyboard", "back")): if tap_node(n): settle("keyboard") if not keyboard_visible(): return True s = get_screen_info() tap(s["center_x"], int(s["height"] * 0.12)) # top strip is rarely interactive settle("keyboard") if not keyboard_visible(): return True sid = and_surface_id() back() settle("keyboard") if keyboard_visible(): return False if and_surface_id() != sid: print(" [warn] hide_keyboard: BACK also changed the surface") return True
def _quote_for_device(text: str) -> str: """Quote a string for the on-device shell (adb joins argv with spaces).""" return shlex.quote(text)
def type_text(node, text: str, *, method: str = "auto", verify_focus: bool = True) -> bool: """Type into an EditText, safely.
An unfocused EditText silently swallows ALL input (including paste and the ADB-Keyboard broadcast), so this taps the field, re-dumps, and asserts focused="true" before typing — retrying the tap once.
Routing: pure ASCII -> `input text`. Non-ASCII -> Clipper broadcast + paste. method="ime" -> ADB Keyboard, which needs a re-tap after the IME switch (the switch drops focus) and ALWAYS restores the original IME in a finally. """ if not node: return False target = node if verify_focus: ok = False for _ in range(2): if not tap_node(target): return False settle("keyboard") fresh = find_closest_match(ui(), target) or target if fresh.get("focused") == "true": target, ok = fresh, True break target = fresh if not ok: print(" [warn] type_text: field never reported focused=true") else: tap_node(target) settle("keyboard")
is_ascii = all(ord(c) < 128 for c in text) use = method if use == "auto": use = "input" if is_ascii else "clipper"
if use == "input": adb_shell("input", "text", _quote_for_device(text.replace(" ", "%s"))) settle("text") return True
if use == "clipper": adb_shell("am", "broadcast", "-a", "clipper.set", "-e", "text", _quote_for_device(text)) settle("text") press_key(279) # KEYCODE_PASTE settle("text") return True
# method="ime": ADB Keyboard. Some custom views ignore paste, this is the fallback. original = adb_shell("settings", "get", "secure", "default_input_method") try: adb_shell("ime", "set", ADB_KEYBOARD_IME) settle("ime") tap_node(target) # IME switch dropped focus settle("keyboard") adb_shell("am", "broadcast", "-a", "ADB_INPUT_TEXT", "--es", "msg", _quote_for_device(text)) settle("text") return True finally: if original and "null" not in original.lower(): adb_shell("ime", "set", original) # NEVER leave it switched settle("ime")
# ══════════════════════════════════════════════════════════════════════════════# (5) Navigation & the depth family# ══════════════════════════════════════════════════════════════════════════════
def and_reset_depth() -> None: global _DEPTH _DEPTH = 0
def and_enter(surface: str = "") -> int: """Call right AFTER your test navigates into a new surface. This is what backs a declared depth>=1 — and_audit_depth looks for a call from the and_enter*/and_reach* family.""" global _DEPTH _DEPTH += 1 return _DEPTH
def and_back() -> int: """Press BACK and pop one surface.""" global _DEPTH back() _DEPTH = max(0, _DEPTH - 1) return _DEPTH
def and_enter_surface(nodes, target_text: str = "", content_desc: str = "", rid: str = "") -> tuple[bool, str]: """Tap a named trigger, then confirm the surface changed. Counts one surface on success. Returns (ok, note). Prefer and_reach_surface when you can name the destination — that yields jump_kind="reach".""" n = None if target_text: n = find_node(nodes, text=target_text) or find_node_ci(nodes, target_text) if n is None and content_desc: n = find_node(nodes, content_desc=content_desc) if n is None and rid: n = node_by_id(nodes, rid) if n is None: return False, f"setup_failed: trigger not found ({target_text or content_desc or rid})" before = and_showing(nodes) if not tap_node(n): return False, "setup_failed: trigger not tappable" after = and_showing() if not surface_changed(before, after): return False, "behavior_wrong: surface did not change after tapping the trigger" and_enter(target_text or content_desc or rid) return True, ""
def and_reach_surface(node, target: str, source: str | None = None) -> bool: """Tap `node`, then PROVE the jump: `target` appeared and `source` vanished. Counts one surface. This is the only honest way to claim jump_kind="reach".""" before = and_showing() if not tap_node(node): return False after = and_showing() ok = and_reach(before, after, target, source) if ok: and_enter(target) return ok
# ══════════════════════════════════════════════════════════════════════════════# (6) App lifecycle — always keyed on PACKAGE (argv[1]), never a literal# ══════════════════════════════════════════════════════════════════════════════
def launch_app() -> None: adb_shell("monkey", "-p", PACKAGE, "-c", "android.intent.category.LAUNCHER", "1") settle("launch")
def force_stop() -> None: adb_shell("am", "force-stop", PACKAGE) settle("key")
def clear_data() -> None: """Wipe app data. Use to guarantee a clean entry point, never mid-assertion.""" adb_shell("pm", "clear", PACKAGE) settle("key")
def restart_app() -> None: force_stop() launch_app()
def force_stop_and_relaunch() -> None: """The persistence probe: kill the process, relaunch, then assert the state survived. An in-memory-only recreation fails this.""" force_stop() settle("key") launch_app()
def get_current_activity() -> str: out = adb_shell("dumpsys", "activity", "activities") m = re.search(r"mResumedActivity.*?\{[^}]*?([\w.]+/[\w.$]+)", out) if m: return m.group(1) m = re.search(r"mCurrentFocus=.*?\{[^}]*?([\w.]+/[\w.$]+)", adb_shell("dumpsys", "window")) return m.group(1) if m else ""
def is_app_foreground() -> bool: return PACKAGE in get_current_activity() or PACKAGE in adb_shell("dumpsys", "window")
def wait_for_foreground(timeout: int = 10) -> bool: deadline = time.time() + timeout while time.time() < deadline: if is_app_foreground(): return True time.sleep(0.5) return False
# ══════════════════════════════════════════════════════════════════════════════# (7) VLM# ══════════════════════════════════════════════════════════════════════════════
# OpenAI-compatible endpoint. Hardcoded on purpose: the public DashScope native# endpoint rejected the key that pods are provisioned with, so every generated# suite either lost its whole VLM track or shipped a hand-rolled `dashscope.py`# shim to reroute it. This speaks plain chat/completions over the standard library# only — no `pip install`, and the stale shims in the testcases bank can no longer# shadow the transport because nothing imports `dashscope` any more.VLM_BASE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1"_VLM_DEFAULT_KEY = "sk-bd0c3f375649439bba62b5b0e8c13057"# Attempts per key. 3 covers the blips seen in practice (empty body, gateway 5xx,# rate-limit bursts) without turning a genuine outage into a 10-minute stall.VLM_RETRIES = int(os.environ.get("VLM_RETRIES", "3"))# Repeating these cannot help: the request itself is wrong (malformed, missing,# too large, or semantically rejected). Everything else 4xx/5xx is worth a retry._VLM_TERMINAL_CODES = {400, 404, 413, 422}
def _vlm_key() -> str: """The judge model's API key: first non-empty of DASHSCOPE_API_KEY, VLM_API_KEY, JUDGE_API_KEY. Empty when none is set.""" for name in ("DASHSCOPE_API_KEY", "VLM_API_KEY", "JUDGE_API_KEY"): v = os.environ.get(name, "").strip() if v: return v return ""
def call_vlm(image_path: str, prompt: str, *, retries: int = 0) -> str | None: """Ask the VLM one question about a local screenshot. Returns the answer text.
Retries transient API failures (empty body, 429, 408/409/425, any 5xx) up to `retries` times — default VLM_RETRIES (3), overridable via the VLM_RETRIES env var. Terminal errors (bad key, malformed/oversized request) are not retried. """ retries = retries or VLM_RETRIES key = _vlm_key() or _VLM_DEFAULT_KEY try: with open(image_path, "rb") as f: b64 = base64.b64encode(f.read()).decode() except Exception as exc: print(f"[VLM] cannot read screenshot {image_path}: {exc}") return None mime = "image/jpeg" if image_path.lower().endswith((".jpg", ".jpeg")) else "image/png" body = json.dumps({ "model": os.environ.get("JUDGE_MODEL", "qwen3.6-plus"), "temperature": 0, "messages": [{"role": "user", "content": [ {"type": "image_url", "image_url": {"url": f"data:{mime};base64,{b64}"}}, {"type": "text", "text": prompt}, ]}], }).encode()
for attempt in range(retries): backoff = 2 * (attempt + 1) req = urllib.request.Request( f"{VLM_BASE_URL}/chat/completions", data=body, headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"}) try: with urllib.request.urlopen(req, timeout=120) as resp: data = json.loads(resp.read().decode()) text = (data["choices"][0]["message"]["content"] or "").strip() if text: return text print(f"[VLM] empty response (attempt {attempt + 1}/{retries})") except urllib.error.HTTPError as exc: detail = exc.read().decode(errors="replace")[:200] print(f"[VLM] HTTP {exc.code} (attempt {attempt + 1}/{retries}): {detail}") if exc.code in (401, 403) or exc.code in _VLM_TERMINAL_CODES: return None # repeating cannot help if exc.code == 429: backoff = 10 * (attempt + 1) # rate limit, not a blip except Exception as exc: # timeout, DNS, reset, bad JSON print(f"[VLM] call failed (attempt {attempt + 1}/{retries}): {exc}") if attempt < retries - 1: time.sleep(backoff) print(f"[VLM] giving up after {retries} attempt(s)") return None
def vlm_assert(test_name, question, results_dir=None, expect="YES", *, depth=None, jump_kind="none", tag=None) -> bool: """Screenshot the current screen, ask the VLM one YES/NO question, record it.
`test_name` is auto-suffixed with `_vlm`, which is what routes it to the VLM track in save_results(). `tag` (color|shape|position|size|layout|content) lets and_audit compute the fine-grained share mechanically — always set it.
Ask about a SPECIFIC observable rendered property. A question that a blank screen or any app would pass is worthless. """ if not test_name.endswith("_vlm"): test_name += "_vlm" rd = results_dir or RESULTS_DIR if tag and tag not in VLM_TAGS: print(f" [warn] vlm_assert: unknown tag {tag!r}") ss_path = os.path.join(rd, "screenshots", f"{test_name}.png") if not screencap(ss_path): return record(test_name, False, "setup_failed: screenshot capture failed", depth=depth, jump_kind=jump_kind, tag=tag)
prompt = ("Look at this Android app screenshot and answer the following question " "with ONLY 'YES' or 'NO'. Do not explain.\n\n" f"Question: {question}\n\nAnswer (YES or NO):") # An unparseable answer is the same class of flakiness as an empty body, so # re-ask rather than scoring harness noise against the VLM track. answer, resp = "", None for ask in range(VLM_RETRIES): resp = call_vlm(ss_path, prompt) if resp is None: return record(test_name, False, "setup_failed: VLM API call failed", depth=depth, jump_kind=jump_kind, tag=tag) a = resp.strip().upper() # Whole-word match only: a bare `"NO" in a` also fires on CANNOT / NOT / # NONE / KNOW, turning "Maybe? I cannot tell." into a confident NO and # failing the test on harness noise instead of re-asking. has_yes = re.search(r"\bYES\b", a) is not None has_no = re.search(r"\bNO\b", a) is not None if a.startswith("YES"): answer = "YES" elif a.startswith("NO"): answer = "NO" elif has_yes and not has_no: answer = "YES" elif has_no and not has_yes: answer = "NO" if answer: break print(f"[VLM] unparseable answer {resp!r} (ask {ask + 1}/{VLM_RETRIES})") if not answer: return record(test_name, False, f"setup_failed: ambiguous VLM response after {VLM_RETRIES} " f"asks {resp!r}", depth=depth, jump_kind=jump_kind, tag=tag)
passed = answer == expect.upper() record(test_name, passed, (f"VLM: Q='{question}' A={answer} expect={expect}" if passed else f"behavior_wrong: VLM Q='{question}' A={answer} expect={expect}"), depth=depth, jump_kind=jump_kind, expect=f"VLM {expect}: {question}", tag=tag)
af = os.path.join(rd, "vlm_assertions.json") try: existing = json.load(open(af)) if os.path.exists(af) else [] if not isinstance(existing, list): existing = [] except Exception: existing = [] existing.append({"test_name": test_name, "question": question, "screenshot": ss_path, "vlm_response": resp, "vlm_answer": answer, "expected": expect, "passed": passed, "tag": tag or ""}) try: _write_json(af, existing) # type: ignore[arg-type] except Exception: with open(af, "w") as f: json.dump(existing, f, indent=2, ensure_ascii=False) return passed
# ══════════════════════════════════════════════════════════════════════════════# (8) Audit / lint — ALL report-only. None of these ever blocks delivery.# ══════════════════════════════════════════════════════════════════════════════
def _load_all(results_dir: str) -> list[dict]: recs, seen_files = [], set() for pat in (os.path.join(results_dir, "android_*_eval.json"), os.path.join(results_dir, "eval_results", "android_*_eval.json")): for path in glob.glob(pat): base = os.path.basename(path) if base in seen_files: continue seen_files.add(base) try: data = json.load(open(path)) except Exception: continue for t in data.get("results", []): if isinstance(t, dict) and "test" in t: recs.append(t) return recs
def and_audit(results_dir: str = "", quotas: dict | None = None) -> dict: """Aggregate declared depth/jump_kind/vlm-tag across the suite and report the quota TARGETS with the concrete gap. GOALS, not a gate.""" results_dir = results_dir or RESULTS_DIR q = quotas or QUOTAS recs = _load_all(results_dir) backfilled = [r for r in recs if r.get("backfilled")] recs = [r for r in recs if not r.get("backfilled")] n = len(recs) if not n: print(f"[and_audit] no records under {results_dir}") return {"total": 0} kinds = [r.get("jump_kind", "none") for r in recs] none_n = sum(1 for k in kinds if k == "none") live_n = sum(1 for k in kinds if k == "liveness") inter = [r for r in recs if r.get("jump_kind") in ("reach", "transition", "value")] ni = len(inter) or 1 d1 = sum(1 for r in inter if int(r.get("depth", 0)) >= 1) d2 = sum(1 for r in inter if int(r.get("depth", 0)) >= 2) val = sum(1 for r in inter if r.get("jump_kind") == "value") vlm = [r for r in recs if r["test"].endswith("_vlm")] fine = sum(1 for r in vlm if r.get("tag") in VLM_FINE_TAGS) vlm_share = len(vlm) / n
def line(label, got, need, kind): ok = got >= need if kind == "min" else got <= need return ok, (f" [{'ok ' if ok else 'GAP'}] {label}: {got:.0%} " f"({'>=' if kind == 'min' else '<='} {need:.0%})")
lo, hi = q["vlm_share_min"], q["vlm_share_max"] vlm_ok = lo <= vlm_share <= hi if vlm_share < lo: # each added vlm record also grows the denominator: (v+x)/(n+x) >= lo need_more = math.ceil((lo * n - len(vlm)) / (1 - lo)) vlm_hint = (f"under budget by ~{max(1, need_more)} record(s) — allocate more " f"per lane NEXT run; do not re-run to chase it") elif vlm_share > hi: vlm_hint = "over budget — allocate fewer per lane next run" else: vlm_hint = "in budget" vlm_msg = (f" [{'ok ' if vlm_ok else 'GAP'}] VLM BUDGET vlm/total: " f"{len(vlm)}/{n} = {vlm_share:.0%} (target {lo:.0%}-{hi:.0%}) " f"— {vlm_hint}")
checks = [ line("existence(none)/all", none_n / n, q["existence_max"], "max"), line("interactive/all", len(inter) / n, q["interactive_min"], "min"), line("depth>=1 /interactive", d1 / ni, q["depth_ge1_min"], "min"), line("depth>=2 /interactive", d2 / ni, q["depth_ge2_min"], "min"), line("value(tier3)/interactive", val / ni, q["value_min"], "min"), (vlm_ok, vlm_msg), line("vlm fine-grained/vlm", fine / (len(vlm) or 1), q["vlm_fine_min"], "min"), ] print(f"[and_audit] {results_dir} total={n} interactive={len(inter)} " f"none={none_n} liveness={live_n} depth>=1={d1} depth>=2={d2} " f"value={val} vlm={len(vlm)} vlm_fine={fine}") if backfilled: print(f" [!!!] {len(backfilled)} record(s) never reached their assertion " f"(back-filled as failures) — excluded from the ratios above; the " f"100%-pass gate on the original app must catch these") for _ok, msg in checks: print(msg) passed = all(ok for ok, _ in checks) print("[and_audit] " + ("ALL TARGETS MET" if passed else "some targets below — this is a REPORT, not a task: finalize now and fix " "the shortfall in the NEXT run's plan. Re-running the suite to move these " "numbers costs hours and changes nothing about the app under test")) return {"total": n, "interactive": len(inter), "none": none_n, "liveness": live_n, "depth_ge1": d1, "depth_ge2": d2, "value": val, "vlm": len(vlm), "vlm_fine": fine, "vlm_share": round(vlm_share, 4), "backfilled": len(backfilled), "passed": passed, "checks": [m for _o, m in checks]}
def and_lint(results_dir: str = "") -> list[str]: """Flag weak or inconsistent DECLARATIONS.""" results_dir = results_dir or RESULTS_DIR issues, names = [], set() for r in _load_all(results_dir): jk, nm = r.get("jump_kind", "none"), r.get("test", "?") if nm in names: issues.append(f"{nm}: duplicate record name (drifts the denominator)") names.add(nm) if jk not in JUMP_KINDS: issues.append(f"{nm}: unknown jump_kind {jk!r}") if jk in ("reach", "transition", "value") and not str(r.get("expect", "")).strip(): issues.append(f"{nm}: jump_kind={jk} but empty expect " f"(name the specific observed target)") if jk == "liveness": issues.append(f"{nm}: liveness is tier1 — assert the app-authored effect instead") if int(r.get("depth", 0)) < 0: issues.append(f"{nm}: negative depth") msg = str(r.get("message", "")) if not r.get("passed") and not msg.startswith(FAIL_PREFIXES): issues.append(f"{nm}: failure message must start with one of " f"{'/'.join(FAIL_PREFIXES)} (got {msg[:40]!r})") if nm.endswith("_vlm") and not r.get("tag") and not r.get("backfilled"): issues.append(f"{nm}: VLM record has no tag " f"(color|shape|position|size|layout|content)") if issues: print(f"[and_lint] {len(issues)} issue(s):") for i in issues: print(" - " + i) else: print("[and_lint] no issues") return issues
# Non-portable source patterns: they pass on the ORIGINAL app and break on the# RECREATION (different package, different install path). Each is a hard defect._BAD_SOURCE_PATTERNS = [ (r"""["'][a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*){2,}["']""", "hardcodes a package name; use the module-level PACKAGE (argv[1]) — the " "recreation's package differs", ("android.", "androidx.", "java.", "javax.", "com.android.adbkeyboard", "ca.zgrs.clipper", "android.intent.", "com.google.android.inputmethod")), (r"""["'][^"']*\.apk["']|clean\.apk""", "names an APK path; the test must never install or locate the app", ()), (r"/data/data/|/sdcard/Android/data/", "uses a per-package data path, which breaks when the recreation's package " "differs; drive state through the GUI", ()), (r"\btap\(\s*\d{2,}\s*,\s*\d{2,}", "taps a hardcoded pixel coordinate; derive it from a node's _center or " "get_screen_info()", ()), (r"\bpm\s+grant\b|\bappops\s+set\b|\bsettings\s+put\b|\bcontent\s+insert\b", "seeds state outside the GUI; the recreation may not honor it — drive the " "same state through the UI", ()), (r"am\s+start\s+-n\s", "deep-links straight to a component: not portable, and not navigation " "(it cannot back a depth claim)", ()), (r"emulator-\d{4}|127\.0\.0\.1:\d{4}", "hardcodes a device serial; use the module-level DEVICE", ()),]
def and_lint_sources(testgen_dir: str = "") -> list[str]: """Scan authored test/helper .py for NON-PORTABLE patterns and for kit API drift. A clean result means the suite will actually drive the recreation, not just the original.""" testgen_dir = testgen_dir or RESULTS_DIR kit_base = os.path.basename(__file__) py = [p for p in (glob.glob(os.path.join(testgen_dir, "*.py")) + glob.glob(os.path.join(testgen_dir, "tests", "*.py"))) if os.path.basename(p) != kit_base] kit_names = set(globals().keys()) # A sample file the app is supposed to OPEN. Testgen and eval run on DIFFERENT # emulators, so naming one without pushing it means it only ever existed # because someone put it there by hand while exploring. _DEV_PATH_RE = re.compile(r"/sdcard/|/storage/emulated/|\bDCIM\b", re.I) _DOC_RE = re.compile( r"""["'][^"']*\.(?:pdf|epub|mobi|djvu|zim|mp3|mp4|mkv|wav|ogg)["']""", re.I) _fix_files = [f for f in glob.glob(os.path.join(testgen_dir, "fixtures", "**"), recursive=True) if os.path.isfile(f)] issues = [] srcs = {} for p in py: try: srcs[p] = open(p, errors="replace").read() except Exception: continue suite_pushes = any(re.search(r"\b(push_fixtures|fixture_on_device)\b", s) for s in srcs.values()) if _fix_files and not suite_pushes: issues.append( f"fixtures/: {len(_fix_files)} fixture file(s) are authored but NO test " f"calls push_fixtures() — they never reach the device, so every test " f"that opens one records setup_failed. Call it once via run_suite(), " f"or drop the directory.") for p, src in srcs.items(): base = os.path.basename(p) # Strip comments AND docstrings: prose describing the app under test names # files it opens, which is not the same as the code depending on one. scan = re.sub(r'"""[\s\S]*?"""|\'\'\'[\s\S]*?\'\'\'', '""', src) scan = re.sub(r"#[^\n]*", "", scan) # adb is called argv-style — adb_shell("am", "start", "-n", x) — so collapse # the quote-comma-quote separators to read those calls as command lines. flat = re.sub(r"""["']\s*,\s*["']""", " ", scan) if not suite_pushes: for ln in scan.splitlines(): m = _DEV_PATH_RE.search(ln) or _DOC_RE.search(ln) if m: issues.append( f"{base}: needs a sample file on the device " f"[{ln.strip()[:60]}] but the suite never calls " f"push_fixtures() — testgen and eval run on DIFFERENT " f"emulators, so at eval the file is absent. Author the bytes " f"into {os.path.join(testgen_dir, 'fixtures')}/ and let " f"run_suite() push them.") break for pat, why, allow in _BAD_SOURCE_PATTERNS: hit = None for form in (scan, flat): for m in re.finditer(pat, form): cand = m.group(0) if allow and any(a in cand for a in allow): continue hit = cand break if hit: break if hit: issues.append(f"{base}: {why} [{hit[:48]}]") # kit API drift — an import/attr the kit does not define imported: list[str] = [] for m in re.finditer( r"from\s+android_testgen_kit\s+import\s+\(([^)]*)\)", scan, re.S): imported += m.group(1).split(",") for m in re.finditer( r"from\s+android_testgen_kit\s+import\s+([^\n(]+)", scan): imported += m.group(1).split(",") for raw in imported: nm = raw.strip().split(" as ")[0].strip() if nm and nm != "*" and nm not in kit_names: issues.append(f"{base}: imports android_testgen_kit.{nm} which the " f"kit does not define (would ImportError at eval)") for m in re.finditer(r"\bkit\.(\w+)\s*\(", scan): if m.group(1) not in kit_names: issues.append(f"{base}: calls kit.{m.group(1)}() which the kit does " f"not define (would AttributeError at eval)") if issues: print(f"[and_lint_sources] {len(issues)} portability issue(s):") for i in issues: print(" - " + i) else: print("[and_lint_sources] no portability issues") return issues
# ── MEASURED depth cross-check (report-only): does the SOURCE back the DECLARE? ─def _ast_call_name(node) -> str: f = node.func if isinstance(f, ast.Attribute): return f.attr if isinstance(f, ast.Name): return f.id return ""
def _string_locals(fn_node) -> dict[str, str]: """`name = "states_toggle"` inside a test — so record(name, ...) resolves.""" out = {} for n in ast.walk(fn_node): if isinstance(n, ast.Assign) and isinstance(n.value, ast.Constant) \ and isinstance(n.value.value, str): for t in n.targets: if isinstance(t, ast.Name): out[t.id] = n.value.value return out
def _record_names(fn_node) -> list[str]: """Literal record()/vlm_assert() names in this function, preferring the @and_test(expects=(...)) literal when present.""" for dec in getattr(fn_node, "decorator_list", []): if isinstance(dec, ast.Call) and _ast_call_name(dec) == "and_test": for kw in dec.keywords: if kw.arg == "expects" and isinstance(kw.value, (ast.Tuple, ast.List)): return [e.value for e in kw.value.elts if isinstance(e, ast.Constant) and isinstance(e.value, str)] slocals = _string_locals(fn_node) names = [] for n in ast.walk(fn_node): if not (isinstance(n, ast.Call) and _ast_call_name(n) in ("record", "vlm_assert")): continue if not n.args: continue a0 = n.args[0] if isinstance(a0, ast.Constant) and isinstance(a0.value, str): names.append(a0.value) elif isinstance(a0, ast.Name) and a0.id in slocals: names.append(slocals[a0.id]) return names
def _depth_calls(fn_node, local_funcs, budget: int = 2, seen=None): """(fwd, back, reach) depth-family calls, descending `budget` levels into file-local helpers. Cycle-guarded. A LOWER BOUND — never an over-claim.""" seen = seen if seen is not None else set() fwd = bk = rch = 0 relaunch = False for node in ast.walk(fn_node): if not isinstance(node, ast.Call): continue cn = _ast_call_name(node) if DEPTH_FWD_RE.match(cn): fwd += 1 if cn.startswith("and_reach"): rch += 1 elif DEPTH_BACK_RE.match(cn): bk += 1 elif cn in ("launch_app", "restart_app", "force_stop_and_relaunch"): relaunch = True elif budget > 0 and cn in local_funcs and cn not in seen: seen.add(cn) f, b, r = _depth_calls(local_funcs[cn], local_funcs, budget - 1, seen)[:3] fwd, bk, rch = fwd + f, bk + b, rch + r return fwd, bk, rch, relaunch
def and_audit_depth(testgen_dir: str = "", results_dir: str = "") -> list[str]: """MEASURE navigation depth from the test SOURCE (AST) and cross-check the DECLARED depth/jump_kind — so a test cannot just TYPE depth=2. REPORT-ONLY.
Flags a declared depth>=1 or jump_kind="reach" with NO backing call from the depth family and_enter*/and_reach* (directly, in a file-local helper it calls, or anywhere in the module for variable-named records), plus a "reach" that was achieved by relaunching the app rather than navigating. """ testgen_dir = testgen_dir or RESULTS_DIR results_dir = results_dir or testgen_dir files = [p for p in (glob.glob(os.path.join(testgen_dir, "test_android_*.py")) + glob.glob(os.path.join(testgen_dir, "tests", "test_android_*.py")))] per_record, per_module = {}, {} for p in files: try: tree = ast.parse(open(p, errors="replace").read()) except Exception: continue stem = os.path.basename(p)[len("test_android_"):-len(".py")] mod = _MODULE_ALIAS.get(stem, stem) local_funcs = {n.name: n for n in ast.walk(tree) if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef))} module_backing = any( isinstance(n, ast.Call) and DEPTH_FWD_RE.match(_ast_call_name(n)) for n in ast.walk(tree)) per_module[mod] = {"module_backing": module_backing} for fn in local_funcs.values(): if not fn.name.startswith("test_"): continue fwd, bk, rch, relaunch = _depth_calls(fn, local_funcs) measured = max(0, max((fwd - rch) - bk, 1 if rch >= 1 else 0)) for nm in _record_names(fn): per_record[(mod, nm)] = {"measured_depth": measured, "backing": fwd >= 1, "n_reach": rch, "relaunch": relaunch, "fn": fn.name} issues = [] for r in _load_all(results_dir): nm, jk = r.get("test", "?"), r.get("jump_kind", "none") depth = int(r.get("depth", 0) or 0) strong = depth >= 1 or jk == "reach" hit = None for (mod, rname), v in per_record.items(): if rname == nm: hit = v break if hit is not None: if strong and not hit["backing"]: issues.append(f"{nm} ({hit['fn']}): declared depth={depth}/" f"jump_kind={jk} but NO backing and_enter*/and_reach* " f"call (fake depth)") elif jk == "reach" and hit["n_reach"] == 0: issues.append(f"{nm} ({hit['fn']}): jump_kind=reach but no " f"and_reach* call in its code") elif jk == "reach" and hit["relaunch"]: issues.append(f"{nm} ({hit['fn']}): jump_kind=reach but the function " f"relaunches the app — that is not navigation") elif strong and not any(v.get("module_backing", True) for v in per_module.values()): issues.append(f"{nm}: declared depth={depth}/jump_kind={jk} but no " f"and_enter*/and_reach* call anywhere (fake depth)") if issues: print(f"[and_audit_depth] {len(issues)} fake-depth issue(s) (REPORT-ONLY — " f"fix by adding the and_reach/and_enter you navigated with, or lower " f"the declared depth):") for i in issues: print(" - " + i) else: print("[and_audit_depth] no fake-depth issues " "(declared depth/reach backed by nav calls)") return issues
# ══════════════════════════════════════════════════════════════════════════════# (9) Frozen manifest — the FIXED denominator (ported from RecreationBench v7.2)## Without this, the eval denominator is whatever the candidate happened to emit:# a recreation that crashes a module SHRINKS its own denominator instead of# counting the missing behaviour as failures. The manifest is frozen ONCE per# task from the ORIGINAL app's run and is the denominator authority for every# candidate. Missing tests are injected as `not_run`; extra tests are ignored.# ══════════════════════════════════════════════════════════════════════════════
MANIFEST_NAME = "test_manifest.json"MANIFEST_VERSION = 1
def qualify_name(module: str, test: str) -> str: """`module::test` — two modules may legitimately reuse a short test name.""" return test if "::" in test else f"{module}::{test}"
def _record_status(rec: dict) -> str: if rec.get("status") in ("passed", "failed", "error", "skipped", "not_run"): return rec["status"] return "passed" if rec.get("passed") else "failed"
def _load_by_module(results_dir: str) -> list[tuple[str, dict]]: """Like _load_all but keeps the owning module, so names can be qualified.""" out, seen_files = [], set() for pat in (os.path.join(results_dir, "android_*_eval.json"), os.path.join(results_dir, "eval_results", "android_*_eval.json")): for path in sorted(glob.glob(pat)): base = os.path.basename(path) if base in seen_files: continue seen_files.add(base) try: data = json.load(open(path)) except Exception: continue mod = data.get("module") or base[len("android_"):-len("_eval.json")] for t in data.get("results", []): if isinstance(t, dict) and "test" in t: out.append((str(mod), t)) return out
def build_manifest(results_dir: str = "", *, task_id: str = "", baseline_model: str = "", out_path: str = "") -> dict: """Freeze the ORIGINAL app's PASSING tests as the denominator.
A test that fails on the original is not a signal about any recreation, so it is moved to `ignored[reason=baseline_fail]` instead of counting against every candidate. This is the only denominator-shrinking mechanism, and it is applied identically to all candidates. """ results_dir = results_dir or RESULTS_DIR tests, ignored, vlm_assertions = [], [], [] for mod, rec in _load_by_module(results_dir): name = qualify_name(mod, str(rec.get("test", ""))) status = _record_status(rec) entry = {"name": name, "module": mod, "baseline_status": status} if status == "passed": tests.append(entry) if name.endswith("_vlm"): vlm_assertions.append({"name": name, "module": mod, "tag": rec.get("tag", "")}) else: ignored.append({"name": name, "module": mod, "reason": "baseline_fail", "baseline_status": status, "message": str(rec.get("message", ""))[:300]}) tests.sort(key=lambda t: t["name"]) ignored.sort(key=lambda t: t["name"]) payload = "\n".join(t["name"] for t in tests) pkg = (os.environ.get("ORIG_PACKAGE") or os.environ.get("PACKAGE") or (PACKAGE if "." in PACKAGE else "")) manifest = { "manifest_version": MANIFEST_VERSION, "kit_api_version": KIT_API_VERSION, "task_id": task_id or os.environ.get("INSTANCE_ID", ""), "baseline_model": baseline_model or os.environ.get("MODEL", ""), "baseline_package": pkg, "total": len(tests), "manifest_sha": hashlib.sha256(payload.encode()).hexdigest()[:12], "tests": tests, "ignored": ignored, "vlm_assertions": vlm_assertions, "vlm_total": len(vlm_assertions), } dest = out_path or os.path.join(results_dir, MANIFEST_NAME) tmp = dest + ".tmp" with open(tmp, "w") as f: json.dump(manifest, f, indent=2, ensure_ascii=False) os.replace(tmp, dest) print(f"[build_manifest] {dest} total={manifest['total']} " f"vlm={manifest['vlm_total']} ignored={len(ignored)} " f"sha={manifest['manifest_sha']}") if ignored: print(f" {len(ignored)} baseline failure(s) excluded from the denominator " f"(they say nothing about a recreation):") for i in ignored[:20]: print(f" - {i['name']}: {i['message'][:120]}") return manifest
def load_manifest(d: str = "") -> dict | None: """Return the frozen manifest from `d` (or its eval_results/), else None.""" d = d or RESULTS_DIR for p in (os.path.join(d, MANIFEST_NAME), os.path.join(d, "eval_results", MANIFEST_NAME)): if os.path.isfile(p): try: m = json.load(open(p)) except Exception: continue if isinstance(m, dict) and m.get("tests"): return m return None
def score_against_manifest(results_dir: str = "", manifest: dict | None = None) -> dict: """Score a candidate run against the frozen denominator.
denominator = len(manifest["tests"]) regardless of what the candidate emitted. A manifest test the candidate never reported is injected as `not_run` (a non-pass); a test the candidate invented is excluded. A module that crashed on import therefore scores 0/full instead of vanishing. """ results_dir = results_dir or RESULTS_DIR manifest = manifest or load_manifest(results_dir) if not manifest: return {} expected = {t["name"]: t for t in manifest["tests"]} got = {} for mod, rec in _load_by_module(results_dir): got[qualify_name(mod, str(rec.get("test", "")))] = rec
per_test, by_module = {}, {} injected = 0 for name, meta in expected.items(): rec = got.get(name) if rec is None: status, msg = "not_run", "not_run: absent from the candidate's output" injected += 1 else: status, msg = _record_status(rec), str(rec.get("message", "")) per_test[name] = {"status": status, "message": msg[:300]} m = by_module.setdefault(meta.get("module", "?"), {"total": 0, "passed": 0, "not_run": 0}) m["total"] += 1 m["passed"] += status == "passed" m["not_run"] += status == "not_run"
unexpected = sorted(set(got) - set(expected)) total = len(expected) passed = sum(1 for v in per_test.values() if v["status"] == "passed") vlm_names = {a["name"] for a in manifest.get("vlm_assertions", [])} vlm_total = len(vlm_names) vlm_passed = sum(1 for n in vlm_names if per_test.get(n, {}).get("status") == "passed") rule_total = total - vlm_total rule_passed = passed - vlm_passed for m in by_module.values(): m["pass_rate"] = round(m["passed"] / m["total"], 4) if m["total"] else 0.0
out = { "scored_against": "manifest", "manifest_sha": manifest.get("manifest_sha", ""), "manifest_total": total, "total": total, "passed": passed, "pass_rate": round(passed / total, 4) if total else 0.0, "n_injected_not_run": injected, "n_unexpected": len(unexpected), "unexpected": unexpected[:50], "rule": {"total": rule_total, "passed": rule_passed, "pass_rate": round(rule_passed / rule_total, 4) if rule_total else 0.0}, "vlm": {"total": vlm_total, "passed": vlm_passed, "pass_rate": round(vlm_passed / vlm_total, 4) if vlm_total else 0.0}, "by_module": by_module, "per_test": per_test, } print(f"[score_against_manifest] sha={out['manifest_sha']} " f"{passed}/{total} = {out['pass_rate']:.4f} " f"(injected_not_run={injected} unexpected={len(unexpected)}) " f"rule={rule_passed}/{rule_total} vlm={vlm_passed}/{vlm_total}") return out
if __name__ == "__main__": _fns = {"audit": and_audit, "lint": and_lint, "lint_sources": and_lint_sources, "build_manifest": build_manifest} _argv = sys.argv[1:] if _argv[:1] == ["audit_depth"] and len(_argv) >= 2: and_audit_depth(_argv[1], _argv[2] if len(_argv) >= 3 else "") elif _argv[:1] == ["score"] and len(_argv) >= 2: _m = load_manifest(_argv[2]) if len(_argv) >= 3 else load_manifest(_argv[1]) _out = score_against_manifest(_argv[1], _m) if not _out: print("no manifest found — cannot score against a fixed denominator", file=sys.stderr) sys.exit(2) print(json.dumps(_out, ensure_ascii=False)) elif len(_argv) >= 2 and _argv[0] in _fns: _fns[_argv[0]](_argv[1]) else: print("usage: android_testgen_kit.py {audit|lint|lint_sources|build_manifest} <dir>\n" " android_testgen_kit.py audit_depth <testgen_dir> [results_dir]\n" " android_testgen_kit.py score <results_dir> [manifest_dir]")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206{ "module": "text", "total": 19, "passed": 19, "failed": 0, "pass_rate": 1.0, "rule": { "total": 16, "passed": 16, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 3, "passed": 3, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.1875, "audit": { "kit_api_version": 1, "existence": 3, "liveness": 0, "interactive": 16, "depth_ge1": 15, "depth_ge2": 8, "value": 14, "vlm_fine": 2 }, "results": [ { "test": "text_empty_folder_placeholder", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "placeholder text == 'Folder is empty.'" }, { "test": "text_empty_folder_placeholder_vlm", "passed": true, "message": "VLM: Q='Is a short single-line message like 'Folder is empty.' shown roughly centered in the middle of an otherwise blank note list (not at the top or bottom)?' A=YES expect=YES", "depth": 1, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Is a short single-line message like 'Folder is empty.' shown roughly centered in the middle of an otherwise blank note list (not at the top or bottom)?", "tag": "position" }, { "test": "text_search_nomatch_placeholder", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "placeholder == 'No notes found containing the search term.'" }, { "test": "text_search_clears_note_returns", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "'AlphaFindMe' present -> absent (nomatch) -> present (cleared)" }, { "test": "text_folder_count_singular", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "subtitle content-desc == '1 Note'" }, { "test": "text_folder_count_plural", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "subtitle content-desc == '2 Notes'" }, { "test": "text_home_folders_count_zero", "passed": true, "message": "", "depth": 0, "jump_kind": "value", "tier": 3, "expect": "tv_folders_count desc == '0 Folders'" }, { "test": "text_selection_subtitle", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "subtitle content-desc contains '• 1 Selected'" }, { "test": "text_new_note_created_timestamp", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "tv_created_at text == 'Created just now'" }, { "test": "text_new_note_created_timestamp_vlm", "passed": true, "message": "VLM: Q='Near the BOTTOM of the note-editing area, below the text fields, are two small timestamp lines beginning with 'Created' and 'Accessed' shown one under the other?' A=YES expect=YES", "depth": 2, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Near the BOTTOM of the note-editing area, below the text fields, are two small timestamp lines beginning with 'Created' and 'Accessed' shown one under the other?", "tag": "position" }, { "test": "text_new_note_accessed_timestamp", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "tv_accessed_at text == 'Accessed just now'" }, { "test": "text_editor_title_hint", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "et_note_title hint text == 'Title'" }, { "test": "text_editor_body_hint", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "et_note_body hint text == 'Body'" }, { "test": "text_echoed_note_title_body", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "folder row title=='MyNoteXYZ' body=='hello world foo bar'" }, { "test": "text_reading_mode_paging_label", "passed": true, "message": "", "depth": 3, "jump_kind": "value", "tier": 3, "expect": "tv_notes_count desc == '1 / 1 Note'" }, { "test": "text_reading_mode_paging_label_vlm", "passed": true, "message": "VLM: Q='Does this read-only note view display the title 'ReadMeNote' and the body text 'the quick brown fox jumps'?' A=YES expect=YES", "depth": 4, "jump_kind": "none", "tier": 0, "expect": "VLM YES: Does this read-only note view display the title 'ReadMeNote' and the body text 'the quick brown fox jumps'?", "tag": "content" }, { "test": "text_fab_create_note_desc", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "HOME fab desc 'Create folder' -> folder fab desc 'Create note'" }, { "test": "text_settings_screen_title", "passed": true, "message": "", "depth": 1, "jump_kind": "value", "tier": 3, "expect": "screen title text == 'Settings'" }, { "test": "text_note_options_reading_mode_label", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "Note-options row text == 'Reading Mode'" } ]}1pytest_plugins = ["rb_unify.pytest_rb", "rb_unify.android_bridge"]12pytestpillow123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615#!/usr/bin/env python3"""COMPUTATION module — Noto (minimal note-taking app).
Lane ownership: CORE FUNCTION, input -> output. This module is the SOLE owner ofjump_kind="value": every test TYPES or CREATES an input via the real user path,reads a FRESH ui() back, and asserts the exact COMPUTED output string it OBSERVEDthe original produce. It does NOT assert reachability (navigation), thechecked/selected/enabled bit (states), CRUD data integrity (interaction), theplaceholder/label wording (text), or the view-tree shape (structure).
THE CORE TRANSFORM = WORD COUNT. In the note editor `tv_word_count` has acontent-desc "N Words"/"1 Word" that updates LIVE as you type into `et_note_body`.The count is a whitespace-split token count of the BODY only (title excluded).
GROUND TRUTH — every expected value below was OBSERVED live on the original appbefore authoring (see the values in each expect=), never computed from source: empty body -> "0 Words" "hello" -> "1 Word" (SINGULAR is "1 Word", not "1 Words") "hello world" -> "2 Words" "hello world foo" -> "3 Words" "hello world foo bar" -> "4 Words" "one two three four five" -> "5 Words" "a b c d e f g" -> "7 Words" "hello world" -> "2 Words" (runs of spaces collapse) " hello world " -> "2 Words" (leading/trailing spaces trimmed) "hello, world!" -> "2 Words" (punctuation attached to a token adds none) long title + empty body -> "0 Words" (title does NOT count) long title + body "just one" -> "2 Words" (title does NOT count)Newline separation was DROPPED: typing "line1"<ENTER>"line2" read "1 Word" on theoriginal (ENTER does not reliably insert a body newline — an input-path artifact,not a word-count rule), so it is unobservable-as-a-rule and intentionally omitted.
Secondary transform = COUNT ARITHMETIC (how many records exist, rendered as astring). Two DIFFERENT surfaces render counts differently (OBSERVED): * FOLDER note-list screen: `tv_folder_notes_count` CONTENT-DESC "0 Notes" -> "1 Note" -> "2 Notes" -> "3 Notes" (singular/plural) * HOME sheet: `tv_folders_count` CONTENT-DESC "0 Folders"/"1 Folder"/"2 Folders"; library "All"/"Recent" cards render their count in the TEXT attribute ("2"), NOT content-desc. * Reading-mode paging: `tv_notes_count` content-desc "1 / 1 Note" (pos / total).
Invoke: python3 test_android_computation.py <PACKAGE> <RESULTS_DIR>"""import osimport sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,E402
# ══════════════════════════════════════════════════════════════════════════════# Local setup helpers (mirrors the sibling modules' conventions)# ══════════════════════════════════════════════════════════════════════════════
def dismiss_prompts(): """Dismiss the first-run system notification-permission dialog (and any stray prompt) sitting in front of the already-loaded Noto home. Matches both the ASCII "Don't allow" and the curly-apostrophe "Don't allow" (U+2019). The prompt reappears after a pm clear and was seen to return on relaunch too, so call it defensively after every launch.""" for _ in range(3): nodes = ui() b = (find_node_ci(nodes, "Don't allow") or find_node_ci(nodes, "Don’t allow") or find_node_ci(nodes, "Allow")) if b and is_safe(b): tap_node(b) settle("tap") continue break
def fresh_home(): """Virgin database (wipe) + HOME sheet. Guarantees the default 'General' folder exists and every count starts at zero, so created records and counts are deterministic.""" clear_data() launch_app() wait_for_foreground() dismiss_prompts() return ui()
def goto_home(): """Back out to the HOME bottom sheet (the one surface showing 'Create folder').""" for _ in range(5): if find_node(ui(), content_desc="Create folder"): break back() settle("tap") return ui()
# ── Depth-backing navigation helpers (named and_enter_*/and_reach_* so the depth# audit can attribute the declared depth to a real navigation call). ───────────
def and_enter_folder(name): """HOME sheet -> tap a folder row -> its note-list surface. Counts one surface. Returns True when the folder title is showing.""" n = find_node(ui(), text=name) if n is None or not tap_node(n): return False settle("tap") and_enter("folder:" + name) tit = node_by_id(ui(), "tv_folder_title") return tit is not None and tit.get("text") == name
def and_enter_editor(): """FOLDER note-list -> tap fab 'Create note' -> the note editor. Counts one surface. Returns True when et_note_body is present.""" fab = find_node(ui(), content_desc="Create note") if fab is None or not tap_node(fab): return False settle("tap") and_enter("editor") return node_by_id(ui(), "et_note_body") is not None
def and_reach_note_options(): """SELECTION mode -> tap `fab_selection` 'More options' -> the Note options sheet. Counts one surface. Returns True when 'Note options' title is showing.""" fs = node_by_id(ui(), "fab_selection") if fs is None or not tap_node(fs): return False settle("tap") and_enter("note_options") return find_node_ci(ui(), "Note options") is not None
def and_reach_reading_mode(): """Note options sheet -> tap `tv_open_in` 'Reading Mode' -> Reading Mode. Dismisses the first-entry immersive cling ('Got it'). Counts one surface. Returns True when the reading-mode paging indicator is present.""" rm = node_by_id(ui(), "tv_open_in") or find_node_ci(ui(), "Reading Mode") if rm is None or not tap_node(rm): return False settle("tap") and_enter("reading_mode") got = find_node_ci(ui(), "Got it") if got is not None: tap_node(got) settle("tap") return node_by_id(ui(), "tv_notes_count") is not None
# ── Readers ──────────────────────────────────────────────────────────────────
def read_word_count(): """Live word-count content-desc from a FRESH dump. An extra settle absorbs the one-frame lag between the last keystroke and the header updating.""" settle("tap") n = node_by_id(ui(), "tv_word_count") return (n.get("content-desc") or "").strip() if n else ""
def read_folder_notes_count(): """FOLDER note-list count, rendered as content-desc ('N Notes'/'1 Note').""" n = node_by_id(ui(), "tv_folder_notes_count") return (n.get("content-desc") or "").strip() if n else ""
def read_folders_count(): """HOME folders count, rendered as content-desc ('N Folders'/'1 Folder').""" n = node_by_id(ui(), "tv_folders_count") return (n.get("content-desc") or "").strip() if n else ""
def card_count(nodes, title): """HOME library card whose tv_title == `title` -> its tv_notes_count VALUE.
OBSERVED on the HOME sheet, the count lives in the node's `text` (NOT its content-desc, unlike the FOLDER screen), and the cards form a 2-column grid, so the matching tv_notes_count is the one CLOSEST in BOTH x and y to the title (the count sits just above its title inside the same card).""" titles = [n for n in nodes if n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_title" and n.get("text") == title] if not titles: return "" tx, ty = titles[0].get("_center", (0, 0)) best, bestd = None, 10 ** 18 for n in nodes: if n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_notes_count": cx, cy = n.get("_center", (0, 0)) d = (cx - tx) ** 2 + (cy - ty) ** 2 if d < bestd: best, bestd = n, d if best is None: return "" # Count is in `text` on this sheet; fall back to content-desc for robustness. return (best.get("text") or best.get("content-desc") or "").strip()
# ── Editor / note authoring built on the navigation helpers ────────────────────
def open_new_editor(): """fresh DB -> HOME -> 'General' folder -> Create note -> return the editor's body EditText node (or None). depth after this == 2 (folder + editor).""" fresh_home() if not and_enter_folder("General"): return None if not and_enter_editor(): return None return node_by_id(ui(), "et_note_body")
def word_count_for(body_text, title_text=""): """The star helper. Fresh note in 'General', optionally set the title, type the body, and return the live tv_word_count content-desc. Reaching the editor is a real depth-2 navigation (and_enter_folder + and_enter_editor), so callers may declare depth=2 honestly. Returns (ok_reached, word_count_string).""" body = open_new_editor() if body is None: return False, "" if title_text: tit = node_by_id(ui(), "et_note_title") if tit is not None: type_text(tit, title_text) body = node_by_id(ui(), "et_note_body") if body is None: return False, "" if body_text: type_text(body, body_text) return True, read_word_count()
def create_note_general(title, body="x"): """Create a note in 'General' (auto-saved on Back). Leaves the app on HOME. Returns True on success.""" goto_home() if not and_enter_folder("General"): return False if not and_enter_editor(): return False t = node_by_id(ui(), "et_note_title") if t is None or not type_text(t, title): return False if body: b = node_by_id(ui(), "et_note_body") if b is not None: type_text(b, body) hide_keyboard() back() # NEW note Back -> HOME sheet settle("tap") goto_home() return True
def create_folder(name): """HOME -> fab 'Create folder' -> type name -> tap `btn_create` (present and tappable WITH the keyboard up; BACK dismisses this full-screen dialog). Leaves the app on HOME. Returns True when the folder appears.""" goto_home() fab = find_node(ui(), content_desc="Create folder") if fab is None or not tap_node(fab): return False settle("tap") and_enter("new_folder_dialog") et = node_by_id(ui(), "et") if et is None or not type_text(et, name): return False btn = node_by_id(ui(), "btn_create") or find_node_ci(ui(), "Create folder") if btn is None or not tap_node(btn): return False settle("tap") goto_home() return find_node(ui(), text=name) is not None
# ══════════════════════════════════════════════════════════════════════════════# WORD COUNT — the core transform (input -> output). depth=2 (home->folder->editor)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("computation_wc_empty",))def test_wc_empty(): """A brand-new note with an empty body reads '0 Words' (the ABSENT baseline — the count is 0 before any word exists).""" ok, got = word_count_for("") passed = ok and got == "0 Words" record("computation_wc_empty", passed, "" if passed else ( "feature_missing: could not reach the note editor / word count" if not ok else f"behavior_wrong: empty body shows {got!r}, expected '0 Words'"), depth=2, jump_kind="value", expect="0 Words")
@and_test(expects=("computation_wc_one",))def test_wc_one(): """One word -> the SINGULAR form '1 Word' (VERIFIED on the original: singular, not '1 Words').""" ok, got = word_count_for("hello") passed = ok and got == "1 Word" record("computation_wc_one", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: 'hello' shows {got!r}, expected '1 Word'"), depth=2, jump_kind="value", expect="1 Word")
@and_test(expects=("computation_wc_two",))def test_wc_two(): """Two words -> '2 Words'.""" ok, got = word_count_for("hello world") passed = ok and got == "2 Words" record("computation_wc_two", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: 'hello world' shows {got!r}, expected '2 Words'"), depth=2, jump_kind="value", expect="2 Words")
@and_test(expects=("computation_wc_three",))def test_wc_three(): """Three words -> '3 Words'.""" ok, got = word_count_for("hello world foo") passed = ok and got == "3 Words" record("computation_wc_three", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: 'hello world foo' shows {got!r}, expected '3 Words'"), depth=2, jump_kind="value", expect="3 Words")
@and_test(expects=("computation_wc_four", "computation_wc_four_vlm"))def test_wc_four(): """Four words -> '4 Words' (the canonical VERIFIED case). Also the VLM anchor: confirm the computed '4 Words' is actually RENDERED in the editor header near the folder title, not merely present in the accessibility tree.""" ok, got = word_count_for("hello world foo bar") passed = ok and got == "4 Words" record("computation_wc_four", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: 'hello world foo bar' shows {got!r}, expected '4 Words'"), depth=2, jump_kind="value", expect="4 Words") # VLM #1 — the rendered word-count text in the editor header. depth matches. vlm_assert("computation_wc_four", "In this note editor screen, is the text '4 Words' displayed in the " "header row near the top (next to the folder title)?", RESULTS_DIR, depth=2, jump_kind="value", tag="content")
@and_test(expects=("computation_wc_five",))def test_wc_five(): """Five distinct words -> '5 Words'.""" ok, got = word_count_for("one two three four five") passed = ok and got == "5 Words" record("computation_wc_five", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: five words show {got!r}, expected '5 Words'"), depth=2, jump_kind="value", expect="5 Words")
@and_test(expects=("computation_wc_seven_single_chars",))def test_wc_seven_single_chars(): """Seven single-character tokens 'a b c d e f g' -> '7 Words' (each isolated char is its own token).""" ok, got = word_count_for("a b c d e f g") passed = ok and got == "7 Words" record("computation_wc_seven_single_chars", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: 'a b c d e f g' shows {got!r}, expected '7 Words'"), depth=2, jump_kind="value", expect="7 Words")
@and_test(expects=("computation_wc_multi_space",))def test_wc_multi_space(): """Runs of spaces collapse: 'hello world' -> '2 Words' (OBSERVED — the splitter ignores empty tokens between multiple spaces).""" ok, got = word_count_for("hello world") passed = ok and got == "2 Words" record("computation_wc_multi_space", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: 'hello world' shows {got!r}, expected '2 Words'"), depth=2, jump_kind="value", expect="2 Words")
@and_test(expects=("computation_wc_lead_trail_space",))def test_wc_lead_trail_space(): """Leading/trailing spaces are trimmed: ' hello world ' -> '2 Words' (OBSERVED — boundary whitespace produces no phantom tokens).""" ok, got = word_count_for(" hello world ") passed = ok and got == "2 Words" record("computation_wc_lead_trail_space", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: ' hello world ' shows {got!r}, expected '2 Words'"), depth=2, jump_kind="value", expect="2 Words")
@and_test(expects=("computation_wc_punctuation",))def test_wc_punctuation(): """Punctuation attached to a token adds no token: 'hello, world!' -> '2 Words' (OBSERVED — the split is on whitespace only, commas/bangs ride along).""" ok, got = word_count_for("hello, world!") passed = ok and got == "2 Words" record("computation_wc_punctuation", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: 'hello, world!' shows {got!r}, expected '2 Words'"), depth=2, jump_kind="value", expect="2 Words")
@and_test(expects=("computation_wc_title_excluded_empty",))def test_wc_title_excluded_empty(): """A long multi-word TITLE with an empty body still reads '0 Words' — the title does NOT contribute to the count (VERIFIED).""" ok, got = word_count_for("", title_text="ThisIsALongTitleWithManyWords") passed = ok and got == "0 Words" record("computation_wc_title_excluded_empty", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: long title + empty body shows {got!r}, " f"expected '0 Words' (title must not count)"), depth=2, jump_kind="value", expect="0 Words")
@and_test(expects=("computation_wc_title_excluded_body",))def test_wc_title_excluded_body(): """The count reflects the BODY regardless of the title: a long title plus body 'just one' reads '2 Words', not more (VERIFIED — body-only count).""" ok, got = word_count_for("just one", title_text="ThisIsALongTitleWithManyWords") passed = ok and got == "2 Words" record("computation_wc_title_excluded_body", passed, "" if passed else ( "feature_missing: could not reach the word count" if not ok else f"behavior_wrong: title + body 'just one' shows {got!r}, " f"expected '2 Words' (body only)"), depth=2, jump_kind="value", expect="2 Words")
# ══════════════════════════════════════════════════════════════════════════════# COUNT ARITHMETIC — record totals rendered as strings (input=create, output=count)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("computation_folder_count_one",))def test_folder_count_one(): """Creating the FIRST note in a cleared 'General' turns the folder count '0 Notes' -> '1 Note' (SINGULAR). Positive+negative: 0 before, 1 after.""" fresh_home() if not and_enter_folder("General"): record("computation_folder_count_one", False, "setup_failed: could not open the 'General' folder", depth=2, jump_kind="value", expect="1 Note") return before = read_folder_notes_count() goto_home() made = create_note_general("CountOne") ok = False got = "" if made and and_enter_folder("General"): got = read_folder_notes_count() ok = before == "0 Notes" and got == "1 Note" record("computation_folder_count_one", ok, "" if ok else ( "feature_missing: could not create a note / read the folder count" if not made else f"behavior_wrong: count was {before!r} -> {got!r}, " f"expected '0 Notes' -> '1 Note'"), depth=2, jump_kind="value", expect="1 Note")
@and_test(expects=("computation_folder_count_two",))def test_folder_count_two(): """A second create makes the folder count '2 Notes' (plural).""" fresh_home() m1 = create_note_general("CountA") m2 = create_note_general("CountB") got = "" ok = False if m1 and m2 and and_enter_folder("General"): got = read_folder_notes_count() ok = got == "2 Notes" record("computation_folder_count_two", ok, "" if ok else ( "feature_missing: could not create two notes / read the folder count" if not (m1 and m2) else f"behavior_wrong: count shows {got!r}, expected '2 Notes'"), depth=2, jump_kind="value", expect="2 Notes")
@and_test(expects=("computation_folder_count_three",))def test_folder_count_three(): """Three creates -> '3 Notes' (the arithmetic keeps accumulating).""" fresh_home() made = all(create_note_general(t) for t in ("C1", "C2", "C3")) got = "" ok = False if made and and_enter_folder("General"): got = read_folder_notes_count() ok = got == "3 Notes" record("computation_folder_count_three", ok, "" if ok else ( "feature_missing: could not create three notes / read the folder count" if not made else f"behavior_wrong: count shows {got!r}, expected '3 Notes'"), depth=2, jump_kind="value", expect="3 Notes")
@and_test(expects=("computation_home_cards_count", "computation_home_cards_count_vlm"))def test_home_cards_count(): """After creating 2 notes, the HOME 'All' AND 'Recent' library cards both show '2' — the note total propagates to the derived library counters (the count is rendered in the card's text). VLM: confirm the number is RENDERED on 'All'.""" fresh_home() m1 = create_note_general("CardA") m2 = create_note_general("CardB") goto_home() nodes = ui() all_c = card_count(nodes, "All") rec_c = card_count(nodes, "Recent") ok = (m1 and m2) and all_c == "2" and rec_c == "2" record("computation_home_cards_count", ok, "" if ok else ( "feature_missing: could not create notes / read the library cards" if not (m1 and m2) else f"behavior_wrong: All={all_c!r} Recent={rec_c!r}, " f"expected both '2'"), depth=1, jump_kind="value", expect="All=2, Recent=2") # VLM #2 — the count number rendered on the colored 'All' card. vlm_assert("computation_home_cards_count", "On this home screen, does the 'All' library card show the number 2 " "as its note count?", RESULTS_DIR, depth=1, jump_kind="value", tag="content")
@and_test(expects=("computation_folders_count_one",))def test_folders_count_one(): """Creating one user folder turns the HOME folders count '0 Folders' -> '1 Folder' (SINGULAR; the default 'General' is excluded from this count).""" fresh_home() before = read_folders_count() made = create_folder("Work") got = read_folders_count() ok = made and before == "0 Folders" and got == "1 Folder" record("computation_folders_count_one", ok, "" if ok else ( "feature_missing: could not create a folder / read the folders count" if not made else f"behavior_wrong: folders count was {before!r} -> {got!r}, " f"expected '0 Folders' -> '1 Folder'"), depth=1, jump_kind="value", expect="1 Folder")
@and_test(expects=("computation_folders_count_two",))def test_folders_count_two(): """A second user folder -> '2 Folders' (plural).""" fresh_home() m1 = create_folder("Work") m2 = create_folder("Home") got = read_folders_count() ok = m1 and m2 and got == "2 Folders" record("computation_folders_count_two", ok, "" if ok else ( "feature_missing: could not create two folders / read the count" if not (m1 and m2) else f"behavior_wrong: folders count shows {got!r}, " f"expected '2 Folders'"), depth=1, jump_kind="value", expect="2 Folders")
@and_test(expects=("computation_reading_paging", "computation_reading_paging_vlm"))def test_reading_paging(): """With exactly ONE note, Reading Mode's paging indicator reads '1 / 1 Note' (position / total arithmetic). depth=3: home->folder->note-options->reading. VLM: confirm the '1 / 1 Note' indicator is rendered in the reading-mode chrome.""" fresh_home() made = create_note_general("OnlyNote", "solo body") got = "" reached = False if made and and_enter_folder("General"): note = node_by_id(ui(), "tv_note_title") if note is not None and long_press(note): settle("tap") if and_reach_note_options() and and_reach_reading_mode(): reached = True pn = node_by_id(ui(), "tv_notes_count") got = (pn.get("content-desc") or "").strip() if pn else "" ok = reached and got == "1 / 1 Note" record("computation_reading_paging", ok, "" if ok else ( "feature_missing: could not reach Reading Mode / its paging indicator" if not reached else f"behavior_wrong: paging shows {got!r}, expected '1 / 1 Note'"), depth=3, jump_kind="value", expect="1 / 1 Note") # VLM #3 — the rendered paging indicator in the reading-mode header. vlm_assert("computation_reading_paging", "In this full-screen reading view, is the paging indicator " "'1 / 1 Note' displayed (showing you are on note 1 of 1)?", RESULTS_DIR, depth=3, jump_kind="value", tag="content")
# ══════════════════════════════════════════════════════════════════════════════TESTS = [ test_wc_empty, test_wc_one, test_wc_two, test_wc_three, test_wc_four, test_wc_five, test_wc_seven_single_chars, test_wc_multi_space, test_wc_lead_trail_space, test_wc_punctuation, test_wc_title_excluded_empty, test_wc_title_excluded_body, test_folder_count_one, test_folder_count_two, test_folder_count_three, test_home_cards_count, test_folders_count_one, test_folders_count_two, test_reading_paging,]
if __name__ == "__main__": run_suite(TESTS, "computation")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722#!/usr/bin/env python3"""INTERACTION module — Noto (minimal note-taking app).
Lane ownership: EFFECT-BY-CONSEQUENCE on user DATA. This lane creates/duplicates/edits/moves records, drives 3+ step sequences, asserts multi-record integrity, andis the SOLE owner of long-press / context menus and of DATA persistence acrossprocess death. Every test drives the app to the surface via the real user path,performs the action, then reads the consequence back out of a FRESH ui() andasserts it equals what was observed on the original.
What this lane does NOT assert (ceded to other lanes): the exact word-count number(computation), the checked/selected bit or SETTINGS persistence (states), purescreen reachability (navigation), the exact placeholder/label wording (text),view-tree shape (structure). Here we assert the DATA changed — a record appeared,duplicated, moved, or survived a restart.
VERIFIED LIVE before authoring (the risky ones): * Folder create: type into `et`, then tap `btn_create` WITH the keyboard up — this dialog is a full-screen ScrollView and BACK/hide_keyboard dismisses it. * Note create + auto-save: type title/body -> hide_keyboard() -> back() lands on the HOME sheet (not the folder); reopen the folder to see the row. * Note-body edit APPENDS at the cursor (input text does not clear the field), so to reach 'alpha beta' we start from 'alpha' and type ' beta'. * Pin: long-press -> `bab_selection` `pin` button -> a "Pinned" section header (tv_title text="Pinned") APPEARS and the note moves under it. (Deterministic; the note-options label does NOT reliably flip, so we assert the section.) * Selection highlight: the selected row is marked by a solid dark filled circular CHECK badge (NOT a tinted row background — the background stays the same), so the colour VLM asks about the badge fill, not the row. * Move: long-press -> `fab_selection` -> `tv_move_note` -> "Move to" picker -> tap the destination row (single tap commits) -> note LEAVES source, ARRIVES in destination. * Duplicate -> 2 identical rows, count +1. Multi-select -> "N Notes • K Selected".
Invoke: python3 test_android_interaction.py <PACKAGE> <RESULTS_DIR>"""import osimport sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,E402
# ══════════════════════════════════════════════════════════════════════════════# Local setup helpers# ══════════════════════════════════════════════════════════════════════════════
def dismiss_prompts(): """Dismiss the first-run system notification-permission dialog (and any stray prompt) sitting in front of the already-loaded Noto home. Both the ASCII "Don't allow" and the curly-apostrophe "Don't allow" (U+2019) are matched. The prompt reliably reappears after a full pm clear, but it was observed to return on a plain relaunch too, so we call this defensively after every launch.""" for _ in range(3): nodes = ui() b = (find_node_ci(nodes, "Don't allow") or find_node_ci(nodes, "Don’t allow") or find_node_ci(nodes, "Allow")) if b and is_safe(b): tap_node(b) settle("tap") continue break
def fresh_home(): """Virgin database (wipe) + HOME sheet. Guarantees the default 'General' folder exists and counts start at zero, so created records are deterministic.""" clear_data() launch_app() wait_for_foreground() dismiss_prompts() return ui()
def relaunched_home(): """Force-stop + relaunch WITHOUT wiping (the persistence probe), then dismiss any prompt and drive back to the HOME sheet.""" force_stop_and_relaunch() wait_for_foreground() dismiss_prompts() return goto_home()
def goto_home(): """Back out to the HOME bottom sheet from wherever we are (the sheet is the one surface that shows the 'Create folder' fab).""" for _ in range(4): if find_node(ui(), content_desc="Create folder"): break back() settle("tap") return ui()
# ── Depth-backing navigation helpers (named and_enter_*/and_reach_* so the audit# can attribute the declared depth to a real navigation call). ────────────────
def and_enter_folder(name): """HOME sheet -> tap a folder row -> its note-list surface. Counts one surface. Returns True when the folder title is showing.""" n = find_node(ui(), text=name) if n is None or not tap_node(n): return False settle("tap") and_enter("folder:" + name) tit = node_by_id(ui(), "tv_folder_title") return tit is not None and tit.get("text") == name
def and_enter_editor(): """FOLDER note-list -> tap fab 'Create note' -> the note editor. Counts one surface. Returns True when et_note_title is present.""" fab = find_node(ui(), content_desc="Create note") if fab is None or not tap_node(fab): return False settle("tap") and_enter("editor") return node_by_id(ui(), "et_note_title") is not None
def and_reach_note_options(): """SELECTION mode -> tap `fab_selection` 'More options' -> the Note options sheet. Counts one surface. Returns True when 'Note options' title is showing.""" fs = node_by_id(ui(), "fab_selection") if fs is None or not tap_node(fs): return False settle("tap") and_enter("note_options") return find_node_ci(ui(), "Note options") is not None
def and_reach_move_picker(): """Note options sheet -> tap `tv_move_note` 'Move to...' -> the 'Move to' folder picker. Counts one surface. Returns True when the picker title shows.""" mv = node_by_id(ui(), "tv_move_note") if mv is None or not tap_node(mv): return False settle("tap") and_enter("move_picker") return find_node_ci(ui(), "Move to") is not None
# ── Data-authoring helpers built on the navigation helpers. They END on the HOME# sheet, so callers reopen the folder to read the consequence back. ────────────
def create_note(folder, title, body=""): """Open `folder`, create a note with `title`/`body`, auto-save via hide_keyboard()+back() (which lands on the HOME sheet). Returns True on success. Leaves the app on the HOME sheet.""" if not and_enter_folder(folder): return False if not and_enter_editor(): return False t = node_by_id(ui(), "et_note_title") if t is None or not type_text(t, title): return False if body: b = node_by_id(ui(), "et_note_body") if b is not None: type_text(b, body) hide_keyboard() back() # NEW note Back -> HOME sheet settle("tap") goto_home() return True
def create_folder(name): """HOME sheet -> fab 'Create folder' -> type name into `et` -> tap `btn_create` (present and tappable WITH the keyboard up; do NOT hide the keyboard, BACK dismisses this full-screen dialog). Returns True when the folder appears on HOME. Leaves the app on the HOME sheet.""" fab = find_node(ui(), content_desc="Create folder") if fab is None or not tap_node(fab): return False settle("tap") and_enter("new_folder_dialog") et = node_by_id(ui(), "et") if et is None or not type_text(et, name): return False btn = node_by_id(ui(), "btn_create") or find_node_ci(ui(), "Create folder") if btn is None or not tap_node(btn): return False settle("tap") goto_home() return find_node(ui(), text=name) is not None
def count_note_rows(nodes, title): """How many visible note rows have this exact title.""" return sum(1 for n in nodes if n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_note_title" and n.get("text") == title)
def first_body_text(nodes): """The text of the first note-body row, or "".""" for n in nodes: if n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_note_body": return n.get("text", "") return ""
def open_selection(folder, title): """Open `folder` and long-press the note `title` to enter selection mode. Returns the selection subtitle content-desc (or None).""" if not and_enter_folder(folder): return None note = find_node(ui(), text=title) if note is None or not long_press(note): return None settle("tap") sub = node_by_id(ui(), "tv_folder_notes_count") return sub.get("content-desc") if sub else None
# ══════════════════════════════════════════════════════════════════════════════# CRUD# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("interaction_create_note",))def test_create_note(): """Create a note in 'General' and read its title back from a fresh folder view.""" fresh_home() absent = find_node(ui(), text="Groceries") is None made = create_note("General", "Groceries", "milk eggs") if not made: record("interaction_create_note", False, "feature_missing: could not reach the note editor / create a note", depth=2, jump_kind="value", expect="note 'Groceries' in list") return and_enter_folder("General") row = find_node(ui(), text="Groceries") ok = absent and row is not None record("interaction_create_note", ok, "" if ok else "behavior_wrong: created note not present in the folder list", depth=2, jump_kind="value", expect="note 'Groceries' in list")
@and_test(expects=("interaction_second_create_two_rows",))def test_second_create_yields_two_rows(): """Two distinct creates in a cleared folder -> BOTH rows present at once (a recreation that keeps only the last row fails this).""" fresh_home() made1 = create_note("General", "FirstNote", "b1") made2 = create_note("General", "SecondNote", "b2") if not (made1 and made2): record("interaction_second_create_two_rows", False, "feature_missing: could not create two notes", depth=2, jump_kind="value", expect="both FirstNote & SecondNote present") return and_enter_folder("General") nodes = ui() ok = (find_node(nodes, text="FirstNote") is not None and find_node(nodes, text="SecondNote") is not None) record("interaction_second_create_two_rows", ok, "" if ok else "behavior_wrong: both notes not present simultaneously", depth=2, jump_kind="value", expect="both FirstNote & SecondNote present")
@and_test(expects=("interaction_multi_record_integrity",))def test_multi_record_integrity(): """Create 3 uniquely-named notes -> all 3 titles present at the same time. (Row presence is dump-readable, so this stays a rule assertion — no VLM.)""" fresh_home() made = (create_note("General", "Note A", "aa") and create_note("General", "Note B", "bb") and create_note("General", "Note C", "cc")) if not made: record("interaction_multi_record_integrity", False, "feature_missing: could not create three notes", depth=2, jump_kind="value", expect="3 notes A/B/C present") return and_enter_folder("General") nodes = ui() ok = all(find_node(nodes, text=t) is not None for t in ("Note A", "Note B", "Note C")) record("interaction_multi_record_integrity", ok, "" if ok else "behavior_wrong: not all of A/B/C present together", depth=2, jump_kind="value", expect="3 notes A/B/C present")
@and_test(expects=("interaction_duplicate_note", "interaction_duplicate_note_vlm"))def test_duplicate_note(): """Long-press a note -> More options -> Duplicate -> two identical rows.""" fresh_home() if not create_note("General", "DupMe", "dupbody"): record("interaction_duplicate_note", False, "feature_missing: could not create the note to duplicate", depth=2, jump_kind="value", expect="two 'DupMe' rows after Duplicate") record("interaction_duplicate_note_vlm", False, "setup_failed: could not create the note to duplicate", depth=2, jump_kind="none", tag="position") return if open_selection("General", "DupMe") is None: record("interaction_duplicate_note", False, "setup_failed: could not enter selection mode via long-press", depth=2, jump_kind="value", expect="two 'DupMe' rows after Duplicate") record("interaction_duplicate_note_vlm", False, "setup_failed: could not enter selection mode", depth=2, jump_kind="none", tag="position") return before_n = count_note_rows(ui(), "DupMe") reached = and_reach_note_options() dup = node_by_id(ui(), "tv_duplicate_note") if not reached or dup is None or not tap_node(dup): record("interaction_duplicate_note", False, "feature_missing: Duplicate action not available in note options", depth=2, jump_kind="value", expect="two 'DupMe' rows after Duplicate") record("interaction_duplicate_note_vlm", False, "setup_failed: Duplicate action not available", depth=2, jump_kind="none", tag="position") return settle("tap") after_n = count_note_rows(ui(), "DupMe") ok = before_n == 1 and after_n == 2 record("interaction_duplicate_note", ok, "" if ok else f"behavior_wrong: expected 1->2 identical rows, got " f"{before_n}->{after_n}", depth=2, jump_kind="value", expect="two 'DupMe' rows after Duplicate") # Fine-grained: the duplicate sits DIRECTLY adjacent to the original. vlm_assert("interaction_duplicate_note", "Are there two note cards with the same title text positioned " "immediately one above the other (adjacent) in the note list?", depth=2, jump_kind="value", tag="position")
@and_test(expects=("interaction_edit_note_body_persists",))def test_edit_note_body_persists(): """Create a note body 'alpha', reopen it, APPEND ' beta' (input text appends at the cursor), save, reopen -> body reads 'alpha beta'.""" fresh_home() if not create_note("General", "EditMe", "alpha"): record("interaction_edit_note_body_persists", False, "feature_missing: could not create the note to edit", depth=2, jump_kind="value", expect="note body 'alpha beta'") return if not and_enter_folder("General"): record("interaction_edit_note_body_persists", False, "setup_failed: could not reopen the folder", depth=2, jump_kind="value", expect="note body 'alpha beta'") return row = find_node(ui(), text="EditMe") if row is None or not tap_node(row): record("interaction_edit_note_body_persists", False, "setup_failed: could not open the existing note", depth=2, jump_kind="value", expect="note body 'alpha beta'") return settle("tap") and_enter("editor") body = node_by_id(ui(), "et_note_body") # APPEND to the existing 'alpha': typing lands at the cursor after the text. if body is None or not type_text(body, " beta"): record("interaction_edit_note_body_persists", False, "setup_failed: could not type into the note body", depth=2, jump_kind="value", expect="note body 'alpha beta'") return hide_keyboard() back() settle("tap") goto_home() and_enter_folder("General") got = first_body_text(ui()) ok = got == "alpha beta" record("interaction_edit_note_body_persists", ok, "" if ok else f"behavior_wrong: edited body not persisted (got {got!r})", depth=2, jump_kind="value", expect="note body 'alpha beta'")
@and_test(expects=("interaction_create_folder",))def test_create_folder(): """Create a folder 'Projects' -> it appears on the HOME sheet.""" fresh_home() absent = find_node(ui(), text="Projects") is None made = create_folder("Projects") ok = absent and made record("interaction_create_folder", ok, "" if ok else "behavior_wrong: folder 'Projects' not created on HOME", depth=1, jump_kind="value", expect="folder 'Projects' on HOME")
@and_test(expects=("interaction_create_two_folders",))def test_create_two_folders(): """Create two folders -> BOTH 'Projects' and 'Ideas' present on HOME at once.""" fresh_home() made1 = create_folder("Projects") made2 = create_folder("Ideas") nodes = ui() ok = (made1 and made2 and find_node(nodes, text="Projects") is not None and find_node(nodes, text="Ideas") is not None) record("interaction_create_two_folders", ok, "" if ok else "behavior_wrong: both folders not present on HOME", depth=1, jump_kind="value", expect="both 'Projects' & 'Ideas' on HOME")
# ══════════════════════════════════════════════════════════════════════════════# DATA persistence across process death (this lane owns these)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("interaction_note_survives_process_death",))def test_note_survives_process_death(): """Create note 'Persist1' -> force_stop_and_relaunch() -> reopen 'General' -> the note is still there. An in-memory-only recreation fails this.""" fresh_home() if not create_note("General", "Persist1", "keepme"): record("interaction_note_survives_process_death", False, "feature_missing: could not create the note to persist", depth=1, jump_kind="value", expect="'Persist1' survives restart") return relaunched_home() and_enter_folder("General") ok = find_node(ui(), text="Persist1") is not None record("interaction_note_survives_process_death", ok, "" if ok else "behavior_wrong: note did not survive process death", depth=1, jump_kind="value", expect="'Persist1' survives restart")
@and_test(expects=("interaction_folder_survives_process_death",))def test_folder_survives_process_death(): """Create folder 'KeepMe' -> force_stop_and_relaunch() -> still on HOME.""" fresh_home() if not create_folder("KeepMe"): record("interaction_folder_survives_process_death", False, "feature_missing: could not create the folder to persist", depth=0, jump_kind="value", expect="'KeepMe' folder survives restart") return relaunched_home() ok = find_node(ui(), text="KeepMe") is not None record("interaction_folder_survives_process_death", ok, "" if ok else "behavior_wrong: folder did not survive process death", depth=0, jump_kind="value", expect="'KeepMe' folder survives restart")
@and_test(expects=("interaction_edited_body_survives_process_death",))def test_edited_body_survives_process_death(): """Create a note with a distinctive body marker, save, then force_stop_and_relaunch() and reopen the folder -> body still reads the marker. The strongest probe: an in-memory-only recreation cannot pass it.""" fresh_home() if not create_note("General", "PersistBody", "saved body xyz"): record("interaction_edited_body_survives_process_death", False, "feature_missing: could not create the note", depth=1, jump_kind="value", expect="body 'saved body xyz' after restart") return relaunched_home() if not and_enter_folder("General"): record("interaction_edited_body_survives_process_death", False, "setup_failed: could not reopen the folder after restart", depth=1, jump_kind="value", expect="body 'saved body xyz' after restart") return got = first_body_text(ui()) ok = got == "saved body xyz" record("interaction_edited_body_survives_process_death", ok, "" if ok else f"behavior_wrong: note body not persisted across restart " f"(got {got!r})", depth=1, jump_kind="value", expect="body 'saved body xyz' after restart")
# ══════════════════════════════════════════════════════════════════════════════# Long-press / selection sequences (sole owner)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("interaction_multi_select_count", "interaction_selection_check_dark_vlm", "interaction_selection_check_badge_vlm", "interaction_selection_action_bar_vlm"))def test_multi_select_count(): """Long-press one note (1 Selected) then tap a second note -> subtitle '2 Notes • 2 Selected'. Multi-select COUNT sequence via long-press.""" fresh_home() made = (create_note("General", "SelA", "sa") and create_note("General", "SelB", "sb")) if not made: record("interaction_multi_select_count", False, "feature_missing: could not create two notes", depth=1, jump_kind="transition", expect="2 selected") for nm, tg in (("interaction_selection_check_dark_vlm", "color"), ("interaction_selection_check_badge_vlm", "shape"), ("interaction_selection_action_bar_vlm", "layout")): record(nm, False, "setup_failed: could not create two notes", depth=1, jump_kind="none", tag=tg) return sub1 = open_selection("General", "SelA") one_ok = sub1 is not None and "1 Selected" in sub1 # VLM (single-selection visual state): the selection is marked by a solid dark # filled CHECK badge on the selected row (the row background does NOT tint), an # action bar renders along the bottom. vlm_assert("interaction_selection_check_dark", "The selected note row shows a small circular check/tick badge in " "its corner: is that badge a SOLID DARK/BLACK filled circle (not a " "hollow outline)?", depth=1, jump_kind="transition", tag="color") vlm_assert("interaction_selection_check_badge", "Does exactly one note row show a filled circular check/tick badge " "in its corner marking it as selected, while the other row has none?", depth=1, jump_kind="transition", tag="shape") vlm_assert("interaction_selection_action_bar", "Is a bottom action bar with several selection action icons " "(reminder, pin, share, archive and a more-options button) rendered " "along the bottom of the screen?", depth=1, jump_kind="transition", tag="layout") # add the second note to the selection second = find_node(ui(), text="SelB") if second is not None: tap_node(second) settle("tap") sub2n = node_by_id(ui(), "tv_folder_notes_count") sub2 = sub2n.get("content-desc") if sub2n else "" two_ok = "2 Selected" in (sub2 or "") ok = one_ok and two_ok record("interaction_multi_select_count", ok, "" if ok else f"behavior_wrong: multi-select count wrong " f"(1st={sub1!r}, 2nd={sub2!r})", depth=1, jump_kind="transition", expect="2 selected")
@and_test(expects=("interaction_pin_note", "interaction_pinned_section_vlm"))def test_pin_note(): """Create two notes, long-press one, tap the selection-bar `pin` -> a 'Pinned' section header APPEARS and the pinned note sits above the 'Notes' header. (Verified live: the note-options label does not reliably toggle, but the 'Pinned' section is a deterministic, dump-readable DATA consequence.)""" fresh_home() made = (create_note("General", "PinTop", "pt") and create_note("General", "PlainNote", "pn")) if not made: record("interaction_pin_note", False, "feature_missing: could not create notes to pin", depth=1, jump_kind="transition", expect="'Pinned' section appears") record("interaction_pinned_section_vlm", False, "setup_failed: could not create notes to pin", depth=1, jump_kind="none", tag="position") return if open_selection("General", "PinTop") is None: record("interaction_pin_note", False, "setup_failed: could not enter selection mode via long-press", depth=1, jump_kind="transition", expect="'Pinned' section appears") record("interaction_pinned_section_vlm", False, "setup_failed: could not enter selection mode", depth=1, jump_kind="none", tag="position") return before_pinned = find_node(ui(), text="Pinned") is not None # in folder: false pinbtn = node_by_id(ui(), "pin") if pinbtn is None or (pinbtn.get("content-desc") or "").lower() != "pin" \ or not tap_node(pinbtn): record("interaction_pin_note", False, "feature_missing: Pin action not available in the selection bar", depth=1, jump_kind="transition", expect="'Pinned' section appears") record("interaction_pinned_section_vlm", False, "setup_failed: Pin action not available", depth=1, jump_kind="none", tag="position") return settle("tap") nodes = ui() pinned_hdr = find_node(nodes, text="Pinned") after_pinned = pinned_hdr is not None # the pinned note must sit above the plain note (pinned section on top) order_ok = True pin_row = find_node(nodes, text="PinTop") plain_row = find_node(nodes, text="PlainNote") if pinned_hdr and pin_row and plain_row and "_bounds" in pin_row \ and "_bounds" in plain_row: order_ok = pin_row["_bounds"][1] < plain_row["_bounds"][1] ok = (not before_pinned) and after_pinned and order_ok record("interaction_pin_note", ok, "" if ok else "behavior_wrong: pinning did not add a 'Pinned' section " "with the note on top", depth=1, jump_kind="transition", expect="'Pinned' section appears") vlm_assert("interaction_pinned_section", "Is there a 'Pinned' section heading near the top of the note list " "with a note shown directly beneath it, positioned above the rest of " "the notes?", depth=1, jump_kind="transition", tag="position")
@and_test(expects=("interaction_note_options_grid_vlm",))def test_note_options_grid_vlm(): """Reach the Note-options sheet and VLM its grid of labeled action tiles.""" fresh_home() if not create_note("General", "OptNote", "on"): record("interaction_note_options_grid_vlm", False, "setup_failed: could not create the note", depth=2, jump_kind="none", tag="layout") return if open_selection("General", "OptNote") is None or not and_reach_note_options(): record("interaction_note_options_grid_vlm", False, "setup_failed: could not reach the Note options sheet", depth=2, jump_kind="none", tag="layout") return vlm_assert("interaction_note_options_grid", "Does this bottom sheet titled 'Note options' show a grid/list of " "several labeled action tiles such as Add reminder, Reading Mode, " "Pin, Share, Archive, Duplicate, Copy, Move to and Delete?", depth=2, jump_kind="value", tag="layout")
@and_test(expects=("interaction_move_note_between_folders",))def test_move_note_between_folders(): """Create a 2nd folder, create a note in 'General', then long-press -> More options -> Move to... -> pick the 2nd folder. Assert the note LEFT 'General' AND ARRIVED in the destination (multi-record integrity across folders).""" fresh_home() made_folder = create_folder("Dest") made_note = create_note("General", "MoveMe", "mv") if not (made_folder and made_note): record("interaction_move_note_between_folders", False, "feature_missing: could not create the folder or note for a move", depth=2, jump_kind="value", expect="MoveMe left General, in Dest") return if open_selection("General", "MoveMe") is None or not and_reach_note_options(): record("interaction_move_note_between_folders", False, "setup_failed: could not reach note options for the move", depth=2, jump_kind="value", expect="MoveMe left General, in Dest") return if not and_reach_move_picker(): record("interaction_move_note_between_folders", False, "feature_missing: 'Move to' picker did not open", depth=2, jump_kind="value", expect="MoveMe left General, in Dest") return dest = find_node(ui(), text="Dest") if dest is None or not tap_node(dest): record("interaction_move_note_between_folders", False, "behavior_wrong: destination folder 'Dest' not listed in the picker", depth=2, jump_kind="value", expect="MoveMe left General, in Dest") return settle("tap") # assert it LEFT General goto_home() left = False if and_enter_folder("General"): left = find_node(ui(), text="MoveMe") is None # assert it ARRIVED in Dest goto_home() arrived = False if and_enter_folder("Dest"): arrived = find_node(ui(), text="MoveMe") is not None ok = left and arrived record("interaction_move_note_between_folders", ok, "" if ok else f"behavior_wrong: move failed (left_General={left}, " f"arrived_Dest={arrived})", depth=2, jump_kind="value", expect="MoveMe left General, in Dest")
# ══════════════════════════════════════════════════════════════════════════════# 3+ step sequence across a freshly created folder# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("interaction_new_folder_note_roundtrip",))def test_new_folder_note_roundtrip(): """Create folder 'Trip' -> open it -> create note 'Day1' in it -> back to HOME -> reopen 'Trip' -> 'Day1' present. Multi-step CRUD across a fresh folder.""" fresh_home() if not create_folder("Trip"): record("interaction_new_folder_note_roundtrip", False, "feature_missing: could not create the folder", depth=2, jump_kind="value", expect="'Day1' in fresh folder 'Trip'") return if not create_note("Trip", "Day1", "d1"): record("interaction_new_folder_note_roundtrip", False, "feature_missing: could not create a note in the new folder", depth=2, jump_kind="value", expect="'Day1' in fresh folder 'Trip'") return goto_home() ok = False if and_enter_folder("Trip"): ok = find_node(ui(), text="Day1") is not None record("interaction_new_folder_note_roundtrip", ok, "" if ok else "behavior_wrong: 'Day1' not present in freshly created " "folder 'Trip'", depth=2, jump_kind="value", expect="'Day1' in fresh folder 'Trip'")
@and_test(expects=("interaction_created_note_card_vlm",))def test_created_note_card_vlm(): """After creating a note, its card renders with the title text larger/bolder ABOVE the body-preview text.""" fresh_home() if not create_note("General", "CardTitle", "card body preview"): record("interaction_created_note_card_vlm", False, "setup_failed: could not create the note", depth=2, jump_kind="none", tag="size") return if not and_enter_folder("General"): record("interaction_created_note_card_vlm", False, "setup_failed: could not reopen the folder", depth=2, jump_kind="none", tag="size") return vlm_assert("interaction_created_note_card", "In the note card, is the title line ('CardTitle') rendered in a " "LARGER or bolder font than, and positioned above, the body-preview " "line ('card body preview')?", depth=2, jump_kind="value", tag="size")
# ══════════════════════════════════════════════════════════════════════════════
TESTS = [ test_create_note, test_second_create_yields_two_rows, test_multi_record_integrity, test_duplicate_note, test_edit_note_body_persists, test_create_folder, test_create_two_folders, test_note_survives_process_death, test_folder_survives_process_death, test_edited_body_survives_process_death, test_multi_select_count, test_pin_note, test_note_options_grid_vlm, test_move_note_between_folders, test_new_folder_note_roundtrip, test_created_note_card_vlm,]
if __name__ == "__main__": run_suite(TESTS, "interaction")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589#!/usr/bin/env python3"""NAVIGATION module — Noto (minimal note-taking app).
Lane ownership: surface REACHABILITY and back-stack integrity. This lane is theSOLE owner of jump_kind="reach" and of depth>=2 chains. Every jump is proven withand_reach(before, after, target, source): the TARGET surface's discriminatingelement APPEARED and the SOURCE surface's element DISAPPEARED. A screen that wasin the dump all along was never reached. Reaching a screen by relaunching the appis NOT navigation and is never done here.
No content values, no checked/selected state, no exact-string content assertions —those belong to other lanes. This file only asserts that we ARRIVED and LEFT.
Invoke: python3 test_android_navigation.py <PACKAGE> <RESULTS_DIR>"""import osimport sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,E402
# ── Local prompt handling ────────────────────────────────────────────────────def dismiss_prompts(): """Dismiss the first-run system notification-permission dialog (and any stray prompt) sitting in front of the already-loaded Noto home. The curly-apostrophe "Don’t allow" (U+2019) and the ASCII form are both matched.""" for _ in range(3): nodes = ui() b = (find_node_ci(nodes, "Don't allow") or find_node_ci(nodes, "Don’t allow") or find_node_ci(nodes, "Allow")) if b and is_safe(b): tap_node(b) settle("tap") continue break
def open_home(): """Every test's clean entry point: relaunch (data kept), wait for the app to foreground, dismiss the perm prompt, return the HOME-sheet node tree.""" restart_app() wait_for_foreground() dismiss_prompts() return ui()
def fresh_home(): """Virgin state (wipe data) + HOME sheet — used once to guarantee the default 'General' folder exists before we seed a note for the deep chains.""" clear_data() launch_app() wait_for_foreground() dismiss_prompts() return ui()
# ── One seeded note so the selection / note-options / reading-mode chains have a# record to navigate to. We CREATE it in setup, then assert the JUMP, never the# creation (that belongs to the interaction lane). ───────────────────────────SEED_BODY = "noto nav seed note"
def ensure_seed_note(): """Guarantee at least one note exists in the default 'General' folder, so the deep chains have a row to long-press. Idempotent enough: if a note is already present we leave it. Returns True when a note row is visible in the folder.""" open_home() nodes = ui() g = find_node(nodes, text="General") if g is None or not tap_node(g): return False settle("tap") nodes = ui() if find_by_class(nodes, "") and (node_by_id(nodes, "tv_note_body") or node_by_id(nodes, "tv_note_title")): return True # No note yet — create one via the folder fab, type a body, back out to save. fab = node_by_id(nodes, "fab") or find_node(nodes, content_desc="Create note") if fab is None or not tap_node(fab): return False settle("tap") body = node_by_id(ui(), "et_note_body") if body is not None: type_text(body, SEED_BODY) hide_keyboard() back() # new-note Back persists and returns to the HOME sheet settle("tap") dismiss_prompts() nodes = ui() g = find_node(nodes, text="General") if g is None or not tap_node(g): return False settle("tap") nodes = ui() return (node_by_id(nodes, "tv_note_body") is not None or node_by_id(nodes, "tv_note_title") is not None)
# ══════════════════════════════════════════════════════════════════════════════# Depth-family helpers — the and_enter_*/and_reach_* NAME is what the depth audit# looks for. Each performs the hops and (for and_reach_*) proves the jump.# ══════════════════════════════════════════════════════════════════════════════
def and_reach_folder(nodes=None, name="General"): """HOME sheet -> tap a folder row -> FOLDER note-list. Proven reach: the folder fab 'Create note' appears, the sheet title 'Noto Debug' vanishes.""" nodes = ui() if nodes is None else nodes row = find_node(nodes, text=name) if row is None: return False return and_reach_surface(row, "Create note", "Noto Debug")
def and_enter_folder(nodes=None, name="General"): """Land on a folder note-list, tolerating that it may already be showing. Returns (ok, nodes). Used as the first hop of the deeper chains where the per-hop reach is asserted by the caller's final and_reach.""" nodes = ui() if nodes is None else nodes row = find_node(nodes, text=name) if row is None: return False, nodes if not tap_node(row): return False, nodes and_enter("folder") return True, ui()
def and_enter_editor(nodes=None): """FOLDER -> fab 'Create note' -> NOTE editor. Returns (ok, nodes).""" nodes = ui() if nodes is None else nodes fab = node_by_id(nodes, "fab") or find_node(nodes, content_desc="Create note") if fab is None or not tap_node(fab): return False, nodes and_enter("editor") return True, ui()
def and_enter_settings(nodes=None): """HOME -> ib_settings -> SETTINGS (Compose). Returns (ok, nodes).""" nodes = ui() if nodes is None else nodes btn = node_by_id(nodes, "ib_settings") or find_node(nodes, content_desc="Settings") if btn is None or not tap_node(btn): return False, nodes and_enter("settings") return True, ui()
def and_reach_settings(nodes=None): """HOME -> ib_settings -> SETTINGS, proven: a Settings-only row ('About') appears and the HOME sheet title 'Noto Debug' vanishes. Counts one surface.""" nodes = ui() if nodes is None else nodes btn = node_by_id(nodes, "ib_settings") or find_node(nodes, content_desc="Settings") if btn is None: return False return and_reach_surface(btn, "About", "Noto Debug")
def and_enter_general_settings(nodes=None): """SETTINGS -> 'General' row -> GENERAL settings (Compose). Returns (ok, nodes).""" nodes = ui() if nodes is None else nodes row = find_node_ci(nodes, "General") if row is None or not tap_node(row): return False, nodes and_enter("general") return True, ui()
def and_reach_selection(nodes=None): """FOLDER -> long-press a note row -> selection mode. Proven by the selection subtitle ('… Selected') appearing. Counts one surface. Returns (ok, nodes).""" nodes = ui() if nodes is None else nodes note = (find_node(nodes, text=SEED_BODY) or node_by_id(nodes, "tv_note_body") or node_by_id(nodes, "tv_note_title")) if note is None: return False, nodes before = and_showing(nodes) long_press(note) settle("tap") after = and_showing() if not and_reach(before, after, "Selected"): return False, ui() and_enter("selection") return True, ui()
def and_reach_note_options(nodes=None): """selection mode -> fab_selection 'More options' -> NOTE options sheet. Proven: 'Note options' title appears, the 'Selected' subtitle vanishes.""" nodes = ui() if nodes is None else nodes fs = node_by_id(nodes, "fab_selection") or find_node(nodes, content_desc="More options") if fs is None: return False return and_reach_surface(fs, "Note options", "Selected")
def and_reach_reading_mode(nodes=None): """NOTE options -> 'Reading Mode' -> READING MODE. A first-run SYSTEM immersive cling ('Got it') may appear over it; dismiss it if present, then prove the reach by the paging arrow 'Next' being visible and 'Note options' gone.""" nodes = ui() if nodes is None else nodes rm = node_by_id(nodes, "tv_open_in") or find_node_ci(nodes, "Reading Mode") if rm is None: return False before = and_showing(nodes) if not tap_node(rm): return False settle("tap") got = find_node_ci(ui(), "Got it") if got is not None: tap_node(got) settle("tap") after = and_showing() ok = and_reach(before, after, "Next", "Note options") if ok: and_enter("reading") return ok
# ══════════════════════════════════════════════════════════════════════════════# depth=1 reaches — top-level destinations# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_reach_folder",))def test_reach_folder(): open_home() ok = and_reach_folder() record("nav_reach_folder", ok, "" if ok else "feature_missing: HOME folder row did not open the note-list", depth=1, jump_kind="reach", expect="folder note-list shown (fab 'Create note' appeared); " "HOME sheet title 'Noto Debug' gone")
@and_test(expects=("nav_reach_home_from_folder",))def test_reach_home_from_folder(): open_home() ok_f, nodes = and_enter_folder() ham = find_node(nodes, content_desc="Folders") if ok_f else None ok = ok_f and ham is not None and and_reach_surface(ham, "Noto Debug", "Create note") record("nav_reach_home_from_folder", ok, "" if ok else "behavior_wrong: 'Folders' hamburger did not return to the HOME sheet", depth=1, jump_kind="reach", expect="HOME sheet title 'Noto Debug' reappeared; folder fab 'Create note' gone")
@and_test(expects=("nav_reach_settings", "nav_reach_settings_vlm"))def test_reach_settings(): open_home() ok = and_reach_settings() record("nav_reach_settings", ok, "" if ok else "feature_missing: no reachable Settings surface", depth=1, jump_kind="reach", expect="Settings surface visible ('About' row appeared); 'Noto Debug' gone") vlm_assert("nav_reach_settings", "Is a settings screen showing a vertical list of labelled rows, " "each row with a small leading icon on its left?", RESULTS_DIR, depth=1, jump_kind="reach", tag="layout")
@and_test(expects=("nav_reach_recent",))def test_reach_recent(): open_home() nodes = ui() card = find_node(nodes, text="Recent") ok = card is not None and and_reach_surface(card, "Today", "Noto Debug") record("nav_reach_recent", ok, "" if ok else "feature_missing: 'Recent' library card did not open the Recent screen", depth=1, jump_kind="reach", expect="Recent screen shown (grouping header 'Today' appeared); " "HOME sheet 'Noto Debug' gone")
@and_test(expects=("nav_reach_all",))def test_reach_all(): open_home() nodes = ui() card = find_node(nodes, text="All") ok = card is not None and and_reach_surface(card, "Collapse", "Noto Debug") record("nav_reach_all", ok, "" if ok else "feature_missing: 'All' library card did not open the All-notes screen", depth=1, jump_kind="reach", expect="All-notes screen shown (bottom-bar 'Collapse' appeared); 'Noto Debug' gone")
@and_test(expects=("nav_reach_archived",))def test_reach_archived(): open_home() nodes = ui() card = find_node(nodes, text="Archived") ok = card is not None and and_reach_surface(card, "Collapse", "Noto Debug") record("nav_reach_archived", ok, "" if ok else "feature_missing: 'Archived' library card did not open the Archived screen", depth=1, jump_kind="reach", expect="Archived screen shown (bottom-bar 'Collapse' appeared); 'Noto Debug' gone")
@and_test(expects=("nav_reach_more_menu", "nav_reach_more_menu_vlm"))def test_reach_more_menu(): open_home() nodes = ui() more = node_by_id(nodes, "ib_more") or find_node(nodes, content_desc="More options") ok = more is not None and and_reach_surface(more, "Folders vault", "Create folder") record("nav_reach_more_menu", ok, "" if ok else "feature_missing: 'More options' did not open the home more menu", depth=1, jump_kind="reach", expect="home more menu shown ('Folders vault' appeared); HOME fab 'Create folder' gone") vlm_assert("nav_reach_more_menu", "Is a small menu sheet showing a short vertical list of text entries " "(vault / archive / settings), overlaying the screen near the bottom?", RESULTS_DIR, depth=1, jump_kind="reach", tag="layout")
@and_test(expects=("nav_reach_search",))def test_reach_search(): open_home() ok_f, nodes = and_enter_folder() srch = node_by_id(nodes, "search") or find_node(nodes, content_desc="Search") if ok_f else None ok = ok_f and srch is not None and and_reach_surface(srch, "til_search", "Folder options") record("nav_reach_search", ok, "" if ok else "feature_missing: folder 'Search' did not open the in-folder search field", depth=1, jump_kind="reach", expect="in-folder search field (til_search) appeared; folder 'Folder options' action gone")
@and_test(expects=("nav_reach_notes_view", "nav_reach_notes_view_vlm"))def test_reach_notes_view(): open_home() ok_f, nodes = and_enter_folder() nv = node_by_id(nodes, "notes_view") or find_node(nodes, content_desc="Notes view") if ok_f else None ok = ok_f and nv is not None and and_reach_surface(nv, "Apply", "Create note") record("nav_reach_notes_view", ok, "" if ok else "feature_missing: 'Notes view' did not open the sort/filter dialog", depth=1, jump_kind="reach", expect="Notes-view dialog shown ('Apply' appeared); folder fab 'Create note' gone") vlm_assert("nav_reach_notes_view", "Is a bottom sheet dialog anchored to the lower portion of the screen, " "overlaying a dimmed screen behind it?", RESULTS_DIR, depth=1, jump_kind="reach", tag="position")
@and_test(expects=("nav_reach_folder_options",))def test_reach_folder_options(): open_home() ok_f, nodes = and_enter_folder() more = node_by_id(nodes, "more") or find_node(nodes, content_desc="Folder options") if ok_f else None ok = ok_f and more is not None and and_reach_surface(more, "New note shortcut", "Create note") record("nav_reach_folder_options", ok, "" if ok else "feature_missing: 'Folder options' did not open the folder options sheet", depth=1, jump_kind="reach", expect="folder-options sheet shown ('New note shortcut' appeared); fab 'Create note' gone")
# ══════════════════════════════════════════════════════════════════════════════# depth>=2 chains — this lane owns these# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_chain_editor", "nav_chain_editor_vlm"))def test_chain_home_folder_editor(): """HOME -> General folder -> NOTE editor (two hops); assert the final jump.""" open_home() ok_f, nodes = and_enter_folder() # hop 1 ok = False if ok_f: fab = node_by_id(nodes, "fab") or find_node(nodes, content_desc="Create note") ok = fab is not None and and_reach_surface(fab, "Body", "Create note") # hop 2 record("nav_chain_editor", ok, "" if ok else "behavior_wrong: HOME->folder->editor chain did not reach the note editor", depth=2, jump_kind="reach", expect="note editor shown (Body field appeared); folder fab 'Create note' gone") vlm_assert("nav_chain_editor", "Is there a back-arrow icon at the very top-left of the screen, next to " "the folder title in the toolbar?", RESULTS_DIR, depth=2, jump_kind="reach", tag="position")
@and_test(expects=("nav_chain_general_settings",))def test_chain_home_settings_general(): """HOME -> Settings -> General settings (two hops).""" open_home() ok_s, nodes = and_enter_settings() # hop 1 ok = False if ok_s: gen = find_node_ci(nodes, "General") ok = gen is not None and and_reach_surface(gen, "Theme", "Support Noto") # hop 2 record("nav_chain_general_settings", ok, "" if ok else "behavior_wrong: Settings->General chain did not reach General settings", depth=2, jump_kind="reach", expect="General settings shown ('Theme' row appeared); Settings-only 'Support Noto' gone")
@and_test(expects=("nav_chain_theme_dialog",))def test_chain_theme_dialog(): """HOME -> Settings -> General -> THEME dialog (three hops).""" open_home() ok_s, nodes = and_enter_settings() # hop 1 ok_g, nodes = (and_enter_general_settings(nodes) if ok_s else (False, nodes)) # hop 2 ok = False if ok_g: theme = find_node_ci(nodes, "Theme") ok = theme is not None and and_reach_surface(theme, "Light", "Language") # hop 3 record("nav_chain_theme_dialog", ok, "" if ok else "behavior_wrong: General->Theme chain did not open the Theme dialog", depth=3, jump_kind="reach", expect="Theme dialog shown (option 'Light' appeared); General row 'Language' gone")
@and_test(expects=("nav_chain_note_options",))def test_chain_note_options(): """FOLDER -> long-press note -> selection -> NOTE options sheet (two hops from the folder). The note we navigate to is CREATED in setup; we assert the jump.""" if not ensure_seed_note(): record("nav_chain_note_options", False, "setup_failed: could not create/reach a note row to long-press", depth=2, jump_kind="reach", expect="Note-options sheet shown after long-press -> More options") return ok_sel, nodes = and_reach_selection() # hop 1: folder -> selection ok = ok_sel and and_reach_note_options(nodes) # hop 2: selection -> note options record("nav_chain_note_options", ok, "" if ok else "behavior_wrong: long-press -> More options did not open the Note-options sheet", depth=2, jump_kind="reach", expect="Note-options sheet shown ('Note options' title appeared); " "selection subtitle '… Selected' gone")
@and_test(expects=("nav_chain_reading_mode", "nav_chain_reading_mode_vlm"))def test_chain_reading_mode(): """NOTE options -> 'Reading Mode' -> READING MODE (three hops from the folder).""" if not ensure_seed_note(): record("nav_chain_reading_mode", False, "setup_failed: could not create/reach a note row to long-press", depth=3, jump_kind="reach", expect="Reading Mode shown (paging arrow 'Next' appeared)") vlm_assert("nav_chain_reading_mode", "Is there a solid black rounded-square button with a white pencil " "icon centered along the very bottom of the screen, with a small " "paging arrow to its left and another to its right?", RESULTS_DIR, depth=3, jump_kind="reach", tag="position") return ok_sel, nodes = and_reach_selection() # hop 1 ok_opts = ok_sel and and_reach_note_options(nodes) # hop 2 ok = ok_opts and and_reach_reading_mode() # hop 3 record("nav_chain_reading_mode", ok, "" if ok else "behavior_wrong: 'Reading Mode' did not open the read-only reader", depth=3, jump_kind="reach", expect="Reading Mode shown (paging arrow 'Next' appeared); 'Note options' gone") vlm_assert("nav_chain_reading_mode", "Is there a solid black rounded-square button with a white pencil icon " "centered along the very bottom of the screen, with a small paging arrow " "to its left and another to its right?", RESULTS_DIR, depth=3, jump_kind="reach", tag="position")
# ══════════════════════════════════════════════════════════════════════════════# Back-stack integrity — the reverse jump proven by and_reach on BACK# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_back_editor_to_home",))def test_back_editor_to_home(): """From a NEW note (fab 'Create note'), BACK returns to the HOME sheet.""" open_home() ok_f, nodes = and_enter_folder() # hop 1 ok_e, nodes = (and_enter_editor(nodes) if ok_f else (False, nodes)) # hop 2 ok = False if ok_e: # Snapshot the editor surface WHILE its fields are still present. hide_keyboard() # perturbs the tree, so capturing `before` after it would miss the Body field. before = and_showing(nodes) hide_keyboard() # keyboard-up BACK only dismisses the IME and_back() # pop editor -> HOME sheet after = and_showing() ok = and_reach(before, after, "Noto Debug", "Body") record("nav_back_editor_to_home", ok, "" if ok else "behavior_wrong: BACK from a new note did not return to the HOME sheet", depth=2, jump_kind="reach", expect="HOME sheet 'Noto Debug' restored after BACK; editor Body field gone")
@and_test(expects=("nav_back_settings_to_folder",))def test_back_settings_to_folder(): """Settings BACK returns to the FOLDER note-list that was behind the sheet.""" open_home() ok_s, nodes = and_enter_settings() # hop 1 (settings opened over the folder) ok = False if ok_s: before = and_showing(nodes) and_back() # pop settings after = and_showing() ok = and_reach(before, after, "Create note", "About") record("nav_back_settings_to_folder", ok, "" if ok else "behavior_wrong: BACK from Settings did not return to the folder note-list", depth=1, jump_kind="reach", expect="folder fab 'Create note' restored after BACK; Settings 'About' gone")
@and_test(expects=("nav_back_general_to_settings",))def test_back_general_to_settings(): """General-settings BACK returns to the Settings list.""" open_home() ok_s, nodes = and_enter_settings() # hop 1 ok_g, nodes = (and_enter_general_settings(nodes) if ok_s else (False, nodes)) # hop 2 ok = False if ok_g: before = and_showing(nodes) and_back() # pop general -> settings after = and_showing() ok = and_reach(before, after, "Support Noto", "Theme") record("nav_back_general_to_settings", ok, "" if ok else "behavior_wrong: BACK from General did not return to Settings", depth=2, jump_kind="reach", expect="Settings 'Support Noto' restored after BACK; General 'Theme' row gone")
@and_test(expects=("nav_back_reading_to_folder",))def test_back_reading_to_folder(): """Reading-mode BACK returns to the folder note-list.""" if not ensure_seed_note(): record("nav_back_reading_to_folder", False, "setup_failed: could not create/reach a note row to long-press", depth=3, jump_kind="reach", expect="folder note-list restored after BACK from Reading Mode") return ok_sel, nodes = and_reach_selection() # hop 1 ok_opts = ok_sel and and_reach_note_options(nodes) # hop 2 ok_read = ok_opts and and_reach_reading_mode() # hop 3 ok = False if ok_read: before = and_showing() and_back() # pop reading -> folder after = and_showing() ok = and_reach(before, after, "Create note", "Next") record("nav_back_reading_to_folder", ok, "" if ok else "behavior_wrong: BACK from Reading Mode did not return to the folder", depth=3, jump_kind="reach", expect="folder fab 'Create note' restored after BACK; reading-mode 'Next' arrow gone")
# ══════════════════════════════════════════════════════════════════════════════# Extra VLM — the visual chrome that confirms arrival beyond the dump# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("nav_folder_bottom_bar_vlm",))def test_folder_bottom_bar_vlm(): open_home() ok_f = and_reach_folder() if not ok_f: record("nav_folder_bottom_bar_vlm", False, "setup_failed: could not reach a folder to photograph its bottom bar", depth=1, jump_kind="reach", tag="layout") return vlm_assert("nav_folder_bottom_bar", "Is there a horizontal row of action icons along the bottom of the " "screen (a menu/hamburger, a plus/add, and search), forming a bottom app bar?", RESULTS_DIR, depth=1, jump_kind="reach", tag="layout")
TESTS = [ # depth=1 reaches test_reach_folder, test_reach_home_from_folder, test_reach_settings, test_reach_recent, test_reach_all, test_reach_archived, test_reach_more_menu, test_reach_search, test_reach_notes_view, test_reach_folder_options, # depth>=2 chains test_chain_home_folder_editor, test_chain_home_settings_general, test_chain_theme_dialog, test_chain_note_options, test_chain_reading_mode, # back-stack integrity test_back_editor_to_home, test_back_settings_to_folder, test_back_general_to_settings, test_back_reading_to_folder, # extra VLM chrome test_folder_bottom_bar_vlm,]
if __name__ == "__main__": run_suite(TESTS, "navigation")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959#!/usr/bin/env python3"""STATES module — Noto (minimal note-taking app).
Lane ownership: STATE CHANGE. This module is the SOLE owner of `checked`,`selected`, `focused`, of conditional enable/disable, of page-level state machines,and of SETTINGS / MODE PERSISTENCE across process death. Every test reads a stateBEFORE from a fresh ui(), drives the app through the real user path, reads AFTER,asserts the flip, AND asserts the app-authored consequence — then restores.
What this lane does NOT assert (ceded to other lanes): whether a record survives(interaction/data), the numeric word/note count (computation), pure reachability(navigation), the exact wording of a label/placeholder (text), view-tree shape(structure). Here we assert a STATE FLIP (before -> after) plus what the app did.
VERIFIED LIVE before authoring (the risky ones): * Editor undo/redo enable: a FRESH note has ib_undo/ib_redo/ib_undo_history all enabled="false"; after typing ONE char into et_note_body, ib_undo flips to enabled="true" while ib_redo and ib_undo_history STAY "false". Clean conditional-enable pair. * Selection: long-press a note -> subtitle tv_folder_notes_count desc gains " • 1 Selected", iv_selected (desc "Select", selected="true") APPEARS + the bottom selection action bar (add_reminder/pin/share/archive/fab_selection). BACK reverts the subtitle and removes iv_selected. Tapping a 2nd row in selection mode -> " • 2 Selected", two iv_selected badges. * "Show notes count" (General settings): flipping it OFF makes ALL tv_notes_count (library cards) and tv_folder_notes_count nodes DISAPPEAR from the HOME sheet; flipping ON brings them back. The Compose toggle itself exposes NO checked/selected attribute, so the consequence (count nodes present/absent) is the observable state, and it PERSISTS across force-stop+relaunch. * Theme: General -> Theme -> "Light" updates the Theme row value to "Light" and survives force_stop_and_relaunch() (row still "Light"). NOTE: selecting a theme can re-trigger the notification-permission dialog, so dismiss_prompts() after. * Notes-view dialog: tapping the "Ordering" row flips its value TextView "Descending" -> "Ascending" (an "Ascending" TextView appears where none was). * Focus: a fab-created note auto-focuses et_note_body (focused="true"); tapping et_note_title moves focus to the title (title focused="true", body "false"). * Reading Mode (via long-press -> More -> Reading Mode) is scoped to the single opened note, so tv_notes_count reads "1 / 1 Note" and Next does not advance — we therefore assert the paging-position STATE ("1 / N Note(s)" at position 1), not a page advance. * The tv_all_label "All" chip and the Compose theme/toggle controls expose NO selected/checked attribute in the dump, so their highlight/thumb is a VLM colour question; the rule half asserts the control is present as the active affordance.
Invoke: python3 test_android_states.py <PACKAGE> <RESULTS_DIR>"""import osimport sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,E402
# ══════════════════════════════════════════════════════════════════════════════# Local setup helpers# ══════════════════════════════════════════════════════════════════════════════
def dismiss_prompts(): """Dismiss the first-run system notification-permission dialog (and any stray prompt) sitting in front of the already-loaded Noto home. Both ASCII "Don't allow" and the curly-apostrophe "Don't allow" (U+2019) are matched. It can reappear on a plain relaunch AND after selecting a theme, so call it after every launch and after a theme change.""" for _ in range(3): nodes = ui() b = (find_node_ci(nodes, "Don't allow") or find_node_ci(nodes, "Don’t allow") or find_node_ci(nodes, "Allow")) if b and is_safe(b): tap_node(b) settle("tap") continue break
def launched_home(): """Force-stop + relaunch (data kept), dismiss any prompt, land on HOME sheet.""" restart_app() wait_for_foreground() dismiss_prompts() return goto_home()
def relaunched_home(): """The persistence probe: kill the process, relaunch WITHOUT wiping, dismiss any prompt, back to HOME sheet.""" force_stop_and_relaunch() wait_for_foreground() dismiss_prompts() return goto_home()
def goto_home(): """Back out to the HOME bottom sheet (the one surface with the 'Create folder' fab).""" for _ in range(5): if find_node(ui(), content_desc="Create folder"): break back() settle("tap") return ui()
def note_titles(nodes): return [n for n in nodes if n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_note_title"]
def selected_badges(nodes): return [n for n in nodes if n.get("resource-id", "").rsplit("/", 1)[-1] == "iv_selected"]
def count_nodes(nodes): """Every visible library-card / folder-row note-count node on HOME.""" return [n for n in nodes if n.get("resource-id", "").rsplit("/", 1)[-1] in ("tv_notes_count", "tv_folder_notes_count")]
# ── Depth-backing navigation helpers (named and_enter_*/and_reach_* so the audit# attributes the declared depth to a real navigation call). ─────────────────
def and_enter_folder(name="General"): """HOME sheet -> tap a folder row -> its note-list surface. Counts one surface. Returns True when the folder title is showing.""" n = find_node(ui(), text=name) if n is None or not tap_node(n): return False settle("tap") and_enter("folder:" + name) tit = node_by_id(ui(), "tv_folder_title") return tit is not None and tit.get("text") == name
def and_enter_editor(): """FOLDER note-list -> tap fab 'Create note' -> the note editor. Counts one surface. Returns True when et_note_title is present.""" fab = find_node(ui(), content_desc="Create note") if fab is None or not tap_node(fab): return False settle("tap") and_enter("editor") return node_by_id(ui(), "et_note_title") is not None
def and_enter_selection(title=None): """FOLDER note-list -> LONG-PRESS a note row -> selection mode. Counts one surface. Returns the note node long-pressed (or None).""" nodes = ui() note = (find_node(nodes, text=title) if title else None) or ( note_titles(nodes)[0] if note_titles(nodes) else None) if note is None or not long_press(note): return None settle("tap") and_enter("selection") return note
def and_enter_settings(): """HOME sheet -> ib_settings 'Settings' -> the Settings list. Counts one surface. Returns True when the 'General' row is present.""" s = find_node(ui(), content_desc="Settings") if s is None or not tap_node(s): return False settle("tap") and_enter("settings") return find_node(ui(), content_desc="General") is not None
def and_enter_general_settings(): """HOME -> Settings -> 'General' -> General settings. Counts two surfaces (it calls and_enter_settings first). Returns True when the 'Theme' row shows.""" if not and_enter_settings(): return False g = find_node(ui(), content_desc="General") or find_node(ui(), text="General") if g is None or not tap_node(g): return False settle("tap") and_enter("general_settings") return find_node(ui(), content_desc="Theme") is not None
def and_reach_theme_dialog(): """General settings -> 'Theme' row -> Theme dialog. Counts one surface. Returns True when the 'Light' option is present.""" t = find_node(ui(), content_desc="Theme") if t is None or not tap_node(t): return False settle("tap") and_enter("theme_dialog") return find_node(ui(), text="Light") is not None
def and_reach_notes_view(): """FOLDER note-list -> notes_view 'Notes view' -> the sort/filter dialog. Counts one surface. Returns True when the 'Apply' button shows.""" nv = node_by_id(ui(), "notes_view") or find_node(ui(), content_desc="Notes view") if nv is None or not tap_node(nv): return False settle("tap") and_enter("notes_view") return find_node_ci(ui(), "Apply") is not None
def and_reach_note_options(): """SELECTION mode -> fab_selection 'More options' -> the Note options sheet. Counts one surface. Returns True when 'Note options' shows.""" fs = node_by_id(ui(), "fab_selection") if fs is None or not tap_node(fs): return False settle("tap") and_enter("note_options") return find_node_ci(ui(), "Note options") is not None
def and_reach_reading_mode(): """Note options sheet -> tv_open_in 'Reading Mode' -> Reading Mode; dismiss the immersive cling. Counts one surface. Returns True when fab_next appears.""" oi = node_by_id(ui(), "tv_open_in") or find_node_ci(ui(), "Reading Mode") if oi is None or not tap_node(oi): return False settle("tap") and_enter("reading_mode") gotit = find_node_ci(ui(), "Got it") if gotit: tap_node(gotit) settle("tap") return find_node(ui(), content_desc="Next") is not None
# ── Data authoring (unique titles so counts/selection are deterministic). ──────
def make_note(title, body=""): """From the HOME sheet: open General -> fab 'Create note' -> type title/body -> hide_keyboard()+back() (lands on HOME sheet). Returns True on success.""" if not and_enter_folder("General"): return False if not and_enter_editor(): return False t = node_by_id(ui(), "et_note_title") if t is None or not type_text(t, title): return False if body: b = node_by_id(ui(), "et_note_body") if b is not None: type_text(b, body) hide_keyboard() back() settle("tap") goto_home() return True
def theme_row_value(nodes): """The current value TextView on the General-settings 'Theme' row.""" row = find_node(nodes, content_desc="Theme") if not row or "_bounds" not in row: return None ry = row["_bounds"][1] for n in nodes: if not n.get("class", "").endswith("TextView"): continue b = n.get("_bounds") if (b and abs(b[1] - ry) < 90 and n.get("text") in ( "Follow system + Dark", "Follow system + Black", "Light", "Dark", "Black")): return n.get("text") return None
def set_theme(option): """From HOME: drive to the Theme dialog and select `option`. Returns the Theme row value observed afterward (after dismissing any re-triggered prompt).""" if not and_enter_general_settings(): return None if not and_reach_theme_dialog(): return None opt = find_node(ui(), text=option) or find_node(ui(), content_desc=option) if opt is None or not tap_node(opt): return None settle("tap") dismiss_prompts() # selecting a theme can re-show the notif prompt return theme_row_value(ui())
# ══════════════════════════════════════════════════════════════════════════════# SELECTION state machine (checked/selected is THIS lane's)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("states_selection_on", "states_selection_on_vlm", "states_selection_bar_vlm"))def test_selection_turns_on(): """Long-press a note -> selection mode ON: iv_selected APPEARS, subtitle gains ' • 1 Selected'.""" launched_home() make_note("SelOne", "sel body one") if not and_enter_folder("General"): record("states_selection_on", False, "setup_failed: could not open the General folder", depth=1, jump_kind="transition", expect="not-selected -> selected") return before = ui() sub_before = (node_by_id(before, "tv_folder_notes_count") or {}).get("content-desc", "") badges_before = len(selected_badges(before)) note = and_enter_selection("SelOne") if note is None: record("states_selection_on", False, "setup_failed: long-press did not register on the note row", depth=1, jump_kind="transition", expect="not-selected -> selected") return after = ui() sub_after = (node_by_id(after, "tv_folder_notes_count") or {}).get("content-desc", "") sel_node = node_by_id(after, "iv_selected") badges_after = len(selected_badges(after)) ok = (badges_before == 0 and badges_after >= 1 and "Selected" not in sub_before and "Selected" in sub_after and sel_node is not None and sel_node.get("selected") == "true") record("states_selection_on", ok, "" if ok else ("behavior_wrong: long-press did not enter selection " f"(iv_selected {badges_before}->{badges_after}, " f"subtitle {sub_before!r}->{sub_after!r})"), depth=1, jump_kind="transition", expect="iv_selected absent -> present; subtitle gains ' • 1 Selected'") vlm_assert("states_selection_on", "Does exactly one note row show a solid, filled circular check/" "selection badge (a coloured circle with a checkmark) on it?", RESULTS_DIR, depth=1, jump_kind="transition", tag="shape") vlm_assert("states_selection_bar", "Is a horizontal action bar of icon buttons (reminder, pin, share, " "archive) shown along the bottom of the screen?", RESULTS_DIR, depth=1, jump_kind="transition", tag="layout")
@and_test(expects=("states_selection_off",))def test_selection_turns_off(): """From selection ON, BACK -> selection OFF: subtitle drops 'Selected', iv_selected gone.""" launched_home() make_note("SelOff", "sel off body") if not and_enter_folder("General"): record("states_selection_off", False, "setup_failed: could not open the General folder", depth=1, jump_kind="transition", expect="selected -> not-selected") return note = and_enter_selection("SelOff") if note is None: record("states_selection_off", False, "setup_failed: could not enter selection mode", depth=1, jump_kind="transition", expect="selected -> not-selected") return on = ui() sub_on = (node_by_id(on, "tv_folder_notes_count") or {}).get("content-desc", "") badges_on = len(selected_badges(on)) and_back() # BACK exits selection mode settle("tap") off = ui() sub_off = (node_by_id(off, "tv_folder_notes_count") or {}).get("content-desc", "") badges_off = len(selected_badges(off)) ok = ("Selected" in sub_on and badges_on >= 1 and "Selected" not in sub_off and badges_off == 0) record("states_selection_off", ok, "" if ok else ("behavior_wrong: BACK did not clear selection " f"(subtitle {sub_on!r}->{sub_off!r}, " f"badges {badges_on}->{badges_off})"), depth=1, jump_kind="transition", expect="subtitle ' • 1 Selected' -> no 'Selected'; iv_selected removed")
@and_test(expects=("states_multiselect_two",))def test_multiselect_two(): """Long-press one note, tap a second -> two iv_selected badges, subtitle ' • 2 Selected'.""" launched_home() make_note("MultiA", "multi body a") make_note("MultiB", "multi body b") if not and_enter_folder("General"): record("states_multiselect_two", False, "setup_failed: could not open the General folder", depth=1, jump_kind="transition", expect="1 selected -> 2 selected") return rows = note_titles(ui()) if len(rows) < 2: record("states_multiselect_two", False, "setup_failed: fewer than two note rows to multi-select", depth=1, jump_kind="transition", expect="1 selected -> 2 selected") return if and_enter_selection() is None: record("states_multiselect_two", False, "setup_failed: could not enter selection mode", depth=1, jump_kind="transition", expect="1 selected -> 2 selected") return one = ui() sub_one = (node_by_id(one, "tv_folder_notes_count") or {}).get("content-desc", "") badges_one = len(selected_badges(one)) rows = note_titles(ui()) tapped = tap_node(rows[1]) if len(rows) > 1 else False settle("tap") two = ui() sub_two = (node_by_id(two, "tv_folder_notes_count") or {}).get("content-desc", "") badges_two = len(selected_badges(two)) ok = (tapped and badges_one == 1 and badges_two == 2 and "1 Selected" in sub_one and "2 Selected" in sub_two) record("states_multiselect_two", ok, "" if ok else ("behavior_wrong: second tap did not add a selection " f"(badges {badges_one}->{badges_two}, " f"subtitle {sub_one!r}->{sub_two!r})"), depth=1, jump_kind="transition", expect="'1 Selected' / 1 badge -> '2 Selected' / 2 badges")
@and_test(expects=("states_selection_count_increment",))def test_selection_count_increment(): """With >=2 notes, the ' • K Selected' count increments 1 -> 2 as a second row is tapped (the selected-count state).""" launched_home() make_note("IncA", "inc body a") make_note("IncB", "inc body b") if not and_enter_folder("General"): record("states_selection_count_increment", False, "setup_failed: could not open the General folder", depth=1, jump_kind="transition", expect="count 1 -> 2") return if and_enter_selection() is None: record("states_selection_count_increment", False, "setup_failed: could not enter selection mode", depth=1, jump_kind="transition", expect="count 1 -> 2") return sub1 = (node_by_id(ui(), "tv_folder_notes_count") or {}).get("content-desc", "") rows = note_titles(ui()) if len(rows) < 2 or not tap_node(rows[1]): record("states_selection_count_increment", False, "setup_failed: could not tap a second row", depth=1, jump_kind="transition", expect="count 1 -> 2") return settle("tap") sub2 = (node_by_id(ui(), "tv_folder_notes_count") or {}).get("content-desc", "") ok = "1 Selected" in sub1 and "2 Selected" in sub2 record("states_selection_count_increment", ok, "" if ok else ("behavior_wrong: selected-count did not increment " f"({sub1!r} -> {sub2!r})"), depth=1, jump_kind="transition", expect="subtitle '• 1 Selected' -> '• 2 Selected'")
# ══════════════════════════════════════════════════════════════════════════════# LABEL FILTER CHIP (the "All" chip is the active/selected filter)# ═════════��════════════════════════════════════════════════════════════════════
@and_test(expects=("states_all_chip_active", "states_all_chip_active_vlm"))def test_all_label_chip_active(): """The folder screen's tv_all_label 'All' chip is the active filter (a filled/highlighted chip) while the add-label button is an outlined affordance. The dump exposes no selected attribute on the chip, so the rule half asserts the chip and the add-label button both exist as the filter row, and the VLM verifies the fill/outline colour distinction.""" launched_home() if not and_enter_folder("General"): record("states_all_chip_active", False, "setup_failed: could not open the General folder", depth=1, jump_kind="value", expect="'All' chip present as active filter") return nodes = ui() chip = node_by_id(nodes, "tv_all_label") or find_node_ci(nodes, "All") add = node_by_id(nodes, "ib_new_label") or find_node(nodes, content_desc="Create label") ok = chip is not None and chip.get("text") == "All" and add is not None record("states_all_chip_active", ok, "" if ok else "feature_missing: no 'All' filter chip + add-label button row", depth=1, jump_kind="value", expect="tv_all_label 'All' + ib_new_label present as the active filter row") vlm_assert("states_all_chip_active", "Near the top of the note list, the row starts with an 'All' label " "and a neighbouring icon button. Is the 'All' label drawn as a FILLED " "solid (dark) pill/box with light text, while the neighbouring button " "is only an OUTLINED (unfilled, white-interior) box?", RESULTS_DIR, depth=1, jump_kind="value", tag="color")
# ══════════════════════════════════════════════════════════════════════════════# EDITOR conditional enable/disable (enabled transitions are THIS lane's)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("states_undo_enable", "states_undo_disabled_vlm"))def test_undo_enables_after_typing(): """A FRESH note has ib_undo enabled='false'; after typing into et_note_body it flips to enabled='true' (the app-authored consequence of there being an edit to undo).""" launched_home() if not and_enter_folder("General") or not and_enter_editor(): record("states_undo_enable", False, "setup_failed: could not reach the note editor", depth=2, jump_kind="transition", expect="undo disabled -> enabled") return fresh = ui() undo0 = node_by_id(fresh, "ib_undo") before = undo0.get("enabled") if undo0 else None # VLM the disabled state on the fresh note BEFORE we type. vlm_assert("states_undo_disabled", "In the bottom toolbar of this note editor, does the Undo (left " "curved arrow) icon look greyed-out / dimmed compared with the other " "toolbar icons?", RESULTS_DIR, depth=2, jump_kind="transition", tag="color") body = node_by_id(ui(), "et_note_body") if body is None or not type_text(body, "x"): record("states_undo_enable", False, "setup_failed: could not type into the note body", depth=2, jump_kind="transition", expect="undo disabled -> enabled") return after = ui() undo1 = find_closest_match(after, undo0) if undo0 else node_by_id(after, "ib_undo") undo1 = node_by_id(after, "ib_undo") or undo1 now = undo1.get("enabled") if undo1 else None ok = before == "false" and now == "true" record("states_undo_enable", ok, "" if ok else ("behavior_wrong: ib_undo enabled did not flip false->true " f"(before={before}, after={now})"), depth=2, jump_kind="transition", expect="ib_undo enabled 'false' -> 'true' after an edit")
@and_test(expects=("states_redo_stays_disabled",))def test_redo_stays_disabled_after_typing(): """Conditional-enable pair: after typing (undo now enabled) there is nothing to REDO yet, so ib_redo STAYS enabled='false'. A specific resulting state.""" launched_home() if not and_enter_folder("General") or not and_enter_editor(): record("states_redo_stays_disabled", False, "setup_failed: could not reach the note editor", depth=2, jump_kind="value", expect="ib_redo enabled == 'false'") return body = node_by_id(ui(), "et_note_body") if body is None or not type_text(body, "y"): record("states_redo_stays_disabled", False, "setup_failed: could not type into the note body", depth=2, jump_kind="value", expect="ib_redo enabled == 'false'") return after = ui() redo = node_by_id(after, "ib_redo") undo = node_by_id(after, "ib_undo") ok = (redo is not None and redo.get("enabled") == "false" and undo is not None and undo.get("enabled") == "true") record("states_redo_stays_disabled", ok, "" if ok else ("behavior_wrong: after an edit redo should be disabled " "while undo is enabled " f"(redo={redo.get('enabled') if redo else None}, " f"undo={undo.get('enabled') if undo else None})"), depth=2, jump_kind="value", expect="after an edit: ib_redo enabled 'false' (nothing to redo), ib_undo 'true'")
@and_test(expects=("states_undo_history_disabled",))def test_undo_history_disabled_on_fresh_note(): """On a FRESH note ib_undo_history is enabled='false' (no history yet) — the initial disabled state of the history control. Specific resulting state.""" launched_home() if not and_enter_folder("General") or not and_enter_editor(): record("states_undo_history_disabled", False, "setup_failed: could not reach the note editor", depth=2, jump_kind="value", expect="ib_undo_history enabled == 'false'") return fresh = ui() uh = node_by_id(fresh, "ib_undo_history") rh = node_by_id(fresh, "ib_redo_history") ok = (uh is not None and uh.get("enabled") == "false" and rh is not None and rh.get("enabled") == "false") record("states_undo_history_disabled", ok, "" if ok else ("behavior_wrong: history controls should be disabled on a " f"fresh note (undo_history={uh.get('enabled') if uh else None}, " f"redo_history={rh.get('enabled') if rh else None})"), depth=2, jump_kind="value", expect="fresh note: ib_undo_history & ib_redo_history enabled 'false'")
# ══════════════════════════════════════════════════════════════════════════════# SETTINGS / MODE PERSISTENCE (the strongest anti-shell probe — THIS lane owns it)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("states_theme_persists", "states_theme_light_vlm", "states_theme_persists_vlm", "states_theme_selected_mark_vlm", "states_theme_dark_vlm"))def test_theme_light_persists_across_restart(): """Select the 'Light' theme -> the General-settings Theme row reads 'Light' AND the app recolours light; then force_stop_and_relaunch() -> the row is STILL 'Light' (mode persisted across process death). Finally restore a dark theme.""" launched_home() val = set_theme("Light") # VLM: after selecting Light, capture the (light) app + the marked option state. # set_theme returns us to General settings; snapshot it for the colour check. vlm_assert("states_theme_light", "Is the overall app background LIGHT (white / very pale) with dark " "text, rather than a dark/black background?", RESULTS_DIR, depth=3, jump_kind="transition", tag="color") # Re-open the theme dialog to VLM the currently-selected option marker. if and_reach_theme_dialog(): vlm_assert("states_theme_selected_mark", "In this Theme option list, is the 'Light' option visibly marked " "as the current selection (a filled radio dot or a highlighted " "row) while the other options are not?", RESULTS_DIR, depth=3, jump_kind="value", tag="shape") back() # close the dialog settle("tap") ok_select = val == "Light"
# Persistence probe: kill + relaunch, then re-read the Theme row. relaunched_home() persisted = None if and_enter_general_settings(): persisted = theme_row_value(ui()) vlm_assert("states_theme_persists", "Is the overall app background still LIGHT (white / very pale) with " "dark text after the app was restarted?", RESULTS_DIR, depth=3, jump_kind="transition", tag="color") ok = ok_select and persisted == "Light" record("states_theme_persists", ok, "" if ok else ("behavior_wrong: theme did not select/persist as Light " f"(after-select={val!r}, after-restart={persisted!r})"), depth=3, jump_kind="transition", expect="Theme row 'Light' after selection AND still 'Light' after relaunch")
# Verify a DARK surface via the UNCONDITIONAL "Dark" option (not "Follow # system + Dark" — on this emulator the system is in light mode, so that would # resolve LIGHT). "Dark" renders dark regardless, which is what we VLM here. # NOTE: the persistence probe above left us DEEP in General settings, but # set_theme() navigates from the HOME sheet — so return HOME first, else its # nested and_enter_settings() misfires and the theme never actually changes. goto_home() set_theme("Dark") goto_home() vlm_assert("states_theme_dark", "Is the overall app background now DARK (near-black / very dark) with " "light-coloured text?", RESULTS_DIR, depth=3, jump_kind="transition", tag="color") # Restore the app's DEFAULT theme so no later test (in this or another lane) # inherits a forced Dark/Light surface: the default is "Follow system + Dark", # which on this light-mode emulator renders the light appearance every lane was # authored against. goto_home() set_theme("Follow system + Dark") goto_home()
@and_test(expects=("states_show_count_toggle", "states_show_count_thumb_vlm"))def test_show_notes_count_toggle_consequence(): """Flip the 'Show notes count' General setting -> its app-authored consequence: every tv_notes_count / tv_folder_notes_count node on the HOME sheet DISAPPEARS (they are present before, absent after). Then flip it back.""" launched_home() home_before = ui() counts_before = len(count_nodes(home_before)) if not and_enter_general_settings(): record("states_show_count_toggle", False, "setup_failed: could not reach General settings", depth=2, jump_kind="transition", expect="count nodes present -> absent") return snc = find_node(ui(), content_desc="Show notes count") or find_node_ci(ui(), "Show notes count") if snc is None: record("states_show_count_toggle", False, "feature_missing: no 'Show notes count' setting", depth=2, jump_kind="transition", expect="count nodes present -> absent") return # VLM the toggle's thumb BEFORE we flip it (it should read ON, thumb to the right). vlm_assert("states_show_count_thumb", "On the 'Show notes count' settings row, is there a switch whose thumb " "is toward the RIGHT / in the ON position (the track filled/coloured)?", RESULTS_DIR, depth=2, jump_kind="transition", tag="position") tap_node(snc) settle("tap") goto_home() home_after = ui() counts_after = len(count_nodes(home_after)) ok = counts_before >= 1 and counts_after == 0 record("states_show_count_toggle", ok, "" if ok else ("behavior_wrong: toggling 'Show notes count' did not hide " f"the HOME count nodes (before={counts_before}, " f"after={counts_after})"), depth=2, jump_kind="transition", expect="HOME note-count nodes present -> absent after toggling off") # Restore: flip it back ON. if and_enter_general_settings(): back_snc = find_node(ui(), content_desc="Show notes count") if back_snc: tap_node(back_snc) settle("tap") goto_home()
@and_test(expects=("states_show_count_persists",))def test_show_notes_count_persists_across_restart(): """SETTINGS PERSISTENCE: turn 'Show notes count' OFF, force_stop_and_relaunch(), and confirm the HOME count nodes are STILL absent (the mode survived process death). Then restore it ON.""" launched_home() if not and_enter_general_settings(): record("states_show_count_persists", False, "setup_failed: could not reach General settings", depth=2, jump_kind="transition", expect="counts hidden persists across relaunch") return snc = find_node(ui(), content_desc="Show notes count") if snc is None: record("states_show_count_persists", False, "feature_missing: no 'Show notes count' setting", depth=2, jump_kind="transition", expect="counts hidden persists across relaunch") return tap_node(snc) # turn OFF settle("tap") goto_home() hidden_before = len(count_nodes(ui())) == 0 relaunched_home() # kill + relaunch, no wipe hidden_after = len(count_nodes(ui())) == 0 ok = hidden_before and hidden_after record("states_show_count_persists", ok, "" if ok else ("behavior_wrong: 'Show notes count'=off did not persist " f"(hidden before restart={hidden_before}, " f"after={hidden_after})"), depth=2, jump_kind="transition", expect="HOME count nodes absent both before AND after relaunch") # Restore ON. if and_enter_general_settings(): back_snc = find_node(ui(), content_desc="Show notes count") if back_snc: tap_node(back_snc) settle("tap") goto_home()
# ══════════════════════════════════════════════════════════════════════════════# NOTES-VIEW dialog state (the folder's current sort/filter selections)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("states_notes_view_current_state",))def test_notes_view_current_state(): """Open the Notes-view dialog: it renders the folder's CURRENT view state — Filtering=Inclusive, Sorting=Creation date, Ordering=Descending, Grouping=None. Assert those current-state values are present (page-level state).""" launched_home() if not and_enter_folder("General") or not and_reach_notes_view(): record("states_notes_view_current_state", False, "setup_failed: could not open the Notes-view dialog", depth=1, jump_kind="value", expect="rows show Inclusive / Creation date / Descending / None") return nodes = ui() have = {t: find_node(nodes, text=t) is not None for t in ("Inclusive", "Creation date", "Descending", "None")} labels = all(find_node(nodes, content_desc=c) is not None for c in ("Filtering", "Sorting", "Ordering", "Grouping")) ok = labels and all(have.values()) record("states_notes_view_current_state", ok, "" if ok else ("behavior_wrong: Notes-view dialog missing a current-state " f"value (present={have}, labels={labels})"), depth=1, jump_kind="value", expect="Filtering=Inclusive, Sorting=Creation date, Ordering=Descending, Grouping=None")
@and_test(expects=("states_ordering_toggle",))def test_notes_view_ordering_toggle(): """In the Notes-view dialog, tapping the 'Ordering' row flips its value from 'Descending' -> 'Ascending' (an 'Ascending' TextView appears where there was none). A before->after value flip of the sort-order state.""" launched_home() if not and_enter_folder("General") or not and_reach_notes_view(): record("states_ordering_toggle", False, "setup_failed: could not open the Notes-view dialog", depth=1, jump_kind="transition", expect="Descending -> Ascending") return before = ui() asc_before = find_node(before, text="Ascending") is not None desc_before = find_node(before, text="Descending") is not None row = find_node(before, content_desc="Ordering") if row is None or not tap_node(row): record("states_ordering_toggle", False, "setup_failed: could not tap the Ordering row", depth=1, jump_kind="transition", expect="Descending -> Ascending") return settle("tap") after = ui() asc_after = find_node(after, text="Ascending") is not None ok = desc_before and not asc_before and asc_after record("states_ordering_toggle", ok, "" if ok else ("behavior_wrong: tapping Ordering did not flip the order " f"value (Ascending before={asc_before}, after={asc_after})"), depth=1, jump_kind="transition", expect="order value 'Descending' -> 'Ascending' (Ascending text appears)")
# ══════════════════════════════════════════════════════════════════════════════# READING-MODE paging state# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("states_reading_paging_position", "states_reading_paging_vlm"))def test_reading_mode_paging_position(): """Open a note in Reading Mode -> the tv_notes_count paging indicator renders the current page position as 'N / M Note(s)', starting at position 1. Assert that page-position state is present and begins at 1.""" launched_home() make_note("ReadOne", "reading body one") if not and_enter_folder("General"): record("states_reading_paging_position", False, "setup_failed: could not open the General folder", depth=3, jump_kind="value", expect="paging indicator at position 1 ('1 / M')") return if and_enter_selection("ReadOne") is None: record("states_reading_paging_position", False, "setup_failed: could not enter selection mode", depth=3, jump_kind="value", expect="paging indicator at position 1 ('1 / M')") return if not and_reach_note_options() or not and_reach_reading_mode(): record("states_reading_paging_position", False, "setup_failed: could not reach Reading Mode", depth=3, jump_kind="value", expect="paging indicator at position 1 ('1 / M')") return nodes = ui() ind = node_by_id(nodes, "tv_notes_count") desc = ind.get("content-desc", "") if ind else "" # Format "N / M Note(s)" at position 1. ok = ind is not None and desc.startswith("1 /") and "Note" in desc record("states_reading_paging_position", ok, "" if ok else ("behavior_wrong: Reading-Mode paging indicator not at " f"position 1 (desc={desc!r})"), depth=3, jump_kind="value", expect="tv_notes_count desc == '1 / M Note(s)' (paging at position 1)") vlm_assert("states_reading_paging", "In this full-screen reading view, near the top under the folder " "name, is a page-position indicator rendered showing something like " "'1 / 1 Note' or '1 / 2 Note'?", RESULTS_DIR, depth=3, jump_kind="value", tag="layout")
# ══════════════════════════════════════════════════════════════════════════════# FOCUS (SOLE owner of focus)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("states_body_focus",))def test_body_field_focus(): """Tap et_note_body -> it holds focus (focused='true') AND the soft keyboard is up (keyboard_visible()). We first move focus AWAY (tap the title) so the tap on the body is a genuine focus transition, not a no-op on the auto-focused field.""" launched_home() if not and_enter_folder("General") or not and_enter_editor(): record("states_body_focus", False, "setup_failed: could not reach the note editor", depth=2, jump_kind="transition", expect="body focused false -> true") return # Move focus to the title first so the body starts UNfocused. title = node_by_id(ui(), "et_note_title") if title is not None: tap_node(title) settle("keyboard") pre = ui() body_pre = node_by_id(pre, "et_note_body") before = body_pre.get("focused") if body_pre else None if body_pre is None or not tap_node(body_pre): record("states_body_focus", False, "setup_failed: could not tap the note body", depth=2, jump_kind="transition", expect="body focused false -> true") return settle("keyboard") post = ui() body_post = node_by_id(post, "et_note_body") after = body_post.get("focused") if body_post else None kbd = keyboard_visible() ok = before == "false" and after == "true" and kbd record("states_body_focus", ok, "" if ok else ("behavior_wrong: tapping the body did not focus it with the " f"keyboard up (focused {before}->{after}, keyboard={kbd})"), depth=2, jump_kind="transition", expect="et_note_body focused 'false' -> 'true'; soft keyboard visible")
@and_test(expects=("states_title_focus",))def test_title_field_focus_moves(): """A fab-created note auto-focuses the body; tapping et_note_title MOVES focus to the title — title focused='true', body focused='false' (focus is exclusive).""" launched_home() if not and_enter_folder("General") or not and_enter_editor(): record("states_title_focus", False, "setup_failed: could not reach the note editor", depth=2, jump_kind="transition", expect="focus moves body -> title") return pre = ui() title_pre = node_by_id(pre, "et_note_title") body_pre = node_by_id(pre, "et_note_body") body_foc_before = body_pre.get("focused") if body_pre else None if title_pre is None or not tap_node(title_pre): record("states_title_focus", False, "setup_failed: could not tap the title field", depth=2, jump_kind="transition", expect="focus moves body -> title") return settle("keyboard") post = ui() title_post = node_by_id(post, "et_note_title") body_post = node_by_id(post, "et_note_body") title_foc = title_post.get("focused") if title_post else None body_foc = body_post.get("focused") if body_post else None ok = body_foc_before == "true" and title_foc == "true" and body_foc == "false" record("states_title_focus", ok, "" if ok else ("behavior_wrong: focus did not move from body to title " f"(body was {body_foc_before}; now title={title_foc}, " f"body={body_foc})"), depth=2, jump_kind="transition", expect="et_note_title focused 'true' & et_note_body focused 'false'")
# ══════════════════════════════════════════════════════════════════════════════# HOME library-card accent colours (a persistent visual state of the home)# ══════════════════════════════════════════════════════════════════════════════
@and_test(expects=("states_home_cards", "states_home_cards_vlm"))def test_home_library_cards_state(): """The HOME sheet always shows its 4 library cards (All/Recent/Scheduled/ Archived), each a persistent shortcut. Rule half asserts the 4 titles are present; the VLM verifies each card carries a DISTINCT accent colour — a rendered state the dump cannot report.""" launched_home() nodes = ui() titles = {n.get("text") for n in nodes if n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_title"} ok = {"All", "Recent", "Scheduled", "Archived"} <= titles record("states_home_cards", ok, "" if ok else f"feature_missing: HOME library cards incomplete (saw {sorted(titles)})", depth=0, jump_kind="value", expect="All / Recent / Scheduled / Archived cards all present on HOME") vlm_assert("states_home_cards", "Near the top of this screen are four library cards. Do they have " "FOUR DISTINCT accent colours (for example blue, amber/yellow, red, " "and purple) rather than all being the same colour?", RESULTS_DIR, depth=0, jump_kind="value", tag="color")
# ══════════════════════════════════════════════════════════════════════════════TESTS = [ test_selection_turns_on, test_selection_turns_off, test_multiselect_two, test_selection_count_increment, test_all_label_chip_active, test_undo_enables_after_typing, test_redo_stays_disabled_after_typing, test_undo_history_disabled_on_fresh_note, test_theme_light_persists_across_restart, test_show_notes_count_toggle_consequence, test_show_notes_count_persists_across_restart, test_notes_view_current_state, test_notes_view_ordering_toggle, test_reading_mode_paging_position, test_body_field_focus, test_title_field_focus_moves, test_home_library_cards_state,]
if __name__ == "__main__": run_suite(TESTS, "states")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564#!/usr/bin/env python3"""STRUCTURE module — Noto (minimal note-taking app).
Lane ownership: (1) the GATE — the app launches and its top-level surfacesexist; (2) tree-SHAPE deltas — an interaction changes the view tree's SHAPE(subtree added/removed / surface_changed). No content strings, no computedvalues, no checked/selected/focus, no reachability-by-jump claims.
Invoke: python3 test_android_structure.py <PACKAGE> <RESULTS_DIR>"""import osimport sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,E402
# ── Local prompt handling ───────────────────────────────────────────────────LIBRARY_CARDS = ("All", "Recent", "Scheduled", "Archived")
def dismiss_prompts(): """Dismiss the first-run system notification-permission dialog (and any other stray prompt) that sits in front of the already-loaded Noto home.""" for _ in range(3): nodes = ui() b = (find_node_ci(nodes, "Don't allow") or find_node_ci(nodes, "Don’t allow") or find_node_ci(nodes, "Allow")) if b and is_safe(b): tap_node(b) settle("tap") continue break
def fresh_home(): """Deterministic virgin state: wipe data, relaunch, clear the perm prompt, return the HOME-sheet node tree.""" clear_data() launch_app() wait_for_foreground() dismiss_prompts() return ui()
# ── Depth-family helpers (names back the declared depth) ─────────────────────def and_enter_folder(nodes=None, name="General"): """HOME sheet -> tap a folder row -> FOLDER note-list. Returns (ok, nodes).""" nodes = ui() if nodes is None else nodes title = find_node(nodes, text=name) if title is None: return False, nodes if not tap_node(title): return False, nodes and_enter("folder") return True, ui()
def and_enter_editor(): """FOLDER -> fab 'Create note' -> NOTE editor. Assumes on a folder screen.""" nodes = ui() fab = find_node(nodes, content_desc="Create note") or node_by_id(nodes, "fab") if fab is None or not tap_node(fab): return False, nodes and_enter("editor") return True, ui()
def and_enter_settings(nodes): """HOME -> ib_settings -> SETTINGS (Compose).""" btn = node_by_id(nodes, "ib_settings") or find_node(nodes, content_desc="Settings") if btn is None or not tap_node(btn): return False, nodes and_enter("settings") return True, ui()
def and_reach_selection(row_node): """FOLDER note row -> long-press -> selection mode. Counts one surface. Returns (ok, selection_nodes).""" if row_node is None or not long_press(row_node): return False, ui() and_enter("selection") return True, ui()
def and_enter_note_options(sel_nodes): """selection -> fab_selection 'More options' -> Note-options sheet.""" fs = node_by_id(sel_nodes, "fab_selection") or find_node(sel_nodes, content_desc="More options") if fs is None or not tap_node(fs): return False, ui() and_enter("note_options") return True, ui()
def and_enter_reading_mode(opt_nodes): """Note options -> 'Reading Mode' (tv_open_in) -> reading mode; dismiss the first-run immersive 'Got it' cling if it appears.""" rm = node_by_id(opt_nodes, "tv_open_in") or find_node_ci(opt_nodes, "Reading Mode") if rm is None or not tap_node(rm): return False, ui() and_enter("reading_mode") settle("tap") cling = find_node_ci(ui(), "Got it") if cling and is_safe(cling): tap_node(cling) settle("tap") return True, ui()
def make_one_note(title="StructNote", body="alpha beta"): """From a FRESH folder screen, create a single note. Auto-save persists it on Back, which returns to the HOME sheet; this re-opens the folder so the note row is visible. Returns (ok, folder_nodes).""" ok, _ = and_enter_editor() if not ok: return False, ui() nodes = ui() et_title = node_by_id(nodes, "et_note_title") et_body = node_by_id(nodes, "et_note_body") if et_title is None or et_body is None: return False, ui() type_text(et_title, title) type_text(et_body, body) hide_keyboard() # MUST precede back(): back() with the keyboard up back() # only dismisses the keyboard, not the editor. settle("tap") nodes = ui() if node_by_id(nodes, "tv_dialog_title") is not None: # landed on HOME sheet ok_f, nodes = and_enter_folder(nodes) if not ok_f: return False, nodes return True, nodes
def find_note_row(nodes, title): """The note-list row is a tv_note_title TextView carrying the note title.""" for n in nodes: if (n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_note_title" and n.get("text") == title): return n return None
def open_folder_from_fresh(name="General"): """fresh_home() then enter the named folder. Returns (ok, folder_nodes).""" nodes = fresh_home() return and_enter_folder(nodes, name)
# ════════════════════════════════════════════════════════════════════════════# GATE tests (jump_kind="none", depth=0) — kept few (<=30%)# ════════════════════════════════════════════════════════════════════════════
@and_test(expects=("structure_gate_home_sheet",))def test_gate_home_sheet(): """App launches -> HOME bottom sheet exists: title + a library card + fab.""" if not device_online(): record("structure_gate_home_sheet", False, "setup_failed: device/tunnel offline", depth=0, jump_kind="none") return nodes = fresh_home() title = node_by_id(nodes, "tv_dialog_title") has_card = any(find_node(nodes, text=t) for t in LIBRARY_CARDS) fab = node_by_id(nodes, "fab") or find_node(nodes, content_desc="Create folder") ok = bool(wait_for_foreground()) and bool(title) and has_card and bool(fab) record("structure_gate_home_sheet", ok, "" if ok else "setup_failed: HOME sheet (title + card + fab) not present", depth=0, jump_kind="none")
@and_test(expects=("structure_gate_default_folder",))def test_gate_default_folder(): """Fresh launch shows the default 'General' folder row (tv_folder_title).""" nodes = fresh_home() titles = [n.get("text", "") for n in nodes if n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_folder_title"] ok = "General" in titles record("structure_gate_default_folder", ok, "" if ok else "feature_missing: default 'General' folder row absent", depth=0, jump_kind="none")
@and_test(expects=("structure_gate_library_grid_count",))def test_gate_library_grid_count(): """HOME sheet has the 4 library-card shortcut subtree (SHAPE, not values): all 4 shortcut cards {All,Recent,Scheduled,Archived} present.""" nodes = fresh_home() present = [t for t in LIBRARY_CARDS if find_node(nodes, text=t)] ok = len(present) >= 4 record("structure_gate_library_grid_count", ok, "" if ok else f"feature_missing: only {len(present)}/4 library cards present", depth=0, jump_kind="none")
# ════════════════════════════════════════════════════════════════════════════# SHAPE-DELTA tests (the bulk) — trigger an interaction, assert the tree SHAPE# changed.# ════════════════════════════════════════════════════════════════════════════
@and_test(expects=("structure_folder_replaces_home",))def test_folder_replaces_home(): """Tap 'General' -> FOLDER note-list subtree REPLACES the HOME-sheet subtree. surface_changed True AND the folder screen adds notes_view + fab 'Create note' + bottom-bar 'Folders' that HOME lacked.""" nodes = fresh_home() before = and_showing(nodes) home_had_notesview = node_by_id(nodes, "notes_view") is not None ok_tap, fnodes = and_enter_folder(nodes, "General") after = and_showing(fnodes) notes_view = node_by_id(fnodes, "notes_view") or find_node(fnodes, content_desc="Notes view") create_note = find_node(fnodes, content_desc="Create note") folders_btn = find_node(fnodes, content_desc="Folders") added = bool(notes_view) and bool(create_note) and bool(folders_btn) changed = surface_changed(before, after) ok = ok_tap and changed and added and not home_had_notesview record("structure_folder_replaces_home", ok, "" if ok else "behavior_wrong: folder note-list subtree did not replace home sheet", depth=1, jump_kind="transition", expect="folder note-list subtree (notes_view/fab Create note/Folders bar) replaces home sheet")
@and_test(expects=("structure_editor_subtree_appears",))def test_editor_subtree_appears(): """FOLDER -> fab 'Create note' -> NOTE editor subtree appears: et_note_title + et_note_body + bab_toolbar with 4 toolbar ImageButtons. Absent BEFORE.""" ok_folder, fnodes = open_folder_from_fresh("General") before_title = node_by_id(fnodes, "et_note_title") ok_editor, enodes = and_enter_editor() et_title = node_by_id(enodes, "et_note_title") et_body = node_by_id(enodes, "et_note_body") toolbar = node_by_id(enodes, "bab_toolbar") tb_buttons = [node_by_id(enodes, r) for r in ("ib_undo_history", "ib_undo", "ib_redo", "ib_redo_history")] n_buttons = sum(1 for b in tb_buttons if b is not None) ok = (ok_folder and ok_editor and before_title is None and et_title is not None and et_body is not None and toolbar is not None and n_buttons == 4) record("structure_editor_subtree_appears", ok, "" if ok else "behavior_wrong: editor subtree (title/body/4-button toolbar) did not appear", depth=2, jump_kind="transition", expect="et_note_title+et_note_body+bab_toolbar(4 ImageButtons) appear only after fab Create note")
@and_test(expects=("structure_selection_bar_appears",))def test_selection_bar_appears(): """Create a note, LONG-PRESS its row -> selection action-bar subtree appears. 'archive' also lives on the plain folder bar, so the selection-UNIQUE ids (add_reminder/pin/share/fab_selection) are what must go absent->present.""" sel_ids = ("add_reminder", "pin", "share", "fab_selection") ok_folder, _ = open_folder_from_fresh("General") made, fnodes = make_one_note("SelNote", "one two") row = find_note_row(fnodes, "SelNote") if row is None: scroll_into_view("SelNote") row = find_note_row(ui(), "SelNote") before_nodes = ui() n_before = sum(1 for r in sel_ids if node_by_id(before_nodes, r) is not None) ok_sel, anodes = and_reach_selection(row) n_after = sum(1 for r in sel_ids if node_by_id(anodes, r) is not None) ok = ok_folder and made and ok_sel and n_before == 0 and n_after == len(sel_ids) record("structure_selection_bar_appears", ok, "" if ok else f"behavior_wrong: selection action-bar subtree not added by long-press " f"(before={n_before}, after={n_after})", depth=1, jump_kind="transition", expect="selection bar (add_reminder/pin/share/fab_selection) absent->present on long-press")
@and_test(expects=("structure_notesview_sheet_appears",))def test_notesview_sheet_appears(): """FOLDER -> notes_view -> a bottom-sheet subtree appears (rows Filtering/ Sorting/Apply). surface_changed True vs the folder screen.""" ok_folder, fnodes = open_folder_from_fresh("General") before = and_showing(fnodes) btn = node_by_id(fnodes, "notes_view") or find_node(fnodes, content_desc="Notes view") tapped = tap_node(btn) if btn else False and_enter("notes_view") anodes = ui() after = and_showing(anodes) has_rows = (find_node_ci(anodes, "Filtering") is not None and find_node_ci(anodes, "Sorting") is not None and find_node_ci(anodes, "Apply") is not None) ok = ok_folder and tapped and surface_changed(before, after) and has_rows record("structure_notesview_sheet_appears", ok, "" if ok else "behavior_wrong: Notes-view dialog subtree (Filtering/Sorting/Apply) did not appear", depth=1, jump_kind="transition", expect="notes-view bottom-sheet subtree (Filtering/Sorting/Apply rows) added over folder screen")
@and_test(expects=("structure_newfolder_dialog_appears",))def test_newfolder_dialog_appears(): """HOME -> fab 'Create folder' -> New-folder dialog subtree appears (et Title field + btn_create). surface_changed True.""" nodes = fresh_home() before = and_showing(nodes) fab = node_by_id(nodes, "fab") or find_node(nodes, content_desc="Create folder") tapped = tap_node(fab) if fab else False and_enter("new_folder") anodes = ui() after = and_showing(anodes) et = node_by_id(anodes, "et") btn_create = node_by_id(anodes, "btn_create") title = find_node_ci(anodes, "New folder") ok = (tapped and surface_changed(before, after) and et is not None and btn_create is not None and title is not None) record("structure_newfolder_dialog_appears", ok, "" if ok else "behavior_wrong: New-folder dialog subtree (et Title + btn_create) did not appear", depth=1, jump_kind="transition", expect="new-folder dialog subtree (et Title field + btn_create) added over home sheet")
@and_test(expects=("structure_note_options_sheet_appears",))def test_note_options_sheet_appears(): """selection -> fab_selection 'More options' -> Note-options sheet appears (tv_dialog_title 'Note options' + many action rows). Assert the count of clickable rows increased and >=5 named option rows are present.""" ok_folder, _ = open_folder_from_fresh("General") made, fnodes = make_one_note("OptNote", "a b") row = find_note_row(fnodes, "OptNote") or (scroll_into_view("OptNote") and find_note_row(ui(), "OptNote")) ok_sel, sel_nodes = and_reach_selection(row) n_before = len([n for n in sel_nodes if n.get("clickable") == "true"]) ok_opt, onodes = and_enter_note_options(sel_nodes) title = node_by_id(onodes, "tv_dialog_title") is_options = bool(title and title.get("text", "") == "Note options") option_rows = [node_by_id(onodes, r) for r in ("tv_open_in", "tv_pin_note", "tv_share_note", "tv_duplicate_note", "tv_copy_to_clipboard", "tv_move_note")] n_options = sum(1 for r in option_rows if r is not None) n_after = len([n for n in onodes if n.get("clickable") == "true"]) ok = (ok_folder and made and ok_sel and ok_opt and is_options and n_options >= 5 and n_after > n_before) record("structure_note_options_sheet_appears", ok, "" if ok else f"behavior_wrong: Note-options sheet subtree did not appear / rows not increased " f"(options={n_options}, clickable {n_before}->{n_after})", depth=2, jump_kind="transition", expect="Note options sheet ('Note options' title + >=5 action rows), clickable count increases")
@and_test(expects=("structure_reading_mode_subtree",))def test_reading_mode_subtree(): """Note options -> 'Reading Mode' -> reading-mode subtree (fab_next + fab_previous + fab 'Edit') appears.""" ok_folder, _ = open_folder_from_fresh("General") made, fnodes = make_one_note("ReadNote", "x y") row = find_note_row(fnodes, "ReadNote") or (scroll_into_view("ReadNote") and find_note_row(ui(), "ReadNote")) ok_sel, sel_nodes = and_reach_selection(row) ok_opt, onodes = and_enter_note_options(sel_nodes) ok_read, rnodes = and_enter_reading_mode(onodes) fab_next = node_by_id(rnodes, "fab_next") or find_node(rnodes, content_desc="Next") fab_prev = node_by_id(rnodes, "fab_previous") or find_node(rnodes, content_desc="Previous") fab_edit = find_node(rnodes, content_desc="Edit") ok = (ok_folder and made and ok_sel and ok_opt and ok_read and fab_next is not None and fab_prev is not None and fab_edit is not None) record("structure_reading_mode_subtree", ok, "" if ok else "behavior_wrong: reading-mode subtree (fab_next/fab_previous/fab Edit) did not appear", depth=3, jump_kind="transition", expect="reading-mode subtree fab_next+fab_previous+fab 'Edit' appears after Reading Mode")
@and_test(expects=("structure_settings_list_appears",))def test_settings_list_appears(): """HOME -> ib_settings -> Settings list subtree appears (rows incl. 'General' and 'About'). surface_changed True.""" nodes = fresh_home() before = and_showing(nodes) ok_settings, snodes = and_enter_settings(nodes) after = and_showing(snodes) has_general = find_node_ci(snodes, "General") is not None has_about = find_node_ci(snodes, "About") is not None ok = ok_settings and surface_changed(before, after) and has_general and has_about record("structure_settings_list_appears", ok, "" if ok else "behavior_wrong: Settings list subtree (General/About rows) did not appear", depth=1, jump_kind="transition", expect="Settings list subtree (rows incl. General + About) replaces home sheet")
@and_test(expects=("structure_general_settings_rows",))def test_general_settings_rows(): """Settings -> 'General' -> General-settings rows subtree appears (rows incl. 'Theme' and 'Language'). surface_changed vs the Settings list.""" nodes = fresh_home() ok_settings, snodes = and_enter_settings(nodes) before = and_showing(snodes) gen = find_node_ci(snodes, "General") tapped = tap_node(gen) if gen else False and_enter("general") gnodes = ui() after = and_showing(gnodes) has_theme = (find_node_ci(gnodes, "Theme") is not None or scroll_into_view("Theme") is not None) has_language = (find_node_ci(ui(), "Language") is not None or scroll_into_view("Language") is not None) ok = ok_settings and tapped and surface_changed(before, after) and has_theme and has_language record("structure_general_settings_rows", ok, "" if ok else "behavior_wrong: General-settings rows subtree (Theme/Language) did not appear", depth=2, jump_kind="transition", expect="General-settings rows subtree (rows incl. Theme + Language) appears")
@and_test(expects=("structure_editor_toolbar_shape",))def test_editor_toolbar_shape(): """Open the editor as the trigger, then assert the toolbar bab_toolbar has a FIXED shape: exactly the 4 ImageButtons row (undo_history/undo/redo/redo_history).""" ok_folder, fnodes = open_folder_from_fresh("General") before = node_by_id(fnodes, "bab_toolbar") ok_editor, enodes = and_enter_editor() toolbar = node_by_id(enodes, "bab_toolbar") ids = ("ib_undo_history", "ib_undo", "ib_redo", "ib_redo_history") present = [node_by_id(enodes, r) for r in ids] n_present = sum(1 for b in present if b is not None) all_imgbtn = all(b is not None and "ImageButton" in b.get("class", "") for b in present) ok = (ok_folder and ok_editor and before is None and toolbar is not None and n_present == 4 and all_imgbtn) record("structure_editor_toolbar_shape", ok, "" if ok else f"behavior_wrong: editor toolbar shape wrong " f"({n_present}/4 ImageButtons, all_imgbtn={all_imgbtn})", depth=2, jump_kind="transition", expect="bab_toolbar contains exactly 4 ImageButtons (undo_history/undo/redo/redo_history)")
# ════════════════════════════════════════════════════════════════════════════# VLM tests — EXACTLY 8 records. Navigate to the correct screen, then screenshot# and ask a specific YES/NO rendered-property question phrased from what the# original actually renders (verified from live screenshots).# ════════════════════════════════════════════════════════════════════════════
@and_test(expects=("structure_home_grid_vlm",))def test_home_grid_vlm(): """HOME shows a 2x2 grid of FOUR library cards.""" fresh_home() vlm_assert("structure_home_grid", "In the lower white panel of this note-taking app, is there a 2 by 2 " "grid of exactly four rectangular cards labelled All, Recent, " "Scheduled and Archived?", RESULTS_DIR, depth=0, jump_kind="none", tag="layout")
@and_test(expects=("structure_home_cards_color_vlm",))def test_home_cards_color_vlm(): """The four library cards are color-coded (each a different accent color on its border/icon/label). Verified render: outlined cards, All=blue, Recent=amber, Scheduled=red, Archived=purple.""" fresh_home() vlm_assert("structure_home_cards_color", "Are the four library cards color-coded so that each card's outline, " "icon and label use a DIFFERENT accent color (one blue, one " "amber/orange, one red, one purple)?", RESULTS_DIR, depth=0, jump_kind="none", tag="color")
@and_test(expects=("structure_home_fab_position_vlm",))def test_home_fab_position_vlm(): """The 'Create folder' action button (a dark rounded-square with a folder+add icon) sits in the bottom-right corner of HOME.""" fresh_home() vlm_assert("structure_home_fab_position", "Is there a solid dark (black) rounded-square floating button " "showing a small plus/add icon in the BOTTOM-RIGHT corner of the " "screen?", RESULTS_DIR, depth=0, jump_kind="none", tag="position")
@and_test(expects=("structure_editor_title_above_body_vlm",))def test_editor_title_above_body_vlm(): """Note editor: the Title field is ABOVE the Body field.""" open_folder_from_fresh("General") and_enter_editor() vlm_assert("structure_editor_title_above_body", "In this note editor, is the single-line 'Title' input field " "positioned ABOVE the larger multi-line 'Body' input area?", RESULTS_DIR, depth=2, jump_kind="none", tag="position")
@and_test(expects=("structure_editor_toolbar_row_vlm",))def test_editor_toolbar_row_vlm(): """Note editor: a horizontal row of exactly 4 toolbar icons sits just above the on-screen keyboard (verified: undo-history/undo/redo/redo-history).""" open_folder_from_fresh("General") and_enter_editor() # editor auto-focuses Title -> keyboard is up vlm_assert("structure_editor_toolbar_row", "Just ABOVE the on-screen keyboard on this note editor, is there a " "single horizontal row of exactly four evenly spaced icon buttons " "(undo/redo style arrows)?", RESULTS_DIR, depth=2, jump_kind="none", tag="position")
@and_test(expects=("structure_reading_mode_fullscreen_vlm",))def test_reading_mode_fullscreen_vlm(): """Reading mode is a full-screen / immersive layout: the note title and body render as static text on a mostly-empty page, with only a small edit FAB and prev/next arrows for chrome.""" open_folder_from_fresh("General") made, fnodes = make_one_note("VlmRead", "hello world here") row = find_note_row(fnodes, "VlmRead") or (scroll_into_view("VlmRead") and find_note_row(ui(), "VlmRead")) ok_sel, sel_nodes = and_reach_selection(row) if ok_sel: ok_opt, onodes = and_enter_note_options(sel_nodes) if ok_opt: and_enter_reading_mode(onodes) vlm_assert("structure_reading_mode_fullscreen", "Does this screen show the note's title and text as static " "(non-editable) content on a large, mostly empty full-screen page " "with no 'Title'/'Body' input boxes and no on-screen keyboard?", RESULTS_DIR, depth=3, jump_kind="none", tag="layout")
@and_test(expects=("structure_folder_label_row_vlm",))def test_folder_label_row_vlm(): """On the folder screen, the label filter row (an 'All' chip + add-label button) sits directly under the folder title/subtitle.""" open_folder_from_fresh("General") vlm_assert("structure_folder_label_row", "Directly beneath the folder's 'General' title and note-count, is " "there a horizontal row with a filled dark pill labelled 'All' next " "to a small outlined add (+) button?", RESULTS_DIR, depth=1, jump_kind="none", tag="position")
@and_test(expects=("structure_newfolder_swatches_vlm",))def test_newfolder_swatches_vlm(): """The New-folder dialog shows a row of colored circular color-swatches.""" nodes = fresh_home() fab = node_by_id(nodes, "fab") or find_node(nodes, content_desc="Create folder") if fab: tap_node(fab) and_enter("new_folder") vlm_assert("structure_newfolder_swatches", "In this 'New folder' dialog, under a 'Color' label, is there a row " "of several small circular color swatches in different colors?", RESULTS_DIR, depth=1, jump_kind="none", tag="shape")
# ── Registry & entrypoint ────────────────────────────────────────────────────TESTS = [ # GATE test_gate_home_sheet, test_gate_default_folder, test_gate_library_grid_count, # SHAPE deltas test_folder_replaces_home, test_editor_subtree_appears, test_selection_bar_appears, test_notesview_sheet_appears, test_newfolder_dialog_appears, test_note_options_sheet_appears, test_reading_mode_subtree, test_settings_list_appears, test_general_settings_rows, test_editor_toolbar_shape, # VLM (exactly 8) test_home_grid_vlm, test_home_cards_color_vlm, test_home_fab_position_vlm, test_editor_title_above_body_vlm, test_editor_toolbar_row_vlm, test_reading_mode_fullscreen_vlm, test_folder_label_row_vlm, test_newfolder_swatches_vlm,]
if __name__ == "__main__": run_suite(TESTS, "structure")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719#!/usr/bin/env python3"""TEXT module — Noto (minimal note-taking app).
Lane ownership: CONTENT / OUTPUT text, and the SOLE owner of exact-stringequality. Every test drives the app through the real user path and then reads thePRODUCED string out of a fresh ui(), asserting it matches what the originalrenders — a dynamic count string ("1 Note" vs "2 Notes"), a status/subtitle linethat a trigger creates (" • 1 Selected"), an empty-state / no-match placeholder,an input HINT, an icon control's content-desc, echoed user text, and thereading-mode paging label. The discriminating half is the CHANGE: the string isABSENT before the trigger and PRESENT after, so a dead shell that clones thelayout but implements nothing FAILS.
What this lane does NOT assert (ceded): the numeric word/note COUNT (computation —we assert the singular/plural WORDING, never the number), a checked/selected bit(states), pure reachability or tree shape (navigation / structure), whether arecord survives a kill (interaction/data). A label we TAP to navigate isnavigation's trigger; the same label ASSERTED as content is ours.
VERIFIED LIVE before authoring (character-for-character, on com.noto.debug): * Empty folder: tv_placeholder text == "Folder is empty." * Search no-match (query "zzzznomatch"): tv_placeholder text == "No notes found containing the search term." (trailing period). The matching note row DISAPPEARS during the query and returns when it is cleared. * Folder subtitle tv_folder_notes_count content-desc == "0 Notes" (empty) / "1 Note" (singular) / "2 Notes" (plural). * HOME sheet tv_folders_count content-desc == "0 Folders" on a cleared install (the default General folder is excluded). * Long-press a note -> subtitle content-desc == "1 Note • 1 Selected" (bullet U+2022) where none was. * A fab-created note: tv_created_at text == "Created just now", tv_accessed_at text == "Accessed just now"; empty editor et_note_title hint == "Title", et_note_body hint == "Body". * A typed note echoes verbatim in its folder row (tv_note_title / tv_note_body) and again in Reading Mode (drawn read-only text). * Reading Mode (long-press -> More options -> "Reading Mode") is scoped to the single opened note, so tv_notes_count content-desc == "1 / 1 Note". * fab content-desc == "Create note" (in a folder) / "Create folder" (on HOME); Settings screen title == "Settings"; Note-options sheet row == "Reading Mode".
VLM budget for this file: EXACTLY 3 vlm_assert records (2 fine-grained position +1 content), reserved for text that is either drawn read-only (reading mode) orwhose POSITION on screen adds real signal a dump cannot give.
Invoke: python3 test_android_text.py <PACKAGE> <RESULTS_DIR>"""import osimport sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))from android_testgen_kit import * # noqa: F403,E402
# ══════════════════════════════════════════════════════════════════════════════# Local setup helpers# ══════════════════════════════════════════════════════════════════════════════
def dismiss_prompts(): """Dismiss the first-run system notification-permission dialog (and any stray prompt) sitting in front of the already-loaded Noto home. Both ASCII "Don't allow" and the curly-apostrophe "Don't allow" (U+2019) are matched. It can reappear on a plain relaunch, so call it after every launch/restart.""" for _ in range(3): nodes = ui() b = (find_node_ci(nodes, "Don't allow") or find_node_ci(nodes, "Don’t allow") or find_node_ci(nodes, "Allow")) if b and is_safe(b): tap_node(b) settle("tap") continue break
def fresh_home(): """Kill + relaunch (data kept), dismiss any prompt, land on the HOME sheet.""" restart_app() wait_for_foreground() dismiss_prompts() return ui()
def clean_home(): """pm clear -> virgin install (default General folder, 0 notes, 0 folders), dismiss the first-run prompt, land on the HOME sheet.""" clear_data() launch_app() wait_for_foreground() dismiss_prompts() return ui()
def on_home_sheet(nodes=None): nodes = ui() if nodes is None else nodes return node_by_id(nodes, "tv_dialog_title") is not None
def all_text(nodes): return " | ".join(n.get("text", "") for n in nodes if n.get("text"))
def norm(s): return (s or "").strip().casefold()
def subtitle_desc(nodes=None): """The folder-view subtitle content-desc (note count / selection / paging).""" nodes = ui() if nodes is None else nodes n = node_by_id(nodes, "tv_folder_notes_count") or node_by_id(nodes, "tv_notes_count") return n.get("content-desc", "") if n else ""
def note_rows(nodes): return [n for n in nodes if n.get("resource-id", "").rsplit("/", 1)[-1] == "tv_note_title"]
# ── Depth-backing navigation helpers (named and_enter_*/and_reach_* so the audit# attributes each declared depth to a real navigation call). ─────────────────
def and_enter_folder(name="General"): """HOME sheet -> tap a folder row -> its note-list surface. Counts one surface. Returns True when the folder title is showing.""" n = find_node(ui(), text=name) if n is None or not tap_node(n): return False settle("tap") and_enter("folder:" + name) tit = node_by_id(ui(), "tv_folder_title") return tit is not None and tit.get("text") == name
def and_enter_editor(): """FOLDER note-list -> fab 'Create note' -> the note editor. Counts one surface. Returns True when et_note_title is present.""" fab = find_node(ui(), content_desc="Create note") if fab is None or not tap_node(fab): return False settle("tap") and_enter("editor") return node_by_id(ui(), "et_note_title") is not None
def and_enter_search(): """FOLDER note-list -> bottom-bar 'Search' -> the search surface. Counts one surface. Returns True when the et_search field is present.""" s = find_node(ui(), content_desc="Search") if s is None or not tap_node(s): return False settle("tap") and_enter("search") return node_by_id(ui(), "et_search") is not None
def and_enter_selection(title=None): """FOLDER note-list -> LONG-PRESS a note row -> selection mode. Counts one surface. Returns the note node long-pressed (or None).""" nodes = ui() note = (find_node(nodes, text=title) if title else None) or ( note_rows(nodes)[0] if note_rows(nodes) else None) if note is None or not long_press(note): return None settle("tap") and_enter("selection") return note
def and_reach_note_options(): """SELECTION mode -> fab_selection 'More options' -> the Note-options bottom sheet. Counts one surface. Returns True when the sheet title shows.""" mo = node_by_id(ui(), "fab_selection") or find_node(ui(), content_desc="More options") if mo is None or not tap_node(mo): return False settle("tap") and_enter("note_options") t = node_by_id(ui(), "tv_dialog_title") return t is not None and norm(t.get("text")) == norm("Note options")
def and_reach_reading_mode(): """Note-options sheet -> 'Reading Mode' row -> the reading surface. Counts one surface. Dismisses the first-run immersive cling if it appears. Returns True when the reading paging label (tv_notes_count) is present.""" rm = find_node_ci(ui(), "Reading Mode") or node_by_id(ui(), "tv_open_in") if rm is None or not tap_node(rm): return False settle("tap") and_enter("reading_mode") got = find_node_ci(ui(), "Got it") or node_by_id(ui(), "ok") if got and is_safe(got): tap_node(got) settle("tap") return node_by_id(ui(), "tv_notes_count") is not None
def and_enter_settings(): """HOME sheet -> ib_settings 'Settings' -> the Settings list. Counts one surface. Returns True when the 'General' row is present.""" s = node_by_id(ui(), "ib_settings") or find_node(ui(), content_desc="Settings") if s is None or not tap_node(s): return False settle("tap") and_enter("settings") return (find_node(ui(), content_desc="General") is not None or find_node(ui(), text="General") is not None)
# ── Note-authoring helper (drives the real user path; Back auto-saves) ─────────
def create_note_in_general(title, body=""): """From a fresh HOME sheet: open General, fab a new note, type title/body, hide the keyboard and Back (auto-save -> HOME sheet). Returns True on success. Assumes the caller has already reached a HOME sheet.""" if not and_enter_folder("General"): return False if not and_enter_editor(): return False t = node_by_id(ui(), "et_note_title") if t is None or not type_text(t, title): return False if body: b = node_by_id(ui(), "et_note_body") if b is not None: type_text(b, body) hide_keyboard() back() # auto-save; from a fab note -> HOME sheet settle("tap") and_reset_depth() return on_home_sheet()
# ══════════════════════════════════════════════════════════════════════════════# Tests# ════════════════════════════════════════════════════════════════���═════════════
@and_test(expects=("text_empty_folder_placeholder", "text_empty_folder_placeholder_vlm"))def test_empty_folder_placeholder(): """A cleared General folder shows the empty-state placeholder verbatim.""" clean_home() if not and_enter_folder("General"): record("text_empty_folder_placeholder", False, "setup_failed: could not open the General folder from HOME", depth=1, jump_kind="value", expect="placeholder 'Folder is empty.'") return ph = node_by_id(ui(), "tv_placeholder") got = ph.get("text", "") if ph else "" ok = norm(got) == norm("Folder is empty.") record("text_empty_folder_placeholder", ok, "" if ok else f"behavior_wrong: empty-folder placeholder was {got!r}, " f"expected 'Folder is empty.'", depth=1, jump_kind="value", expect="placeholder text == 'Folder is empty.'") vlm_assert("text_empty_folder_placeholder", "Is a short single-line message like 'Folder is empty.' shown " "roughly centered in the middle of an otherwise blank note list " "(not at the top or bottom)?", RESULTS_DIR, tag="position")
@and_test(expects=("text_search_nomatch_placeholder",))def test_search_nomatch_placeholder(): """Searching a term no note contains shows the no-match placeholder verbatim, where the empty-folder placeholder was NOT (before/after string).""" clean_home() if not and_enter_folder("General"): record("text_search_nomatch_placeholder", False, "setup_failed: could not open the General folder", depth=2, jump_kind="value", expect="placeholder == 'No notes found containing the search term.'") return if not and_enter_search(): record("text_search_nomatch_placeholder", False, "setup_failed: could not open the search surface", depth=2, jump_kind="value", expect="placeholder == 'No notes found containing the search term.'") return before = node_by_id(ui(), "tv_placeholder") absent = norm(before.get("text") if before else "") != norm( "No notes found containing the search term.") et = node_by_id(ui(), "et_search") type_text(et, "zzzznomatch") settle("tap") after = node_by_id(ui(), "tv_placeholder") got = after.get("text", "") if after else "" present = norm(got) == norm("No notes found containing the search term.") ok = absent and present record("text_search_nomatch_placeholder", ok, "" if ok else f"behavior_wrong: no-match placeholder was {got!r}, " f"expected 'No notes found containing the search term.'", depth=2, jump_kind="value", expect="placeholder == 'No notes found containing the search term.'")
@and_test(expects=("text_search_clears_note_returns",))def test_search_clears_note_returns(): """A matching note row is PRESENT in the folder, ABSENT while a non-matching query is typed, and PRESENT again once the query is cleared (string flip).""" clean_home() if not create_note_in_general("AlphaFindMe", "body text"): record("text_search_clears_note_returns", False, "setup_failed: could not create the seed note", depth=2, jump_kind="transition", expect="note row 'AlphaFindMe' toggles absent<->present with search") return if not and_enter_folder("General"): record("text_search_clears_note_returns", False, "setup_failed: could not reopen the General folder", depth=2, jump_kind="transition", expect="note row 'AlphaFindMe' toggles absent<->present with search") return present_before = find_node(ui(), text="AlphaFindMe") is not None if not and_enter_search(): record("text_search_clears_note_returns", False, "setup_failed: could not open search", depth=2, jump_kind="transition", expect="note row 'AlphaFindMe' toggles absent<->present with search") return et = node_by_id(ui(), "et_search") type_text(et, "zzzznomatch") settle("tap") absent_during = find_node(ui(), text="AlphaFindMe") is None # The search-field end icon (content-desc "Clear") empties the QUERY box only; # it is the input-clear affordance, not a destructive data action, so tap it # directly (safe_tap/is_safe would veto it on the "clear" substring). clr = node_by_id(ui(), "text_input_end_icon") or find_node(ui(), content_desc="Clear") cleared = tap_node(clr) if clr else False if cleared: settle("tap") # The note list is a RecyclerView: after the query is cleared it re-populates # over a frame or two, so a single dump can catch it mid-recycle. Re-dump a # bounded number of times for the restored row rather than reading only once. present_after = False for _ in range(4): if find_node(ui(), text="AlphaFindMe") is not None: present_after = True break settle("tap") ok = present_before and absent_during and cleared and present_after record("text_search_clears_note_returns", ok, "" if ok else "behavior_wrong: note row did not toggle " f"absent/present with the search query " f"(before={present_before}, during={absent_during}, " f"cleared={cleared}, after={present_after})", depth=2, jump_kind="transition", expect="'AlphaFindMe' present -> absent (nomatch) -> present (cleared)")
@and_test(expects=("text_folder_count_singular",))def test_folder_count_singular(): """After exactly ONE note, the folder subtitle uses the SINGULAR wording '1 Note' (not '1 Notes') — this is the string, not the number.""" clean_home() if not create_note_in_general("OnlyNoteHere"): record("text_folder_count_singular", False, "setup_failed: could not create the single note", depth=1, jump_kind="value", expect="subtitle desc == '1 Note'") return if not and_enter_folder("General"): record("text_folder_count_singular", False, "setup_failed: could not reopen the General folder", depth=1, jump_kind="value", expect="subtitle desc == '1 Note'") return got = subtitle_desc() ok = norm(got) == norm("1 Note") record("text_folder_count_singular", ok, "" if ok else f"behavior_wrong: singular subtitle was {got!r}, " f"expected '1 Note'", depth=1, jump_kind="value", expect="subtitle content-desc == '1 Note'")
@and_test(expects=("text_folder_count_plural",))def test_folder_count_plural(): """After TWO notes, the folder subtitle uses the PLURAL wording '2 Notes'.""" clean_home() if not create_note_in_general("FirstNoteAA"): record("text_folder_count_plural", False, "setup_failed: could not create the first note", depth=1, jump_kind="value", expect="subtitle desc == '2 Notes'") return if not create_note_in_general("SecondNoteBB"): record("text_folder_count_plural", False, "setup_failed: could not create the second note", depth=1, jump_kind="value", expect="subtitle desc == '2 Notes'") return if not and_enter_folder("General"): record("text_folder_count_plural", False, "setup_failed: could not reopen the General folder", depth=1, jump_kind="value", expect="subtitle desc == '2 Notes'") return got = subtitle_desc() ok = norm(got) == norm("2 Notes") record("text_folder_count_plural", ok, "" if ok else f"behavior_wrong: plural subtitle was {got!r}, " f"expected '2 Notes'", depth=1, jump_kind="value", expect="subtitle content-desc == '2 Notes'")
@and_test(expects=("text_home_folders_count_zero",))def test_home_folders_count_zero(): """On a virgin install the HOME sheet folders count reads '0 Folders' (the default General folder is excluded from the count wording).""" clean_home() n = node_by_id(ui(), "tv_folders_count") got = n.get("content-desc", "") if n else "" ok = norm(got) == norm("0 Folders") record("text_home_folders_count_zero", ok, "" if ok else f"behavior_wrong: HOME folders count was {got!r}, " f"expected '0 Folders'", depth=0, jump_kind="value", expect="tv_folders_count desc == '0 Folders'")
@and_test(expects=("text_selection_subtitle",))def test_selection_subtitle(): """Long-pressing a note turns the folder subtitle into the selection wording that ends with '• 1 Selected', where it did not before (string flip).""" clean_home() if not create_note_in_general("SelectMeNote"): record("text_selection_subtitle", False, "setup_failed: could not create the note to select", depth=1, jump_kind="transition", expect="subtitle gains '• 1 Selected'") return if not and_enter_folder("General"): record("text_selection_subtitle", False, "setup_failed: could not reopen the General folder", depth=1, jump_kind="transition", expect="subtitle gains '• 1 Selected'") return before = subtitle_desc() absent = "selected" not in norm(before) if and_enter_selection("SelectMeNote") is None: record("text_selection_subtitle", False, "setup_failed: long-press did not enter selection mode", depth=1, jump_kind="transition", expect="subtitle gains '• 1 Selected'") return after = subtitle_desc() present = "1 selected" in norm(after) and "•" in after ok = absent and present record("text_selection_subtitle", ok, "" if ok else f"behavior_wrong: selection subtitle was {after!r}, " f"expected it to contain '• 1 Selected'", depth=1, jump_kind="transition", expect="subtitle content-desc contains '• 1 Selected'")
@and_test(expects=("text_new_note_created_timestamp", "text_new_note_created_timestamp_vlm"))def test_new_note_created_timestamp(): """A brand-new note's creation line reads 'Created just now', and the same fresh editor also reads 'Accessed just now' below it.""" clean_home() if not and_enter_folder("General"): record("text_new_note_created_timestamp", False, "setup_failed: could not open the General folder", depth=2, jump_kind="value", expect="tv_created_at == 'Created just now'") return if not and_enter_editor(): record("text_new_note_created_timestamp", False, "setup_failed: could not open the note editor", depth=2, jump_kind="value", expect="tv_created_at == 'Created just now'") return nodes = ui() created = node_by_id(nodes, "tv_created_at") got = created.get("text", "") if created else "" ok = norm(got) == norm("Created just now") record("text_new_note_created_timestamp", ok, "" if ok else f"behavior_wrong: creation line was {got!r}, " f"expected 'Created just now'", depth=2, jump_kind="value", expect="tv_created_at text == 'Created just now'") vlm_assert("text_new_note_created_timestamp", "Near the BOTTOM of the note-editing area, below the text fields, " "are two small timestamp lines beginning with 'Created' and " "'Accessed' shown one under the other?", RESULTS_DIR, tag="position")
@and_test(expects=("text_new_note_accessed_timestamp",))def test_new_note_accessed_timestamp(): """The fresh-note access line reads 'Accessed just now' verbatim.""" clean_home() if not and_enter_folder("General"): record("text_new_note_accessed_timestamp", False, "setup_failed: could not open the General folder", depth=2, jump_kind="value", expect="tv_accessed_at == 'Accessed just now'") return if not and_enter_editor(): record("text_new_note_accessed_timestamp", False, "setup_failed: could not open the note editor", depth=2, jump_kind="value", expect="tv_accessed_at == 'Accessed just now'") return accessed = node_by_id(ui(), "tv_accessed_at") got = accessed.get("text", "") if accessed else "" ok = norm(got) == norm("Accessed just now") record("text_new_note_accessed_timestamp", ok, "" if ok else f"behavior_wrong: access line was {got!r}, " f"expected 'Accessed just now'", depth=2, jump_kind="value", expect="tv_accessed_at text == 'Accessed just now'")
@and_test(expects=("text_editor_title_hint",))def test_editor_title_hint(): """An empty note-title field shows the hint 'Title'.""" clean_home() if not and_enter_folder("General"): record("text_editor_title_hint", False, "setup_failed: could not open the General folder", depth=2, jump_kind="value", expect="et_note_title hint == 'Title'") return if not and_enter_editor(): record("text_editor_title_hint", False, "setup_failed: could not open the note editor", depth=2, jump_kind="value", expect="et_note_title hint == 'Title'") return t = node_by_id(ui(), "et_note_title") got = t.get("text", "") if t else "" ok = norm(got) == norm("Title") record("text_editor_title_hint", ok, "" if ok else f"behavior_wrong: title hint was {got!r}, expected 'Title'", depth=2, jump_kind="value", expect="et_note_title hint text == 'Title'")
@and_test(expects=("text_editor_body_hint",))def test_editor_body_hint(): """An empty note-body field shows the hint 'Body'.""" clean_home() if not and_enter_folder("General"): record("text_editor_body_hint", False, "setup_failed: could not open the General folder", depth=2, jump_kind="value", expect="et_note_body hint == 'Body'") return if not and_enter_editor(): record("text_editor_body_hint", False, "setup_failed: could not open the note editor", depth=2, jump_kind="value", expect="et_note_body hint == 'Body'") return b = node_by_id(ui(), "et_note_body") got = b.get("text", "") if b else "" ok = norm(got) == norm("Body") record("text_editor_body_hint", ok, "" if ok else f"behavior_wrong: body hint was {got!r}, expected 'Body'", depth=2, jump_kind="value", expect="et_note_body hint text == 'Body'")
@and_test(expects=("text_echoed_note_title_body",))def test_echoed_note_title_body(): """User-typed title and body echo VERBATIM in the note's folder-list row — the row was absent before the note existed (string flip).""" clean_home() if not and_enter_folder("General"): record("text_echoed_note_title_body", False, "setup_failed: could not open the General folder", depth=1, jump_kind="value", expect="row shows 'MyNoteXYZ' + body") return absent = find_node(ui(), text="MyNoteXYZ") is None and_reset_depth() if not create_note_in_general("MyNoteXYZ", "hello world foo bar"): record("text_echoed_note_title_body", False, "setup_failed: could not create the note", depth=1, jump_kind="value", expect="row shows 'MyNoteXYZ' + body") return if not and_enter_folder("General"): record("text_echoed_note_title_body", False, "setup_failed: could not reopen the General folder", depth=1, jump_kind="value", expect="row shows 'MyNoteXYZ' + body") return nodes = ui() title_ok = find_node(nodes, text="MyNoteXYZ") is not None body_node = node_by_id(nodes, "tv_note_body") body_ok = body_node is not None and norm(body_node.get("text")) == norm( "hello world foo bar") ok = absent and title_ok and body_ok record("text_echoed_note_title_body", ok, "" if ok else "behavior_wrong: typed title/body did not echo verbatim " f"in the folder row (title_ok={title_ok}, body_ok={body_ok})", depth=1, jump_kind="value", expect="folder row title=='MyNoteXYZ' body=='hello world foo bar'")
@and_test(expects=("text_reading_mode_paging_label", "text_reading_mode_paging_label_vlm"))def test_reading_mode_paging_label(): """In Reading Mode (scoped to the one opened note) the paging label reads '1 / 1 Note'; the note's typed title+body render verbatim in the drawn read-only view (VLM, content).""" clean_home() if not create_note_in_general("ReadMeNote", "the quick brown fox jumps"): record("text_reading_mode_paging_label", False, "setup_failed: could not create the note", depth=3, jump_kind="value", expect="paging label == '1 / 1 Note'") return if not and_enter_folder("General"): record("text_reading_mode_paging_label", False, "setup_failed: could not reopen the General folder", depth=3, jump_kind="value", expect="paging label == '1 / 1 Note'") return if and_enter_selection("ReadMeNote") is None: record("text_reading_mode_paging_label", False, "setup_failed: long-press did not enter selection mode", depth=3, jump_kind="value", expect="paging label == '1 / 1 Note'") return if not and_reach_note_options(): record("text_reading_mode_paging_label", False, "setup_failed: could not open the Note-options sheet", depth=3, jump_kind="value", expect="paging label == '1 / 1 Note'") return if not and_reach_reading_mode(): record("text_reading_mode_paging_label", False, "setup_failed: could not enter Reading Mode", depth=3, jump_kind="value", expect="paging label == '1 / 1 Note'") return got = subtitle_desc() ok = norm(got) == norm("1 / 1 Note") record("text_reading_mode_paging_label", ok, "" if ok else f"behavior_wrong: reading-mode paging label was {got!r}, " f"expected '1 / 1 Note'", depth=3, jump_kind="value", expect="tv_notes_count desc == '1 / 1 Note'") vlm_assert("text_reading_mode_paging_label", "Does this read-only note view display the title 'ReadMeNote' and " "the body text 'the quick brown fox jumps'?", RESULTS_DIR, tag="content")
@and_test(expects=("text_fab_create_note_desc",))def test_fab_create_note_desc(): """Inside a folder the create button's content-desc reads 'Create note' (it read 'Create folder' on the HOME sheet — string differs by surface).""" clean_home() home_fab = find_node(ui(), content_desc="Create folder") home_ok = home_fab is not None if not and_enter_folder("General"): record("text_fab_create_note_desc", False, "setup_failed: could not open the General folder", depth=1, jump_kind="value", expect="folder fab desc == 'Create note'") return folder_fab = find_node(ui(), content_desc="Create note") ok = home_ok and folder_fab is not None record("text_fab_create_note_desc", ok, "" if ok else "behavior_wrong: folder create button did not expose " "content-desc 'Create note' (or HOME lacked 'Create folder')", depth=1, jump_kind="value", expect="HOME fab desc 'Create folder' -> folder fab desc 'Create note'")
@and_test(expects=("text_settings_screen_title",))def test_settings_screen_title(): """Opening Settings from HOME shows the 'Settings' title where none was on the HOME sheet (before/after string).""" clean_home() absent = find_node(ui(), text="Settings") is None if not and_enter_settings(): record("text_settings_screen_title", False, "setup_failed: could not open Settings from HOME", depth=1, jump_kind="value", expect="Settings title == 'Settings'") return present = find_node(ui(), text="Settings") is not None ok = absent and present record("text_settings_screen_title", ok, "" if ok else "behavior_wrong: 'Settings' title did not appear after " "opening Settings", depth=1, jump_kind="value", expect="screen title text == 'Settings'")
@and_test(expects=("text_note_options_reading_mode_label",))def test_note_options_reading_mode_label(): """The Note-options sheet (long-press -> More options) offers a row labelled 'Reading Mode' verbatim, absent before the sheet opened (string flip).""" clean_home() if not create_note_in_general("OptsNote"): record("text_note_options_reading_mode_label", False, "setup_failed: could not create the note", depth=2, jump_kind="value", expect="sheet row 'Reading Mode'") return if not and_enter_folder("General"): record("text_note_options_reading_mode_label", False, "setup_failed: could not reopen the General folder", depth=2, jump_kind="value", expect="sheet row 'Reading Mode'") return absent = find_node(ui(), text="Reading Mode") is None if and_enter_selection("OptsNote") is None: record("text_note_options_reading_mode_label", False, "setup_failed: long-press did not enter selection mode", depth=2, jump_kind="value", expect="sheet row 'Reading Mode'") return if not and_reach_note_options(): record("text_note_options_reading_mode_label", False, "setup_failed: could not open the Note-options sheet", depth=2, jump_kind="value", expect="sheet row 'Reading Mode'") return row = node_by_id(ui(), "tv_open_in") or find_node(ui(), text="Reading Mode") got = row.get("text", "") if row else "" present = norm(got) == norm("Reading Mode") ok = absent and present record("text_note_options_reading_mode_label", ok, "" if ok else f"behavior_wrong: Note-options row was {got!r}, " f"expected 'Reading Mode'", depth=2, jump_kind="value", expect="Note-options row text == 'Reading Mode'")
TESTS = [ test_empty_folder_placeholder, test_search_nomatch_placeholder, test_search_clears_note_returns, test_folder_count_singular, test_folder_count_plural, test_home_folders_count_zero, test_selection_subtitle, test_new_note_created_timestamp, test_new_note_accessed_timestamp, test_editor_title_hint, test_editor_body_hint, test_echoed_note_title_body, test_reading_mode_paging_label, test_fab_create_note_desc, test_settings_screen_title, test_note_options_reading_mode_label,]
if __name__ == "__main__": run_suite(TESTS, "text")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885{ "manifest_version": 1, "kit_api_version": 1, "task_id": "Noto", "baseline_model": "claude-opus-4-8", "baseline_package": "", "total": 136, "manifest_sha": "766a1ded0bcc", "tests": [ { "name": "computation::computation_folder_count_one", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_folder_count_three", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_folder_count_two", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_folders_count_one", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_folders_count_two", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_home_cards_count", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_home_cards_count_vlm", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_reading_paging", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_reading_paging_vlm", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_empty", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_five", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_four", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_four_vlm", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_lead_trail_space", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_multi_space", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_one", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_punctuation", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_seven_single_chars", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_three", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_title_excluded_body", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_title_excluded_empty", "module": "computation", "baseline_status": "passed" }, { "name": "computation::computation_wc_two", "module": "computation", "baseline_status": "passed" }, { "name": "interaction::interaction_create_folder", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_create_note", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_create_two_folders", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_created_note_card_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_duplicate_note", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_duplicate_note_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_edit_note_body_persists", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_edited_body_survives_process_death", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_folder_survives_process_death", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_move_note_between_folders", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_multi_record_integrity", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_multi_select_count", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_new_folder_note_roundtrip", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_note_options_grid_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_note_survives_process_death", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_pin_note", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_pinned_section_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_second_create_two_rows", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_selection_action_bar_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_selection_check_badge_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "interaction::interaction_selection_check_dark_vlm", "module": "interaction", "baseline_status": "passed" }, { "name": "navigation::nav_back_editor_to_home", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_back_general_to_settings", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_back_reading_to_folder", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_back_settings_to_folder", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_chain_editor", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_chain_editor_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_chain_general_settings", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_chain_note_options", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_chain_reading_mode", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_chain_reading_mode_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_chain_theme_dialog", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_folder_bottom_bar_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_all", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_archived", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_folder", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_folder_options", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_home_from_folder", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_more_menu", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_more_menu_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_notes_view", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_notes_view_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_recent", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_search", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_settings", "module": "navigation", "baseline_status": "passed" }, { "name": "navigation::nav_reach_settings_vlm", "module": "navigation", "baseline_status": "passed" }, { "name": "states::states_all_chip_active", "module": "states", "baseline_status": "passed" }, { "name": "states::states_all_chip_active_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_body_focus", "module": "states", "baseline_status": "passed" }, { "name": "states::states_home_cards", "module": "states", "baseline_status": "passed" }, { "name": "states::states_home_cards_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_multiselect_two", "module": "states", "baseline_status": "passed" }, { "name": "states::states_notes_view_current_state", "module": "states", "baseline_status": "passed" }, { "name": "states::states_ordering_toggle", "module": "states", "baseline_status": "passed" }, { "name": "states::states_reading_paging_position", "module": "states", "baseline_status": "passed" }, { "name": "states::states_reading_paging_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_redo_stays_disabled", "module": "states", "baseline_status": "passed" }, { "name": "states::states_selection_bar_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_selection_count_increment", "module": "states", "baseline_status": "passed" }, { "name": "states::states_selection_off", "module": "states", "baseline_status": "passed" }, { "name": "states::states_selection_on", "module": "states", "baseline_status": "passed" }, { "name": "states::states_selection_on_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_show_count_persists", "module": "states", "baseline_status": "passed" }, { "name": "states::states_show_count_thumb_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_show_count_toggle", "module": "states", "baseline_status": "passed" }, { "name": "states::states_theme_dark_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_theme_light_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_theme_persists", "module": "states", "baseline_status": "passed" }, { "name": "states::states_theme_persists_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_theme_selected_mark_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_title_focus", "module": "states", "baseline_status": "passed" }, { "name": "states::states_undo_disabled_vlm", "module": "states", "baseline_status": "passed" }, { "name": "states::states_undo_enable", "module": "states", "baseline_status": "passed" }, { "name": "states::states_undo_history_disabled", "module": "states", "baseline_status": "passed" }, { "name": "structure::structure_editor_subtree_appears", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_editor_title_above_body_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_editor_toolbar_row_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_editor_toolbar_shape", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_folder_label_row_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_folder_replaces_home", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_gate_default_folder", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_gate_home_sheet", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_gate_library_grid_count", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_general_settings_rows", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_home_cards_color_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_home_fab_position_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_home_grid_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_newfolder_dialog_appears", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_newfolder_swatches_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_note_options_sheet_appears", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_notesview_sheet_appears", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_reading_mode_fullscreen_vlm", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_reading_mode_subtree", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_selection_bar_appears", "module": "structure", "baseline_status": "passed" }, { "name": "structure::structure_settings_list_appears", "module": "structure", "baseline_status": "passed" }, { "name": "text::text_echoed_note_title_body", "module": "text", "baseline_status": "passed" }, { "name": "text::text_editor_body_hint", "module": "text", "baseline_status": "passed" }, { "name": "text::text_editor_title_hint", "module": "text", "baseline_status": "passed" }, { "name": "text::text_empty_folder_placeholder", "module": "text", "baseline_status": "passed" }, { "name": "text::text_empty_folder_placeholder_vlm", "module": "text", "baseline_status": "passed" }, { "name": "text::text_fab_create_note_desc", "module": "text", "baseline_status": "passed" }, { "name": "text::text_folder_count_plural", "module": "text", "baseline_status": "passed" }, { "name": "text::text_folder_count_singular", "module": "text", "baseline_status": "passed" }, { "name": "text::text_home_folders_count_zero", "module": "text", "baseline_status": "passed" }, { "name": "text::text_new_note_accessed_timestamp", "module": "text", "baseline_status": "passed" }, { "name": "text::text_new_note_created_timestamp", "module": "text", "baseline_status": "passed" }, { "name": "text::text_new_note_created_timestamp_vlm", "module": "text", "baseline_status": "passed" }, { "name": "text::text_note_options_reading_mode_label", "module": "text", "baseline_status": "passed" }, { "name": "text::text_reading_mode_paging_label", "module": "text", "baseline_status": "passed" }, { "name": "text::text_reading_mode_paging_label_vlm", "module": "text", "baseline_status": "passed" }, { "name": "text::text_search_clears_note_returns", "module": "text", "baseline_status": "passed" }, { "name": "text::text_search_nomatch_placeholder", "module": "text", "baseline_status": "passed" }, { "name": "text::text_selection_subtitle", "module": "text", "baseline_status": "passed" }, { "name": "text::text_settings_screen_title", "module": "text", "baseline_status": "passed" } ], "ignored": [], "vlm_assertions": [ { "name": "computation::computation_wc_four_vlm", "module": "computation", "tag": "content" }, { "name": "computation::computation_home_cards_count_vlm", "module": "computation", "tag": "content" }, { "name": "computation::computation_reading_paging_vlm", "module": "computation", "tag": "content" }, { "name": "interaction::interaction_duplicate_note_vlm", "module": "interaction", "tag": "position" }, { "name": "interaction::interaction_selection_check_dark_vlm", "module": "interaction", "tag": "color" }, { "name": "interaction::interaction_selection_check_badge_vlm", "module": "interaction", "tag": "shape" }, { "name": "interaction::interaction_selection_action_bar_vlm", "module": "interaction", "tag": "layout" }, { "name": "interaction::interaction_pinned_section_vlm", "module": "interaction", "tag": "position" }, { "name": "interaction::interaction_note_options_grid_vlm", "module": "interaction", "tag": "layout" }, { "name": "interaction::interaction_created_note_card_vlm", "module": "interaction", "tag": "size" }, { "name": "navigation::nav_reach_settings_vlm", "module": "navigation", "tag": "layout" }, { "name": "navigation::nav_reach_more_menu_vlm", "module": "navigation", "tag": "layout" }, { "name": "navigation::nav_reach_notes_view_vlm", "module": "navigation", "tag": "position" }, { "name": "navigation::nav_chain_editor_vlm", "module": "navigation", "tag": "position" }, { "name": "navigation::nav_chain_reading_mode_vlm", "module": "navigation", "tag": "position" }, { "name": "navigation::nav_folder_bottom_bar_vlm", "module": "navigation", "tag": "layout" }, { "name": "states::states_selection_on_vlm", "module": "states", "tag": "shape" }, { "name": "states::states_selection_bar_vlm", "module": "states", "tag": "layout" }, { "name": "states::states_all_chip_active_vlm", "module": "states", "tag": "color" }, { "name": "states::states_undo_disabled_vlm", "module": "states", "tag": "color" }, { "name": "states::states_theme_light_vlm", "module": "states", "tag": "color" }, { "name": "states::states_theme_selected_mark_vlm", "module": "states", "tag": "shape" }, { "name": "states::states_theme_persists_vlm", "module": "states", "tag": "color" }, { "name": "states::states_theme_dark_vlm", "module": "states", "tag": "color" }, { "name": "states::states_show_count_thumb_vlm", "module": "states", "tag": "position" }, { "name": "states::states_reading_paging_vlm", "module": "states", "tag": "layout" }, { "name": "states::states_home_cards_vlm", "module": "states", "tag": "color" }, { "name": "structure::structure_home_grid_vlm", "module": "structure", "tag": "layout" }, { "name": "structure::structure_home_cards_color_vlm", "module": "structure", "tag": "color" }, { "name": "structure::structure_home_fab_position_vlm", "module": "structure", "tag": "position" }, { "name": "structure::structure_editor_title_above_body_vlm", "module": "structure", "tag": "position" }, { "name": "structure::structure_editor_toolbar_row_vlm", "module": "structure", "tag": "position" }, { "name": "structure::structure_reading_mode_fullscreen_vlm", "module": "structure", "tag": "layout" }, { "name": "structure::structure_folder_label_row_vlm", "module": "structure", "tag": "position" }, { "name": "structure::structure_newfolder_swatches_vlm", "module": "structure", "tag": "shape" }, { "name": "text::text_empty_folder_placeholder_vlm", "module": "text", "tag": "position" }, { "name": "text::text_new_note_created_timestamp_vlm", "module": "text", "tag": "position" }, { "name": "text::text_reading_mode_paging_label_vlm", "module": "text", "tag": "content" } ], "vlm_total": 38}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796{ "schema_version": 2, "instance_id": "android/alialbaali-noto", "grading": { "mode": "inline", "model": null, "scored_separately": true }, "totals": { "assertions": 39, "with_verdict": 38, "calibrated": 0, "usable": null, "scored_records": 38, "unbacked_records": 0 }, "assertions": [ { "id": "structure_home_grid_vlm", "screenshot": "structure_home_grid_vlm.png", "assertion": "Near the top of this note-taking app's list, is there a 2 by 2 grid of exactly four rectangular cards (labelled All, Recent, Scheduled, Archived)?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "structure_home_grid", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_home_cards_color_vlm", "screenshot": "structure_home_cards_color_vlm.png", "assertion": "Are the four library cards each filled with a DIFFERENT solid background color (for example one blue, one amber/orange, one red, one purple), rather than all the same color?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "structure_home_cards_color", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_home_fab_position_vlm", "screenshot": "structure_home_fab_position_vlm.png", "assertion": "Is there a circular floating action button (a round '+' / add button) located in the BOTTOM-RIGHT corner of the screen?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "structure_home_fab_position", "rigor": { "jump_kind": "none", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_editor_title_above_body_vlm", "screenshot": "structure_editor_title_above_body_vlm.png", "assertion": "In this note editor, is the single-line 'Title' input field positioned ABOVE the larger multi-line 'Body' input area?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "structure_editor_title_above_body", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_editor_toolbar_row_vlm", "screenshot": "structure_editor_toolbar_row_vlm.png", "assertion": "Is there a single horizontal row of exactly four icon buttons located along the BOTTOM edge of this note editor screen?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "structure_editor_toolbar_row", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_reading_mode_fullscreen_vlm", "screenshot": "structure_reading_mode_fullscreen_vlm.png", "assertion": "Does this screen show note text laid out as a large, mostly empty full-screen reading page with minimal toolbar chrome (no title/body text-input boxes)?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "structure_reading_mode_fullscreen", "rigor": { "jump_kind": "none", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_folder_label_row_vlm", "screenshot": "structure_folder_label_row_vlm.png", "assertion": "Directly beneath the folder's title/subtitle, is there a horizontal row containing a small pill/chip labelled 'All' next to a small add (+) button?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "structure_folder_label_row", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "structure_newfolder_swatches_vlm", "screenshot": "structure_newfolder_swatches_vlm.png", "assertion": "In this 'New folder' dialog, under a 'Color' label, is there a row of several small circular color swatches in different colors?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "structure_newfolder_swatches", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_settings_vlm", "screenshot": "nav_reach_settings_vlm.png", "assertion": "Is a settings screen showing a vertical list of labelled rows, each row with a small leading icon on its left?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_reach_settings", "rigor": { "jump_kind": "reach", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_more_menu_vlm", "screenshot": "nav_reach_more_menu_vlm.png", "assertion": "Is a small menu sheet showing a short vertical list of text entries (vault / archive / settings), overlaying the screen near the bottom?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_reach_more_menu", "rigor": { "jump_kind": "reach", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_reach_notes_view_vlm", "screenshot": "nav_reach_notes_view_vlm.png", "assertion": "Is a bottom sheet dialog anchored to the lower portion of the screen, overlaying a dimmed screen behind it?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "nav_reach_notes_view", "rigor": { "jump_kind": "reach", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_chain_editor_vlm", "screenshot": "nav_chain_editor_vlm.png", "assertion": "Is there a back-arrow icon at the very top-left of the screen, next to the folder title in the toolbar?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "nav_chain_editor", "rigor": { "jump_kind": "reach", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_chain_reading_mode_vlm", "screenshot": "nav_chain_reading_mode_vlm.png", "assertion": "Does the screen show note text with left/right paging arrows near the bottom and a circular Edit button at the bottom-right?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_chain_reading_mode", "rigor": { "jump_kind": "reach", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "nav_folder_bottom_bar_vlm", "screenshot": "nav_folder_bottom_bar_vlm.png", "assertion": "Is there a horizontal row of action icons along the bottom of the screen (a menu/hamburger, a plus/add, and search), forming a bottom app bar?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "nav_folder_bottom_bar", "rigor": { "jump_kind": "reach", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_duplicate_note_vlm", "screenshot": "interaction_duplicate_note_vlm.png", "assertion": "Are there two note cards with the same title text positioned immediately one above the other (adjacent) in the note list?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "interaction_duplicate_note", "rigor": { "jump_kind": "value", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_selection_highlight_vlm", "screenshot": "interaction_selection_highlight_vlm.png", "assertion": "Exactly one note row is currently selected: does that selected row have a visibly different (tinted/highlighted) background colour compared to the other unselected row?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "interaction_selection_highlight", "rigor": null, "verdict": null, "calibration": null }, { "id": "interaction_selection_check_badge_vlm", "screenshot": "interaction_selection_check_badge_vlm.png", "assertion": "Does the selected note row show a filled circular check/tick badge marking it as selected?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "interaction_selection_check_badge", "rigor": { "jump_kind": "transition", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_selection_action_bar_vlm", "screenshot": "interaction_selection_action_bar_vlm.png", "assertion": "Is a bottom action bar with several selection action icons (reminder, pin, share, archive and a more-options button) rendered along the bottom of the screen?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "interaction_selection_action_bar", "rigor": { "jump_kind": "transition", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_pinned_section_vlm", "screenshot": "interaction_pinned_section_vlm.png", "assertion": "Is there a 'Pinned' section heading near the top of the note list with a note shown directly beneath it, positioned above the rest of the notes?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "interaction_pinned_section", "rigor": { "jump_kind": "transition", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_note_options_grid_vlm", "screenshot": "interaction_note_options_grid_vlm.png", "assertion": "Does this bottom sheet titled 'Note options' show a grid/list of several labeled action tiles such as Add reminder, Reading Mode, Pin, Share, Archive, Duplicate, Copy, Move to and Delete?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "interaction_note_options_grid", "rigor": { "jump_kind": "value", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_created_note_card_vlm", "screenshot": "interaction_created_note_card_vlm.png", "assertion": "In the note card, is the title line ('CardTitle') rendered in a LARGER or bolder font than, and positioned above, the body-preview line ('card body preview')?", "form": "question", "expected": true, "aspect": "size", "modality": null, "links_to": "interaction_created_note_card", "rigor": { "jump_kind": "value", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "interaction_selection_check_dark_vlm", "screenshot": "interaction_selection_check_dark_vlm.png", "assertion": "The selected note row shows a small circular check/tick badge in its corner: is that badge a SOLID DARK/BLACK filled circle (not a hollow outline)?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "interaction_selection_check_dark", "rigor": { "jump_kind": "transition", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "computation_wc_four_vlm", "screenshot": "computation_wc_four_vlm.png", "assertion": "In this note editor screen, is the text '4 Words' displayed in the header row near the top (next to the folder title)?", "form": "question", "expected": true, "aspect": "content", "modality": null, "links_to": "computation_wc_four", "rigor": { "jump_kind": "value", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "computation_home_cards_count_vlm", "screenshot": "computation_home_cards_count_vlm.png", "assertion": "On this home screen, does the 'All' library card show the number 2 as its note count?", "form": "question", "expected": true, "aspect": "content", "modality": null, "links_to": "computation_home_cards_count", "rigor": { "jump_kind": "value", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "computation_reading_paging_vlm", "screenshot": "computation_reading_paging_vlm.png", "assertion": "In this full-screen reading view, is the paging indicator '1 / 1 Note' displayed (showing you are on note 1 of 1)?", "form": "question", "expected": true, "aspect": "content", "modality": null, "links_to": "computation_reading_paging", "rigor": { "jump_kind": "value", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_selection_on_vlm", "screenshot": "states_selection_on_vlm.png", "assertion": "Does exactly one note row show a solid, filled circular check/selection badge (a coloured circle with a checkmark) on it?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "states_selection_on", "rigor": { "jump_kind": "transition", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_selection_bar_vlm", "screenshot": "states_selection_bar_vlm.png", "assertion": "Is a horizontal action bar of icon buttons (reminder, pin, share, archive) shown along the bottom of the screen?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "states_selection_bar", "rigor": { "jump_kind": "transition", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_all_chip_active_vlm", "screenshot": "states_all_chip_active_vlm.png", "assertion": "Near the top of the note list, is the 'All' chip drawn as a FILLED (solid dark/coloured) pill while the neighbouring add-label (+) button is an outlined/unfilled circle?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_all_chip_active", "rigor": { "jump_kind": "value", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "text_empty_folder_placeholder_vlm", "screenshot": "text_empty_folder_placeholder_vlm.png", "assertion": "Is a short single-line message like 'Folder is empty.' shown roughly centered in the middle of an otherwise blank note list (not at the top or bottom)?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "text_empty_folder_placeholder", "rigor": { "jump_kind": "none", "depth": 1 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "text_new_note_created_timestamp_vlm", "screenshot": "text_new_note_created_timestamp_vlm.png", "assertion": "Near the BOTTOM of the note-editing area, below the text fields, are two small timestamp lines beginning with 'Created' and 'Accessed' shown one under the other?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "text_new_note_created_timestamp", "rigor": { "jump_kind": "none", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "text_reading_mode_paging_label_vlm", "screenshot": "text_reading_mode_paging_label_vlm.png", "assertion": "Does this read-only note view display the title 'ReadMeNote' and the body text 'the quick brown fox jumps'?", "form": "question", "expected": true, "aspect": "content", "modality": null, "links_to": "text_reading_mode_paging_label", "rigor": { "jump_kind": "none", "depth": 4 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_undo_disabled_vlm", "screenshot": "states_undo_disabled_vlm.png", "assertion": "In the bottom toolbar of this note editor, does the Undo (left curved arrow) icon look greyed-out / dimmed compared with the other toolbar icons?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_undo_disabled", "rigor": { "jump_kind": "transition", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_theme_light_vlm", "screenshot": "states_theme_light_vlm.png", "assertion": "Is the overall app background LIGHT (white / very pale) with dark text, rather than a dark/black background?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_theme_light", "rigor": { "jump_kind": "transition", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_theme_selected_mark_vlm", "screenshot": "states_theme_selected_mark_vlm.png", "assertion": "In this Theme option list, is the 'Light' option visibly marked as the current selection (a filled radio dot or a highlighted row) while the other options are not?", "form": "question", "expected": true, "aspect": "shape", "modality": null, "links_to": "states_theme_selected_mark", "rigor": { "jump_kind": "value", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_theme_persists_vlm", "screenshot": "states_theme_persists_vlm.png", "assertion": "Is the overall app background still LIGHT (white / very pale) with dark text after the app was restarted?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_theme_persists", "rigor": { "jump_kind": "transition", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_theme_dark_vlm", "screenshot": "states_theme_dark_vlm.png", "assertion": "Is the overall app background now DARK (near-black / very dark) with light-coloured text?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_theme_dark", "rigor": { "jump_kind": "transition", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_show_count_thumb_vlm", "screenshot": "states_show_count_thumb_vlm.png", "assertion": "On the 'Show notes count' settings row, is there a switch whose thumb is toward the RIGHT / in the ON position (the track filled/coloured)?", "form": "question", "expected": true, "aspect": "position", "modality": null, "links_to": "states_show_count_thumb", "rigor": { "jump_kind": "transition", "depth": 2 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_reading_paging_vlm", "screenshot": "states_reading_paging_vlm.png", "assertion": "In this full-screen reading view, is a page-position indicator (showing something like '1 / 1' or '1 / 2') rendered near the bottom/header, between a previous and a next arrow?", "form": "question", "expected": true, "aspect": "layout", "modality": null, "links_to": "states_reading_paging", "rigor": { "jump_kind": "value", "depth": 3 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null }, { "id": "states_home_cards_vlm", "screenshot": "states_home_cards_vlm.png", "assertion": "Near the top of this screen are four library cards. Do they have FOUR DISTINCT accent colours (for example blue, amber/yellow, red, and purple) rather than all being the same colour?", "form": "question", "expected": true, "aspect": "color", "modality": null, "links_to": "states_home_cards", "rigor": { "jump_kind": "value", "depth": 0 }, "verdict": { "answer": true, "passed": true, "raw": null }, "calibration": null } ], "merged_from_files": 1, "source_shapes": { "list": 1 }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license forsoftware and other kinds of works.
The licenses for most software and other practical works are designedto take away your freedom to share and change the works. By contrast,the GNU General Public License is intended to guarantee your freedom toshare and change all versions of a program--to make sure it remains freesoftware for all its users. We, the Free Software Foundation, use theGNU General Public License for most of our software; it applies also toany other work released this way by its authors. You can apply it toyour programs, too.
When we speak of free software, we are referring to freedom, notprice. Our General Public Licenses are designed to make sure that youhave the freedom to distribute copies of free software (and charge forthem if you wish), that you receive source code or can get it if youwant it, that you can change the software or use pieces of it in newfree programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying youthese rights or asking you to surrender the rights. Therefore, you havecertain responsibilities if you distribute copies of the software, or ifyou modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whethergratis or for a fee, you must pass on to the recipients the samefreedoms that you received. You must make sure that they, too, receiveor can get the source code. And you must show them these terms so theyknow their rights.
Developers that use the GNU GPL protect your rights with two steps:(1) assert copyright on the software, and (2) offer you this Licensegiving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explainsthat there is no warranty for this free software. For both users' andauthors' sake, the GPL requires that modified versions be marked aschanged, so that their problems will not be attributed erroneously toauthors of previous versions.
Some devices are designed to deny users access to install or runmodified versions of the software inside them, although the manufacturercan do so. This is fundamentally incompatible with the aim ofprotecting users' freedom to change the software. The systematicpattern of such abuse occurs in the area of products for individuals touse, which is precisely where it is most unacceptable. Therefore, wehave designed this version of the GPL to prohibit the practice for thoseproducts. If such problems arise substantially in other domains, westand ready to extend this provision to those domains in future versionsof the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.States should not allow patents to restrict development and use ofsoftware on general-purpose computers, but in those that do, we wish toavoid the special danger that patents applied to a free program couldmake it effectively proprietary. To prevent this, the GPL assures thatpatents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution andmodification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds ofworks, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under thisLicense. Each licensee is addressed as "you". "Licensees" and"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the workin a fashion requiring copyright permission, other than the making of anexact copy. The resulting work is called a "modified version" of theearlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work basedon the Program.
To "propagate" a work means to do anything with it that, withoutpermission, would make you directly or secondarily liable forinfringement under applicable copyright law, except executing it on acomputer or modifying a private copy. Propagation includes copying,distribution (with or without modification), making available to thepublic, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables otherparties to make or receive copies. Mere interaction with a user througha computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"to the extent that it includes a convenient and prominently visiblefeature that (1) displays an appropriate copyright notice, and (2)tells the user that there is no warranty for the work (except to theextent that warranties are provided), that licensees may convey thework under this License, and how to view a copy of this License. Ifthe interface presents a list of user commands or options, such as amenu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the workfor making modifications to it. "Object code" means any non-sourceform of a work.
A "Standard Interface" means an interface that either is an officialstandard defined by a recognized standards body, or, in the case ofinterfaces specified for a particular programming language, one thatis widely used among developers working in that language.
The "System Libraries" of an executable work include anything, otherthan the work as a whole, that (a) is included in the normal form ofpackaging a Major Component, but which is not part of that MajorComponent, and (b) serves only to enable use of the work with thatMajor Component, or to implement a Standard Interface for which animplementation is available to the public in source code form. A"Major Component", in this context, means a major essential component(kernel, window system, and so on) of the specific operating system(if any) on which the executable work runs, or a compiler used toproduce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means allthe source code needed to generate, install, and (for an executablework) run the object code and to modify the work, including scripts tocontrol those activities. However, it does not include the work'sSystem Libraries, or general-purpose tools or generally available freeprograms which are used unmodified in performing those activities butwhich are not part of the work. For example, Corresponding Sourceincludes interface definition files associated with source files forthe work, and the source code for shared libraries and dynamicallylinked subprograms that the work is specifically designed to require,such as by intimate data communication or control flow between thosesubprograms and other parts of the work.
The Corresponding Source need not include anything that userscan regenerate automatically from other parts of the CorrespondingSource.
The Corresponding Source for a work in source code form is thatsame work.
2. Basic Permissions.
All rights granted under this License are granted for the term ofcopyright on the Program, and are irrevocable provided the statedconditions are met. This License explicitly affirms your unlimitedpermission to run the unmodified Program. The output from running acovered work is covered by this License only if the output, given itscontent, constitutes a covered work. This License acknowledges yourrights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do notconvey, without conditions so long as your license otherwise remainsin force. You may convey covered works to others for the sole purposeof having them make modifications exclusively for you, or provide youwith facilities for running those works, provided that you comply withthe terms of this License in conveying all material for which you donot control copyright. Those thus making or running the covered worksfor you must do so exclusively on your behalf, under your directionand control, on terms that prohibit them from making any copies ofyour copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely underthe conditions stated below. Sublicensing is not allowed; section 10makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technologicalmeasure under any applicable law fulfilling obligations under article11 of the WIPO copyright treaty adopted on 20 December 1996, orsimilar laws prohibiting or restricting circumvention of suchmeasures.
When you convey a covered work, you waive any legal power to forbidcircumvention of technological measures to the extent such circumventionis effected by exercising rights under this License with respect tothe covered work, and you disclaim any intention to limit operation ormodification of the work as a means of enforcing, against the work'susers, your or third parties' legal rights to forbid circumvention oftechnological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as youreceive it, in any medium, provided that you conspicuously andappropriately publish on each copy an appropriate copyright notice;keep intact all notices stating that this License and anynon-permissive terms added in accord with section 7 apply to the code;keep intact all notices of the absence of any warranty; and give allrecipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications toproduce it from the Program, in the form of source code under theterms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independentworks, which are not by their nature extensions of the covered work,and which are not combined with it such as to form a larger program,in or on a volume of a storage or distribution medium, is called an"aggregate" if the compilation and its resulting copyright are notused to limit the access or legal rights of the compilation's usersbeyond what the individual works permit. Inclusion of a covered workin an aggregate does not cause this License to apply to the otherparts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the termsof sections 4 and 5, provided that you also convey themachine-readable Corresponding Source under the terms of this License,in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excludedfrom the Corresponding Source as a System Library, need not beincluded in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means anytangible personal property which is normally used for personal, family,or household purposes, or (2) anything designed or sold for incorporationinto a dwelling. In determining whether a product is a consumer product,doubtful cases shall be resolved in favor of coverage. For a particularproduct received by a particular user, "normally used" refers to atypical or common use of that class of product, regardless of the statusof the particular user or of the way in which the particular useractually uses, or expects or is expected to use, the product. A productis a consumer product regardless of whether the product has substantialcommercial, industrial or non-consumer uses, unless such uses representthe only significant mode of use of the product.
"Installation Information" for a User Product means any methods,procedures, authorization keys, or other information required to installand execute modified versions of a covered work in that User Product froma modified version of its Corresponding Source. The information mustsuffice to ensure that the continued functioning of the modified objectcode is in no case prevented or interfered with solely becausemodification has been made.
If you convey an object code work under this section in, or with, orspecifically for use in, a User Product, and the conveying occurs aspart of a transaction in which the right of possession and use of theUser Product is transferred to the recipient in perpetuity or for afixed term (regardless of how the transaction is characterized), theCorresponding Source conveyed under this section must be accompaniedby the Installation Information. But this requirement does not applyif neither you nor any third party retains the ability to installmodified object code on the User Product (for example, the work hasbeen installed in ROM).
The requirement to provide Installation Information does not include arequirement to continue to provide support service, warranty, or updatesfor a work that has been modified or installed by the recipient, or forthe User Product in which it has been modified or installed. Access to anetwork may be denied when the modification itself materially andadversely affects the operation of the network or violates the rules andprotocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,in accord with this section must be in a format that is publiclydocumented (and with an implementation available to the public insource code form), and must require no special password or key forunpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of thisLicense by making exceptions from one or more of its conditions.Additional permissions that are applicable to the entire Program shallbe treated as though they were included in this License, to the extentthat they are valid under applicable law. If additional permissionsapply only to part of the Program, that part may be used separatelyunder those permissions, but the entire Program remains governed bythis License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your optionremove any additional permissions from that copy, or from any part ofit. (Additional permissions may be written to require their ownremoval in certain cases when you modify the work.) You may placeadditional permissions on material, added by you to a covered work,for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material youadd to a covered work, you may (if authorized by the copyright holders ofthat material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered "furtherrestrictions" within the meaning of section 10. If the Program as youreceived it, or any part of it, contains a notice stating that it isgoverned by this License along with a term that is a furtherrestriction, you may remove that term. If a license document containsa further restriction but permits relicensing or conveying under thisLicense, you may add to a covered work material governed by the termsof that license document, provided that the further restriction doesnot survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, youmust place, in the relevant source files, a statement of theadditional terms that apply to those files, or a notice indicatingwhere to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in theform of a separately written license, or stated as exceptions;the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expresslyprovided under this License. Any attempt otherwise to propagate ormodify it is void, and will automatically terminate your rights underthis License (including any patent licenses granted under the thirdparagraph of section 11).
However, if you cease all violation of this License, then yourlicense from a particular copyright holder is reinstated (a)provisionally, unless and until the copyright holder explicitly andfinally terminates your license, and (b) permanently, if the copyrightholder fails to notify you of the violation by some reasonable meansprior to 60 days after the cessation.
Moreover, your license from a particular copyright holder isreinstated permanently if the copyright holder notifies you of theviolation by some reasonable means, this is the first time you havereceived notice of violation of this License (for any work) from thatcopyright holder, and you cure the violation prior to 30 days afteryour receipt of the notice.
Termination of your rights under this section does not terminate thelicenses of parties who have received copies or rights from you underthis License. If your rights have been terminated and not permanentlyreinstated, you do not qualify to receive new licenses for the samematerial under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive orrun a copy of the Program. Ancillary propagation of a covered workoccurring solely as a consequence of using peer-to-peer transmissionto receive a copy likewise does not require acceptance. However,nothing other than this License grants you permission to propagate ormodify any covered work. These actions infringe copyright if you donot accept this License. Therefore, by modifying or propagating acovered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automaticallyreceives a license from the original licensors, to run, modify andpropagate that work, subject to this License. You are not responsiblefor enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of anorganization, or substantially all assets of one, or subdividing anorganization, or merging organizations. If propagation of a coveredwork results from an entity transaction, each party to thattransaction who receives a copy of the work also receives whateverlicenses to the work the party's predecessor in interest had or couldgive under the previous paragraph, plus a right to possession of theCorresponding Source of the work from the predecessor in interest, ifthe predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of therights granted or affirmed under this License. For example, you maynot impose a license fee, royalty, or other charge for exercise ofrights granted under this License, and you may not initiate litigation(including a cross-claim or counterclaim in a lawsuit) alleging thatany patent claim is infringed by making, using, selling, offering forsale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under thisLicense of the Program or a work on which the Program is based. Thework thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claimsowned or controlled by the contributor, whether already acquired orhereafter acquired, that would be infringed by some manner, permittedby this License, of making, using, or selling its contributor version,but do not include claims that would be infringed only as aconsequence of further modification of the contributor version. Forpurposes of this definition, "control" includes the right to grantpatent sublicenses in a manner consistent with the requirements ofthis License.
Each contributor grants you a non-exclusive, worldwide, royalty-freepatent license under the contributor's essential patent claims, tomake, use, sell, offer for sale, import and otherwise run, modify andpropagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any expressagreement or commitment, however denominated, not to enforce a patent(such as an express permission to practice a patent or covenant not tosue for patent infringement). To "grant" such a patent license to aparty means to make such an agreement or commitment not to enforce apatent against the party.
If you convey a covered work, knowingly relying on a patent license,and the Corresponding Source of the work is not available for anyoneto copy, free of charge and under the terms of this License, through apublicly available network server or other readily accessible means,then you must either (1) cause the Corresponding Source to be soavailable, or (2) arrange to deprive yourself of the benefit of thepatent license for this particular work, or (3) arrange, in a mannerconsistent with the requirements of this License, to extend the patentlicense to downstream recipients. "Knowingly relying" means you haveactual knowledge that, but for the patent license, your conveying thecovered work in a country, or your recipient's use of the covered workin a country, would infringe one or more identifiable patents in thatcountry that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction orarrangement, you convey, or propagate by procuring conveyance of, acovered work, and grant a patent license to some of the partiesreceiving the covered work authorizing them to use, propagate, modifyor convey a specific copy of the covered work, then the patent licenseyou grant is automatically extended to all recipients of the coveredwork and works based on it.
A patent license is "discriminatory" if it does not include withinthe scope of its coverage, prohibits the exercise of, or isconditioned on the non-exercise of one or more of the rights that arespecifically granted under this License. You may not convey a coveredwork if you are a party to an arrangement with a third party that isin the business of distributing software, under which you make paymentto the third party based on the extent of your activity of conveyingthe work, and under which the third party grants, to any of theparties who would receive the covered work from you, a discriminatorypatent license (a) in connection with copies of the covered workconveyed by you (or copies made from those copies), or (b) primarilyfor and in connection with specific products or compilations thatcontain the covered work, unless you entered into that arrangement,or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limitingany implied license or other defenses to infringement that mayotherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement orotherwise) that contradict the conditions of this License, they do notexcuse you from the conditions of this License. If you cannot convey acovered work so as to satisfy simultaneously your obligations under thisLicense and any other pertinent obligations, then as a consequence you maynot convey it at all. For example, if you agree to terms that obligate youto collect a royalty for further conveying from those to whom you conveythe Program, the only way you could satisfy both those terms and thisLicense would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you havepermission to link or combine any covered work with a work licensedunder version 3 of the GNU Affero General Public License into a singlecombined work, and to convey the resulting work. The terms of thisLicense will continue to apply to the part which is the covered work,but the special requirements of the GNU Affero General Public License,section 13, concerning interaction through a network will apply to thecombination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions ofthe GNU General Public License from time to time. Such new versions willbe similar in spirit to the present version, but may differ in detail toaddress new problems or concerns.
Each version is given a distinguishing version number. If theProgram specifies that a certain numbered version of the GNU GeneralPublic License "or any later version" applies to it, you have theoption of following the terms and conditions either of that numberedversion or of any later version published by the Free SoftwareFoundation. If the Program does not specify a version number of theGNU General Public License, you may choose any version ever publishedby the Free Software Foundation.
If the Program specifies that a proxy can decide which futureversions of the GNU General Public License can be used, that proxy'spublic statement of acceptance of a version permanently authorizes youto choose that version for the Program.
Later license versions may give you additional or differentpermissions. However, no additional obligations are imposed on anyauthor or copyright holder as a result of your choosing to follow alater version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BYAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHTHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTYOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAMIS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OFALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITINGWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYSTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANYGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THEUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OFDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRDPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OFSUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability providedabove cannot be given local legal effect according to their terms,reviewing courts shall apply local law that most closely approximatesan absolute waiver of all civil liability in connection with theProgram, unless a warranty or assumption of liability accompanies acopy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatestpossible use to the public, the best way to achieve this is to make itfree software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safestto attach them to the start of each source file to most effectivelystate the exclusion of warranty; and each file should have at leastthe "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.} Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a shortnotice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname} This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriateparts of the General Public License. Of course, your program's commandsmight be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,if any, to sign a "copyright disclaimer" for the program, if necessary.For more information on this, and how to apply and follow the GNU GPL, see<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your programinto proprietary programs. If your program is a subroutine library, youmay consider it more useful to permit linking proprietary applications withthe library. If this is what you want to do, use the GNU Lesser GeneralPublic License instead of this License. But first, please read<http://www.gnu.org/philosophy/why-not-lgpl.html>.
12345678910{ "schema_version": 1, "instance_id": "android/andreynovikov-trekarta", "platform": "android", "repo": "https://github.com/andreynovikov/trekarta", "commit": "5a305d56fa6330cb435de7d871c6eac440597c64", "patches": [], "package": "mobi.maptrek", "license": null}123456789#!/usr/bin/env bash# TEMPLATE (rb_unify) — review before use.set -euo pipefail: "${RB_PACKAGE:?must be exported by the runner from instance.json}"D="$(cd "$(dirname "$0")" && pwd)"; SER="${DEVICE_SERIAL:-emulator-5554}"APK="$(find "$D" -name '*.apk' | head -1)"[ -n "$APK" ] || { echo "ERROR: no apk found; extract reference.tar.gz first" >&2; exit 1; }adb -s "$SER" install -r -g "$APK"adb -s "$SER" shell monkey -p "$RB_PACKAGE" -c android.intent.category.LAUNCHER 1123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113{ "module": "computation", "total": 9, "passed": 9, "failed": 0, "pass_rate": 1.0, "rule": { "total": 9, "passed": 9, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 0, "passed": 0, "failed": 0, "pass_rate": 0 }, "vlm_ratio": 0.0, "audit": { "kit_api_version": 1, "existence": 0, "liveness": 0, "interactive": 9, "depth_ge1": 9, "depth_ge2": 9, "value": 9, "vlm_fine": 0 }, "results": [ { "test": "computation_coord_positive_pair", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "coordinates row shows '48.858000 2.294500'" }, { "test": "computation_coord_negative_pair", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "coordinates row shows '-19.500000 -11.999999'" }, { "test": "computation_coord_mixed_sign", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "coordinates row shows '37.774900 -122.419400'" }, { "test": "computation_coord_decimal_pair", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "coordinates row shows '10.100000 20.200000'" }, { "test": "computation_coord_zero_pair", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "coordinates row shows '0.000000 0.000000'" }, { "test": "computation_coord_short_decimals", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "coordinates row shows '45.500000 3.250000'" }, { "test": "computation_coord_distinct_outputs", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "two distinct inputs -> '12.345678 65.432100' and '-33.868800 151.209300'" }, { "test": "computation_coord_invalid_no_place", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "dialog stays open, 0 places created" }, { "test": "computation_coord_empty_no_place", "passed": true, "message": "", "depth": 2, "jump_kind": "value", "tier": 3, "expect": "dialog closes, 0 places created" } ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320{ "module": "interaction", "total": 31, "passed": 31, "failed": 0, "pass_rate": 1.0, "rule": { "total": 22, "passed": 22, "failed": 0, "pass_rate": 1.0 }, "vlm": { "total": 9, "passed": 9, "failed": 0, "pass_rate": 1.0 }, "vlm_ratio": 0.4091, "audit": { "kit_api_version": 1, "existence": 0, "liveness": 0, "interactive": 31, "depth_ge1": 30, "depth_ge2": 15, "value": 0, "vlm_fine": 7 }, "results": [ { "test": "interaction_place_saved_snackbar_vlm", "passed": true, "message": "VLM: Q='Is a dark snackbar/toast shown near the bottom of the screen containing the text 'Place saved'?' A=YES expect=YES", "depth": 0, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is a dark snackbar/toast shown near the bottom of the screen containing the text 'Place saved'?", "tag": "content" }, { "test": "interaction_create_place_marker_vlm", "passed": true, "message": "VLM: Q='Is a map pin/marker drawn near the centre of the map, with the text label 'Place #1' next to it?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is a map pin/marker drawn near the centre of the map, with the text label 'Place #1' next to it?", "tag": "position" }, { "test": "interaction_create_place_longpress", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "empty-state before; row 'Place #1' + count 1 after" }, { "test": "interaction_two_markers_vlm", "passed": true, "message": "VLM: Q='Is a map pin/marker drawn near the vertical centre of the map with the text label 'Place #2' shown directly above it?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is a map pin/marker drawn near the vertical centre of the map with the text label 'Place #2' shown directly above it?", "tag": "position" }, { "test": "interaction_create_two_places", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "rows ['Place #1','Place #2'] both present" }, { "test": "interaction_multi_record_integrity", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "3 rows: 'Place #1','Place #3','kit_mid_B' present, 'Place #2' absent" }, { "test": "interaction_rename_map_label_vlm", "passed": true, "message": "VLM: Q='Is the text label 'kit_rec_A' drawn on the map next to a pin/marker?' A=YES expect=YES", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is the text label 'kit_rec_A' drawn on the map next to a pin/marker?", "tag": "content" }, { "test": "interaction_rename_place", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "row 'kit_rec_A' present, 'Place #1' absent" }, { "test": "interaction_rename_persists", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "row 'kit_persist_C' present after relaunch" }, { "test": "interaction_create_persists", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "row 'Place #1' present after relaunch" }, { "test": "interaction_multi_record_persists", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "rows ['Place #1','Place #2'] after relaunch" }, { "test": "interaction_create_coordinate_dialog", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "place count 0->1 via coords" }, { "test": "interaction_delete_marker_gone_vlm", "passed": true, "message": "VLM: Q='Near the vertical centre of the map, is there NO pin/marker and NO text label reading 'Place #1' (the marker has been removed)?' A=YES expect=YES", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Near the vertical centre of the map, is there NO pin/marker and NO text label reading 'Place #1' (the marker has been removed)?", "tag": "position" }, { "test": "interaction_delete_place", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "place count 1->0" }, { "test": "interaction_delete_one_of_two", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "delete #1 -> only 'Place #2' remains" }, { "test": "interaction_rename_reopen_shows_new_name", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "reopened sheet name == 'kit_reopen_D', source 'My places'" }, { "test": "interaction_map_menu_marker_vlm", "passed": true, "message": "VLM: Q='Is a map pin/marker drawn on the map (a place was just added via the context menu)?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Is a map pin/marker drawn on the map (a place was just added via the context menu)?", "tag": "position" }, { "test": "interaction_add_place_map_menu", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "place count 0->1 via map menu" }, { "test": "interaction_map_context_menu", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "context menu with Share/Add/Navigate/Remember" }, { "test": "interaction_place_info_actions", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "edit+share+delete+navigate controls on sheet" }, { "test": "interaction_place_info_fab_vlm", "passed": true, "message": "VLM: Q='In the place-information panel, is there a round ORANGE floating action button positioned at the upper-right of the panel?' A=YES expect=YES", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: In the place-information panel, is there a round ORANGE floating action button positioned at the upper-right of the panel?", "tag": "position" }, { "test": "interaction_edit_color_swatch_vlm", "passed": true, "message": "VLM: Q='In this place-edit form, is there a small filled COLOURED circle (a colour swatch) shown to the right, near the Description field?' A=YES expect=YES", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: In this place-edit form, is there a small filled COLOURED circle (a colour swatch) shown to the right, near the Description field?", "tag": "color" }, { "test": "interaction_import_markers_vlm", "passed": true, "message": "VLM: Q='Are one or more map pins/markers now drawn on the map (imported places)?' A=YES expect=YES", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "VLM YES: Are one or more map pins/markers now drawn on the map (imported places)?", "tag": "position" }, { "test": "interaction_import_places", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "data-source row 'Sample Places' after import" }, { "test": "interaction_longpress_vs_tap_semantics", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "tap -> 0 places, long-press -> 1 place" }, { "test": "interaction_three_records_persist", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "rows {'Place #1','Place #2','Place #3'} after relaunch" }, { "test": "interaction_edit_description_persists", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "place-info description == 'kit_desc_E' after reopen" }, { "test": "interaction_rename_last_write_wins", "passed": true, "message": "", "depth": 3, "jump_kind": "transition", "tier": 2, "expect": "single row 'kit_second_G', earlier names absent" }, { "test": "interaction_create_delete_roundtrip", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "count 0->1->0" }, { "test": "interaction_import_persists", "passed": true, "message": "", "depth": 1, "jump_kind": "transition", "tier": 2, "expect": "data-source row 'Sample Places' after relaunch" }, { "test": "interaction_coord_place_has_info", "passed": true, "message": "", "depth": 2, "jump_kind": "transition", "tier": 2, "expect": "info sheet 'My places' + non-empty coordinates row" } ]}android/acclorite-book-story/LICENSEAdded+674
android/acclorite-book-story/instance.jsonAdded+17
android/acclorite-book-story/reference/launch.shAdded+9
android/acclorite-book-story/reference/patches/local-source.patchAdded+14
android/acclorite-book-story/tests/android_computation_eval.jsonAdded+197
android/acclorite-book-story/tests/android_interaction_eval.jsonAdded+191
android/acclorite-book-story/tests/android_navigation_eval.jsonAdded+308
android/acclorite-book-story/tests/android_states_eval.jsonAdded+279
android/acclorite-book-story/tests/android_structure_eval.jsonAdded+265
android/acclorite-book-story/tests/android_testgen_kit.pyAdded+1910
android/acclorite-book-story/tests/android_text_eval.jsonAdded+230
android/acclorite-book-story/tests/book_fixture.pyAdded+241
android/acclorite-book-story/tests/conftest.pyAdded+1
android/acclorite-book-story/tests/fixtures/BookStoryTest/test_book.txtAdded+43
android/acclorite-book-story/tests/fixtures/Books/alpha_wonderland.txtAdded+7
android/acclorite-book-story/tests/fixtures/Books/testbook.txtAdded+11
android/acclorite-book-story/tests/requirements.txtAdded+2
android/acclorite-book-story/tests/test_android_computation.pyAdded+750
android/acclorite-book-story/tests/test_android_interaction.pyAdded+680
android/acclorite-book-story/tests/test_android_navigation.pyAdded+650
android/acclorite-book-story/tests/test_android_states.pyAdded+1044
android/acclorite-book-story/tests/test_android_structure.pyAdded+734
android/acclorite-book-story/tests/test_android_text.pyAdded+745
android/acclorite-book-story/tests/test_manifest.jsonAdded+887
android/acclorite-book-story/vlm_assertions.jsonAdded+756
android/alialbaali-noto/LICENSE.mdAdded+201
android/alialbaali-noto/instance.jsonAdded+10
android/alialbaali-noto/reference/launch.shAdded+9
android/alialbaali-noto/tests/android_computation_eval.jsonAdded+233
android/alialbaali-noto/tests/android_interaction_eval.jsonAdded+228
android/alialbaali-noto/tests/android_navigation_eval.jsonAdded+263
android/alialbaali-noto/tests/android_states_eval.jsonAdded+295
android/alialbaali-noto/tests/android_structure_eval.jsonAdded+229
android/alialbaali-noto/tests/android_testgen_kit.pyAdded+1851
android/alialbaali-noto/tests/android_text_eval.jsonAdded+206
android/alialbaali-noto/tests/conftest.pyAdded+1
android/alialbaali-noto/tests/requirements.txtAdded+2
android/alialbaali-noto/tests/test_android_computation.pyAdded+615
android/alialbaali-noto/tests/test_android_interaction.pyAdded+722
android/alialbaali-noto/tests/test_android_navigation.pyAdded+589
android/alialbaali-noto/tests/test_android_states.pyAdded+959
android/alialbaali-noto/tests/test_android_structure.pyAdded+564
android/alialbaali-noto/tests/test_android_text.pyAdded+719
android/alialbaali-noto/tests/test_manifest.jsonAdded+885
android/alialbaali-noto/vlm_assertions.jsonAdded+796
android/andreynovikov-trekarta/LICENSEAdded+675
android/andreynovikov-trekarta/instance.jsonAdded+10
android/andreynovikov-trekarta/reference/launch.shAdded+9
android/andreynovikov-trekarta/tests/android_computation_eval.jsonAdded+113
android/andreynovikov-trekarta/tests/android_interaction_eval.jsonAdded+320