spot 0.10.0-beta.1
spot: ^0.10.0-beta.1 copied to clipboard
Chainable powerful finder API, screenshots and assertions for awesome widget tests.
Changelog #
0.10.0-beta.1 #
Eventually Breaking, but only the class names. The end user API stays the same.
spotSingle<W>()is now deprecated. Usespot<W>()instead, orspot<W>().atMost(1)to indicate that only a single widget is expected.WidgetSelectorreplacesSingleWidgetSelectorandMultiWidgetSelectorWidgetSelectornow has aquantityConstraintproperty (deprecatesexpectedQuantity) that allows setting theminandmaxnumber of expected widgets.- New:
.atIndex(n)allows to get the widget at a specific index (when multiple are found) - Fix:
.first()and.last()now work after calling.copyWith() - Breaking Quantity assertions like
.doesNotExist()or.existsOnce()now returnWidgetMatcher/MultiWidgetMatcherinstead ofWidgetSnapshot. To get theWidgetSnapshotusesnapshot()instead. spotText('a')can now return multiple widgets- Breaking remove
WidgetSelector.castbecause it lost information and was untested
0.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
ElementandRenderObject.├── 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 aWidgetSelectorare now annotated with@useResult. This will cause a lint warning when you only define aWidgetSelectorwithout asserting it.spot<FloatingActionButton>().withChild(spotIcon(Icons.add)); // warning, no assertion final plusFab = spot<FloatingActionButton>().withChild(spotIcon(Icons.add)); // ok, assigned spot<FloatingActionButton>().withChild(spotIcon(Icons.add)).existsOnce(); // ok, asserted -
It is now easy to directly access the Widget of a
SingleWidgetSelectorwithsnapshotWidget(). It also works for the associatedElementandRenderObject. UsesnapshotElement()andsnapshotRenderObject().-final checkbox = spotSingle<Checkbox>().snapshot().widget; +final checkbox = spotSingle<Checkbox>().snapshotWidget(); print(checkbox.checkColor);
0.6.0 #
- Add matchers
.existsAtMostOnce()and.existsAtMostNTimes(x)#19 - Add selector
.withParent(parent)/.withParents([...])#21 - Add selector
.withChild(child)/.withChildren([...])#21 - Child selectors now only match children #22
- You can call
act.tap()now with anyWidgetSelectorthat returns a single widget #23
0.5.0 #
- Breaking
act.tapis now async, useawait act.tap()#17 - New:
spotText('foo')finds any text on screen using "contains". The newAnyTextwidget combinesText,SelectableText,RichTextandEditableText#18 - New:
spotTextWhere((text) => )allows to match text with custom logic #18 - Deprecated:
spotSingleTextandspotTextsare deprecated in favor ofspotTextand the basicspot<Text>(),spot<SelectableText>(), ... #18 - Fix:
hasPropmatcher can now check for null values with(it) => it.isNull()#18 - Improvement:
withDiagnosticPropnow falls back to the default value of aDiagnosticNode#18
0.4.1 #
- Added screenshot methods #14
/// Takes a screenshot of the entire window await takeScreenshot(); /// Takes a screenshot of a single Screen/Widget final homePage = spotSingle<HomePage>(); await takeScreenshot(selector: homePage); /// Use it as extension await spotSingle<HomePage>().takeScreenshot(); - Export all types from
checks.dartwhich are required to usehasProp - Update for Flutter 3.13
0.4.0 #
- Added
act.tap(button)to tap widgets #9 - Raise min Flutter version to 3.10.0
- Switch to the official
checkspackage #12 - Rename
SingleWidgetSnapshot.discoveredElements->SingleWidgetSnapshot.discoveredElement#11
0.3.2 #
- Export all types from
checks.dartwhich are required to usehasProp
0.3.1 #
- Fix compilation error with Flutter 3.0.0
0.3.0 #
spotTextsnow matchesEditableTextandSelectableText#5spotTextsnow has generic type<W>instead of staticText. This changes the return type fromMultiWidgetSelector<Text>->MultiWidgetSelector<W>#5- Changed signature of
SingleWidgetSelector.withPropandMultiWidgetSelector.withProp. - New matchers for
EditableText,ListTile,SelectableText
0.2.2 #
- Support for Flutter 3.0.0 / Dart 2.17
0.2.1 #
- Fix
WidgetSelectorwith parents that have parents #4 - Require all children selector to match, not just one #4
0.2.0 #
- Reworked spot API #3
- Allow defining
WidgetSelectorwith children - Allow defining
WidgetSelectorwith parents - Interop with
FinderAPI - Match properties of widgets (via
DiagnosticsNode) - Allow matching of nested properties (with checks API)
- Generate code for custom properties for Flutter widgets
- Allow generating code for properties of 3rd party widgets
0.1.0-preview.2 #
- Update package description
- Add issue_tracker link
- Add example folder