Releases: passsy/spot
v0.15.0
- Add
loadAppFonts()
to display your app fonts on screenshots #66 - Add
loadFont()
to load a fonts from a file. Useful when your app depends on preinstalled system fonts (loadFont('Comic Sans', [r'C:\Windows\Fonts\comic.ttf'])
) #66 - New direct access to properties from
WidgetSelector
#71spot<MyWidget>().getWidgetProp(widgetProp('color', (widget) => widget.color));
spot<_MyContainer>().getStateProp(stateProp<String, _MyContainerState>('innerValue', (s) => s.innerValue));
spot<_MyContainer>().getRenderObjectProp(renderObjectProp<Size, RenderBox>('size', (r) => r.size));
- New
getStateProp
andstateProp
to access state properties #71
spot<_MyContainer>().existsOnce().getStateProp(stateProp('innerValue', (_MyContainerState s) => s.innerValue));
- New
timeline
modeTimelineMode.always
to always print a timeline after each test #68 - Deprecate
TimelineMode.record
in favor ofTimelineMode.reportOnError
(which is the default) #68 - Timeline now shows partial tap warnings #69
- Never show big widget tree dumps in console, only in Timeline HTML report #70
act.tap()
now shows a Crosshair on the screenshot- Fix code samples of
whereWidgetProp()
,whereElementProp()
andwhereRenderObjectProp()
#67
v0.14.0
- New: Timeline! Failing tests now print a timeline with screenshots of all interactions (actions and assertions) as HTML report #57
act.tap
now checks for multiple tappable position when the center is not tappable for some reason #60act.tap
now reports a useful error when the widget is 0px/0px or invisible #61- Become Compatible with Flutter 3.27 and add nightly tests against
master
v0.13.0
v0.12.1
v0.4.3
v0.3.3
v0.12.0
- Breaking
Offstage
support. By defaultOffstage
widgets are not found byspot<W>()
. UsespotOffstage().spot<W>()
to find them.spotAllWidgets()
returns onstage and offstage widgets. Use.overrideWidgetPresence(WidgetPresence.offstage)
to modify aWidgetSelector
to search foroffstage
,onstage
orcombined
#45 - New:
act.enterText(spot<TextField>(), 'Hello World!')
allows to enter text into aEditableText
#51 - Negating parents is not yet supported (
spot<ListView>().withParent(spot<Scaffold>().atMost(0))
). It now throws to prevent unexpected behavior. #50 act.tap(spot<ElevatedButton>())
now pumps automatically after the tap #52
v0.11.0
v0.10.0
High-level API changes
- Breaking
spotText('dash')
can now return multiple widgets - New:
.atLeast(n)
and.atMost(n)
and.amount(n)
to force the number of expected widgets.
.atMost(0)
can be used to test that a widget does not exist! - Deprecated:
spotSingle<W>()
is now deprecated. Usespot<W>()
instead, orspot<W>().atMost(1)
to indicate that only a single widget is expected. - Fix:
.first()
and.last()
- New:
.atIndex(n)
allows to get the widget at a specific index (when multiple are found) - Deprecate:
allWidgets
in favor ofspotAllWidgets()
to avoid conflicts with local variables - New:
getDiagnosticProp<T>('name')
for easy access to the values of a diagnostic property #40 - New:
hasEffectiveTextStyle
,withEffectiveTextStyleMatching()
,withEffectiveTextStyle()
#36, #38 - Improve:
WidgetSelector.toString()
has been improved, has now separators for stages and adds braces.
Example:Center with child SizedBox ❯ with parent (Scaffold ᗕ Row)
- Added tons of documentation and examples
Advanced API changes
Those changes can be breaking for packages that depend on spot
or advanced usages, but should not affect most users.
- Breaking
WidgetSelector
now hasList<ElementFilter> stages
, replacing the previousprops
,parents
,children
andelementFilters
. - Breaking
WidgetSelector
constructor andcopyWith
signature changed, reflecting the new properties.
createElementFilters()
,createCandidateGenerator()
andtoStringWithoutParents()
have been removed. WidgetSelector
now has aquantityConstraint
property (deprecatesexpectedQuantity
) that allows setting themin
andmax
number of expected widgets.WidgetSelector
replacesSingleWidgetSelector
andMultiWidgetSelector
- Breaking Quantity assertions like
.doesNotExist()
or.existsOnce()
now returnWidgetMatcher
/MultiWidgetMatcher
instead ofWidgetSnapshot
.
To get theWidgetSnapshot
usesnapshot()
instead. - Breaking Remove
WidgetSelector.cast
because it lost information and was untested - Breaking
PropFilter
has been renamed toPredicateFilter
- Breaking
PredicateWithDescription
has been removed - Breaking
CandidateGenerator
has been removed - Explicitly export all classes/extensions/functions to prevent accidental leaks of internal APIs
v0.7.0
-
New prop API with
hasWidgetProp()
makes it easy to filter and assert properties of Widgets.
This replaces the oldhasProp()
method which was based on way to complicated package:checks context.// Old ⛈️ spotSingle<Checkbox>().existsOnce().hasProp( selector: (e) => e.context.nest( () => ['Checkbox', 'value'], (e) => Extracted.value((e.widget as Checkbox).value), ), match: (it) => it.equals(true), );
// New ✨ spotSingle<Checkbox>().existsOnce().hasWidgetProp( prop: widgetProp('value', (widget) => widget.value), match: (value) => value.isTrue(), );
The prop API is also available for
Element
andRenderObject
.New API methods for the prop API ├── Interface "NamedWidgetProp" added ├── Interface "NamedElementProp" added ├── Interface "NamedRenderObjectProp" added ├── Function "widgetProp" added ├── Function "elementProp" added ├── Function "renderObjectProp" added ├─┬ Class SelectorQueries │ ├── Method "whereWidgetProp" added │ ├── Method "whereElementProp" added │ └── Method "whereRenderObjectProp" added └─┬ Class WidgetMatcherExtensions ├── Method "getWidgetProp" added ├── Method "hasWidgetProp" added ├── Method "getElementProp" added ├── Method "hasElementProp" added ├── Method "getRenderObjectProp" added └── Method "hasRenderObjectProp" added
-
Never miss asserting your
WidgetSelector
.
All methods returning aWidgetSelector
are now annotated with@useResult
.
This will cause a lint warning when you only define aWidgetSelector
without asserting it.spot<FloatingActionButton>().withChild(spotIcons(Icons.add)); // warning, no assertion final plusFab = spot<FloatingActionButton>().withChild(spotIcons(Icons.add)); // ok, assigned spot<FloatingActionButton>().withChild(spotIcons(Icons.add)).existsOnce(); // ok, asserted
-
It is now easy to directly access the Widget of a
SingleWidgetSelector
withsnapshotWidget()
.
It also works for the associatedElement
andRenderObject
. UsesnapshotElement()
andsnapshotRenderObject()
.-final checkbox = spotSingle<Checkbox>().snapshot().widget; +final checkbox = spotSingle<Checkbox>().snapshotWidget(); print(checkbox.checkColor);