Commit Graph

1541 Commits

Author SHA1 Message Date
Isaiah Odhner
ec774c264a Test Polygon tool! 2023-09-11 22:11:02 -04:00
Isaiah Odhner
e849af1dcd Add to todos 2023-09-11 21:42:09 -04:00
Isaiah Odhner
304f18c3f4 Import helpers instead of including them in generated code 2023-09-11 21:42:09 -04:00
Isaiah Odhner
85d601b262 Refactor tests that click a tool button 2023-09-11 21:16:13 -04:00
Isaiah Odhner
6e7a3445e0 DRY widget clicking helpers (use one in the other) 2023-09-11 20:23:15 -04:00
Isaiah Odhner
95d89a6e7f Move Pilot test helpers to a file 2023-09-11 19:40:20 -04:00
Isaiah Odhner
7f379103a6 Accept new Text tool test snapshots 2023-09-11 19:35:04 -04:00
Isaiah Odhner
0d9f62a4c3 Skip polygon test for now 2023-09-11 19:24:41 -04:00
Isaiah Odhner
6c108294b8 Add modifier options to click_by_index (not recorded yet) 2023-09-11 19:12:26 -04:00
Isaiah Odhner
d6399022ee Fix/cleanup test_text_tool_cursor_keys_and_color
- Fix `APP_PATH` reference error
- Hold Ctrl to set the foreground color (modifiers not recorded yet)
- DRY `pilot.press`
- Use same terminal size as many other tests
- Seven isn't spelt with a 2, but zero is! ;)
2023-09-11 19:10:18 -04:00
Isaiah Odhner
3b76ba0997 Accept mysterious ID changes to file dialog snapshots
WITHOUT accepting new WIP Polygon and Text tool tests
2023-09-11 18:45:21 -04:00
Isaiah Odhner
5426ed14a3 Use semantic key synonym 2023-09-11 18:02:20 -04:00
Isaiah Odhner
155b0e4c99 Wait only at start of playback, not before each drag/click in test 2023-09-11 18:02:20 -04:00
Isaiah Odhner
2b447a06d6 WIP: Polygon and Text tool tests 2023-09-11 18:02:20 -04:00
Isaiah Odhner
58ddc7e856 Add a word in docstring
I would've named the class `TestRecorder` if the file name `test_recorder.py` wouldn't be picked up by pytest as a test file...
2023-09-11 18:02:20 -04:00
Isaiah Odhner
2d03709565 Rename placeholders to sound less hand-wavy 2023-09-11 18:02:20 -04:00
Isaiah Odhner
a844cd7967 Make output_file a parameter; add __init__ docstring 2023-09-11 18:02:20 -04:00
Isaiah Odhner
405cc1bf4e Make test recorder generic to apps
The only mention of Paint is at construction time now.
2023-09-11 18:02:20 -04:00
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