-
Notifications
You must be signed in to change notification settings - Fork 2.5k
test(tui): Set up TUI tests #3789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
6f64829 to
be685e9
Compare
|
@kommander Please ignore the fact that I sometimes use If this rings a bell and you know a fix, please let me know. (I'm using vscode) |
|
I am not using a debugger at the moment, so I can't really help with the breakpoint problem, although I suspect the solid plugin compilation messing up the line numbers, the issue exists in tests where in failures the stack traces are wrong. Maybe @Adictya has an idea here. Regarding the test setup, that is a good start. However I am a bit scared by the many unit mocks. I would rather mock less and at a lower level, so it's more like "integration" tests for the tui, where only the interface to the server/sdk is mocked, so we can control model responses, errors etc. and test how the whole tui actually reacts to it. |
|
That makes sense, though I think a few more context providers should be mocked by default in addition to server/sdk. Please see commit d86a5cc#diff-4ac50cbf1a587d44e1de3cca0938ee733680bdb151025778d721a6797477d123R19 where I disable some mocks. I tried to choose a reasonable subset, let me know if you disagree. |
I debug directly via |
|
Yeah I also do |
|
@kommander Tests are coming along nicely. I expect to have a bunch more ready by end of day. Do you have any special ones to pay attention to? Btw I also ran into this: 865d610#diff-136aadfe331bad702903358a242e704fbd853464f9e83c6fcd4d54fd3c71258aR353 |
|
Cool, I'll review in a bit. Is that segfault reproducible somehow in a test? |
|
Happens in home.test.ts -> Model dialog -> "should open model dialog". When I skip that test the issue doesn't happen. At the moment I'm writing the error is always a segfault, but earlier today it would sometimes segfault and sometimes throw |
- Add snapshot test for autocomplete menu when typing "/" - Reformat existing test imports and expectations for consistency
- Test that typing "/ex" narrows to "/exit" in autocomplete - Test that pressing enter after "/ex" triggers the exit action
|
@kommander Converted the tests to E2E per dax's suggestion. Found some opentui issues - I'm gonna create gh issues for them after taking a breather. Please give me some feedback (quick glance is fine). I would like to keep writing tests while I'm in the flow, but also don't wanna waste my time diving into a rabbit hole only to have it rejected later. |
@kommander I have created a comprehensive mock context setup and a few tests to get things going.
My plan was to add tests all day today (Monday). If you are not in a super hurry to maximize coverage, I would like to tinker a bit with the utility functions. Otherwise, we can work on different tests in parallel if you want.
Todos: