Commit Graph

74 Commits

Author SHA1 Message Date
Isaiah Odhner
c5e96ef580 Add todos to module-level docstring 2023-09-11 18:02:20 -04:00
Isaiah Odhner
021bc8a93c Simplify escaping of triple quotes 2023-09-11 18:02:20 -04:00
Isaiah Odhner
8614787e3d Add newline to separate related code 2023-09-11 18:02:20 -04:00
Isaiah Odhner
340c7ce74e Add Ctrl+R to restart and replay the recording 2023-09-11 18:02:20 -04:00
Isaiah Odhner
84ff381f04 This might handle multi-screen apps (untested) 2023-09-11 18:02:20 -04:00
Isaiah Odhner
f62c8ff6c9 Highlight active step during playback
I love when GitHub Copilot suggests code using an API (or language feature / idiom etc.) that I didn't even know about.
More often it'll just make something up, but `highlight_lines` actually exists!

Anyways, I'm doing a hacky thing to get it to highlight lines of code during execution,
prepending code (invisibly) to each line, except lines that would cause a syntax error.

Also, the steps view isn't updating reliably (even when adding steps).
2023-09-11 18:02:20 -04:00
Isaiah Odhner
5e55846fb2 Add steps view
This isn't very useful yet without highlighting of the current step in playback.
2023-09-11 18:02:20 -04:00
Isaiah Odhner
b590d807a7 Add todo/thoughts about drag vs click ambiguity 2023-09-11 18:02:20 -04:00
Isaiah Odhner
5b0d8c703a Refactor: use set instead of dict for helper codes
Don't need arbitrary IDs for them.
2023-09-11 18:02:20 -04:00
Isaiah Odhner
87c9c192e0 Disable event comments in generated code 2023-09-11 18:02:20 -04:00
Isaiah Odhner
196ae0e810 Speed up drags during playback 2023-09-11 18:02:20 -04:00
Isaiah Odhner
1a53a18912 Fix IndexError when undoing all the way 2023-09-11 18:02:20 -04:00
Isaiah Odhner
402b46c7df Make failing to create a selector non-fatal 2023-09-11 18:02:20 -04:00
Isaiah Odhner
d6d9ddba67 Add a todo 2023-09-11 18:02:20 -04:00
Isaiah Odhner
9739422936 Show every event with comments in generated code 2023-09-11 18:02:20 -04:00
Isaiah Odhner
baa2b8cbc6 Fix batch undoing for drags 2023-09-11 18:02:20 -04:00
Isaiah Odhner
0e9f6d28a7 Implement recording/replaying drags 2023-09-11 18:02:20 -04:00
Isaiah Odhner
52f319da24 Refactor: split method
(This is probably pointless.)
2023-09-11 17:59:56 -04:00
Isaiah Odhner
82a5b201d4 WIP: make test recorder more generic to apps 2023-09-11 17:59:56 -04:00
Isaiah Odhner
2fb9e64c4f DRY generated code with a helper function 2023-09-11 17:59:56 -04:00
Isaiah Odhner
b9503e44f4 This is somewhat more reliable (maybe just due to the delay....) 2023-09-11 17:59:56 -04:00
Isaiah Odhner
2a7b4412e1 Add docstrings, rename method
The new method name reflects the fact that it handles some input as commands, not just recording the events.
2023-09-11 17:59:56 -04:00
Isaiah Odhner
96ef2dfdff Whitespace: organize imports 2023-09-11 17:59:56 -04:00
Isaiah Odhner
70284d6f94 Tweak comment about event recording 2023-09-11 17:59:56 -04:00
Isaiah Odhner
792d5c8294 Ignore duplicate events in a much less hacky way
Immediately reduce tech debt.
2023-09-11 17:59:56 -04:00
Isaiah Odhner
ea07b54315 Ignore every other event
It's the simplest thing that could possibly work.
And it does, as a matter of fact.
2023-09-11 17:59:56 -04:00
Isaiah Odhner
a10b9eac11 Allow Ctrl+Z also while replaying in test recorder 2023-09-11 17:59:56 -04:00
Isaiah Odhner
c395f4e8f3 Exit from test recorder on Ctrl+C after test saved 2023-09-11 17:59:55 -04:00
Isaiah Odhner
a2e1b6cfd8 Record events before they're handled normally
This might fix a race condition that lead to a `query` raising `NoMatches`, but this is just theoretical.
Regardless, this seems like the way to go.
Generating the selectors to match the clicked widget needs a view of the DOM before the widget is removed from it (or reordered in the DOM etc.)
2023-09-11 17:59:55 -04:00
Isaiah Odhner
61c9b4e49e Fix undo seemingly not working
Stop recording mouse events that aren't even handled yet,
and which should be undone in batches when they are recorded.
2023-09-11 17:59:54 -04:00
Isaiah Odhner
941b2b52e6 Auto-save replay code for debugging purposes 2023-09-11 17:57:01 -04:00
Isaiah Odhner
43ae6f7365 Add assert for type checker 2023-09-11 17:56:03 -04:00
Isaiah Odhner
26f6bfe8ed Convert test recorder to OOP
Never have I ever been this `self`-conscious...
2023-09-11 17:56:03 -04:00
Isaiah Odhner
c37a123be4 Add module docstring 2023-09-11 17:56:03 -04:00
Isaiah Odhner
bef86c95bc Clean up 2023-09-11 17:56:03 -04:00
Isaiah Odhner
78e86f1bc1 Enable recording key events 2023-09-11 17:56:03 -04:00
Isaiah Odhner
3cebba06ec WIP: handle edge cases 2023-09-11 17:56:03 -04:00
Isaiah Odhner
2fb0dc2467 Good progress on stepwise undo (+gaurd against NoWidget) 2023-09-11 17:56:03 -04:00
Isaiah Odhner
8a2f4d6b72 WIP on stepwise undo app lifecycle
No error... until 30s passes.
WaitForScreenTimeout: Timed out while waiting for widgets to process pending messages.
2023-09-11 17:56:03 -04:00
Isaiah Odhner
74c3c49eb7 WIP on stepwise undo app lifecycle spaghetti code 2023-09-11 17:56:03 -04:00
Isaiah Odhner
961e9a1560 WIP trying to get stepwise undo working (and complicating things) 2023-09-11 17:56:03 -04:00
Isaiah Odhner
8838250e94 WIP on test recorder click offsets 2023-09-11 17:56:03 -04:00
Isaiah Odhner
24b9b9986c WIP on test recorder 2023-09-11 17:56:03 -04:00
Isaiah Odhner
0c43b7ff5a WIP: Make test recorder for Pilot tests 2023-09-11 17:56:03 -04:00
Isaiah Odhner
dedeedb129 Debug Polygon test by running interactively 2023-09-11 17:56:03 -04:00
Isaiah Odhner
86a403eb80 WIP: test polygon tool prematurely closing polygon 2023-09-11 17:56:03 -04:00
Isaiah Odhner
1ae3cbe37b WIP: test polygon tool 2023-09-11 17:56:02 -04:00
Isaiah Odhner
2e89e73f37 Fix About Paint dialog test failing due to version string changes
Make version info static when running in pytest.

I also tried adding in test_snapshots.py:

    import textual_paint
    textual_paint.__version__ = "snapshot test edition 1"

    import textual_paint.__init__ as init
    init.__version__ = "snapshot test edition 2"

which seemed to have no effect.

Since I already have special case logic for __version__ in __init__.py,
I'm reasonably happy with this solution.
2023-09-09 00:19:39 -04:00
Isaiah Odhner
9f12ba7833 Guard against future usage of unique class at runtime 2023-09-08 23:49:52 -04:00
Isaiah Odhner
cc6b0d65c0 Unify import style 2023-09-08 23:47:09 -04:00