rehlma / flutter-domain-robot-scenariosr1
Keep UI scenarios in domain vocabulary
PublicScenarios call robot actions; robots own selection, gestures, pumping and typed observability.
tests, run by the registry6 passed · slowest 3.3 ms
✓fires3.3 ms
reports newly written problematic code
write test/scenarios/settings_test.dart · in fixtures/flutterfired: line 1
await tester.tap(find.byType(Button));✓quiet1.8 ms
allows the intended form
write test/scenarios/settings_test.dart · in fixtures/flutterstayed quiet
await robot.openSettings();✓quiet1.6 ms
does not apply to a pure Dart package
write test/scenarios/settings_test.dart · in fixtures/dartstayed quiet
await tester.tap(find.byType(Button));✓skips0.0 ms
does not judge reads
read test/scenarios/settings_test.dart · in fixtures/flutterno handler of the detector wants this event
await tester.tap(find.byType(Button));✓quiet1.7 ms
does not report an untouched legacy line
write test/scenarios/settings_test.dart · in fixtures/flutter · wrote line 2stayed quiet
await tester.tap(find.byType(Button));
final added = 1;✓skips0.0 ms
allows isolated widget tests and robot implementation
write test/widgets/button_test.dart · in fixtures/flutterno handler of the detector wants this event
await tester.tap(find.byType(Button));write test/robot/settings_robot.dart · in fixtures/flutterno handler of the detector wants this event
await tester.pump();detector.test.tseach detect() call runs the real detector
import { expect, test } from 'vitest';
import { detect, write, edit, read, command, output, prompt } from '@wellactually/sdk/v3/test';
const flutter = { project: 'fixtures/flutter' };
const dart = { project: 'fixtures/dart' };
test('reports newly written problematic code', () => {
expect(detect(write("test/scenarios/settings_test.dart", "await tester.tap(find.byType(Button));"), flutter)).toEqual([{ line: 1 }]);
});
test('allows the intended form', () => {
expect(detect(write("test/scenarios/settings_test.dart", "await robot.openSettings();"), flutter)).toEqual([]);
});
test('does not apply to a pure Dart package', () => {
expect(detect(write("test/scenarios/settings_test.dart", "await tester.tap(find.byType(Button));"), dart)).toEqual([]);
});
test('does not judge reads', () => {
expect(detect(read("test/scenarios/settings_test.dart", "await tester.tap(find.byType(Button));"), flutter)).toEqual([]);
});
test('does not report an untouched legacy line', () => {
expect(detect(edit("test/scenarios/settings_test.dart", "await tester.tap(find.byType(Button));\nfinal added = 1;", { written: 'final added = 1;' }), flutter)).toEqual([]);
});
test('allows isolated widget tests and robot implementation', () => {
expect(detect(write('test/widgets/button_test.dart', 'await tester.tap(find.byType(Button));'), flutter)).toEqual([]);
expect(detect(write('test/robot/settings_robot.dart', 'await tester.pump();'), flutter)).toEqual([]);
});