twk_test 0.3.0
twk_test: ^0.3.0 copied to clipboard
Tests for twk apps: the real app on a terminal in memory under a fake clock, input as a terminal's bytes, the screen read by an emulator.
Changelog #
0.3.0 #
Breaking:
- A test fails on an error its app logged, unless it takes it with
TwkTester.takeErrors(). Readingt.logstakes nothing.
Added:
waitForandwaitUntiltakestate: what a failure says of where things stood.TwkTester.pumpWidget(remote:).FakeCliTerminal.interactive(answers:), an entry typed as each question shows, andFakeCliTerminal.onPrompt.find.textContaining(pattern), aStringor aRegExp.
0.2.0 #
FakeCliTerminal.openInlineopens the inline terminal again once the last one is closed (a session ended by a Ctrl+C, then another), as the process's own terminal now does, and throws only while one is open; it threw on any second open ("stdin is closed").openedcounts each. A test that relied on the second open throwing gets a new terminal.
Breaking:
describeScreenprints the screen as plain text unlessstyles: true; it marked styles always before.describeApplost itsstyles.containsLineandhasTextAttakewithinas aFinderonly; a rectangle goes inwithinRect, aCellRect(the onerectgives andlinesIntakes, now a public typedef). Both together is anArgumentError.TwkTester.pointerShapethrows aStateErrorunlesspumpWidget(pointerShapes: true); it read null there, so anisNullcould pass for the wrong reason.
0.1.0 #
The first release.
testTwkandTwkTester: an app on a terminal in memory under aFakeClock;pumpWidget,pump,pumpUntilIdle; keys, text, the mouse, paste, focus and resizes as the bytes a terminal sends; the fullscreen and the inline modes and a fixed viewport.- The screen read back through
Vt, a strict emulator (kitty graphics, sixel and iTerm2 images among what it takes):lines,cell, and matchers such ascontainsLine,matchesScreen,matchesScreenFile(golden files,TWK_UPDATE_GOLDENS=1) andstyleAt. - Finders (
find.text,find.byType,find.byKey, …) and taps on what they find (clickOn). - The frames an app wrote (
RecordedFrame), printed when a test fails and written as a trace (writeTrace). Shot: a widget tree or a render object drawn without an app.VtTerminal, a terminal backend in the inline mode over the emulator.waitForandwaitUntilfor what only real time brings;compiledProgram,startProcessandrunProcessfor a program a test runs in a process of its own, ended with the test.