You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a large UI where I would like to be able to do something like:
test"click user 3" {
varapp=app.init();
deferapp.deinit();
app.frame();
// imaginary API, probably can use existing event API but might be nice to have a helper// here that just assumes a center insertiondvui.testing.click(.UserWidget, .{ .id_extra=2 });
app.frame();
std.testing.expectEqual(app.selected_user_index, 2);
}
And the zig enum literal passed to test_tag could be used to have an efficient name that can be used to refer to the widget, with dvui erroring if you duplicate the same test_tag,id_extra pair.
As a separate issue, it would be nice to add a "null backend" to ignore drawing widgets, for
test scenarios, I will add such an issue later, right now I just don't initialize my backend which seems to work ok.
fyi, this is lightly based on the common pattern in webdev of adding data-testid attributes to DOM elements to query them in tests
The text was updated successfully, but these errors were encountered:
This is a good idea, and having a null testing backend is also a great idea. Could in the future be used to test if widgets are in/out of the clipping region for example.
Will put some thought into how to refer to widgets for testing purposes, how to insert events to match them, and the flow of tests. Need some way to specify longer logical tests like:
click button "Show Dialog"
maybe wait for dialog to finish animating
test if dialog button "ok" is visible (and maybe has focus)
I have a large UI where I would like to be able to do something like:
Then my app would have code like:
And the zig enum literal passed to
test_tag
could be used to have an efficient name that can be used to refer to the widget, with dvui erroring if you duplicate the sametest_tag,id_extra
pair.As a separate issue, it would be nice to add a "null backend" to ignore drawing widgets, for
test scenarios, I will add such an issue later, right now I just don't initialize my backend which seems to work ok.
fyi, this is lightly based on the common pattern in webdev of adding
data-testid
attributes to DOM elements to query them in testsThe text was updated successfully, but these errors were encountered: