Skip to content

Releases: passsy/spot

v0.12.1

16 May 11:26
Compare
Choose a tag to compare
  • Support for Flutter 3.22
  • Remove unused dependencies #55

v0.4.3

16 May 11:13
Compare
Choose a tag to compare
  • Remove unused dependencies. Fixes incompatibility with latest test_api versions #55

v0.3.3

16 May 11:12
Compare
Choose a tag to compare
  • Widen test_api range to support Flutter 3.22

v0.12.0

22 Mar 10:50
Compare
Choose a tag to compare
  • Breaking Offstage support. By default Offstage widgets are not found by spot<W>(). Use spotOffstage().spot<W>() to find them. spotAllWidgets() returns onstage and offstage widgets. Use .overrideWidgetPresence(WidgetPresence.offstage) to modify a WidgetSelector to search for offstage, onstage or combined #45
  • New: act.enterText(spot<TextField>(), 'Hello World!') allows to enter text into a EditableText #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

19 Feb 01:43
Compare
Choose a tag to compare
  • Add support for Flutter 3.20
  • Update checks to 0.3.0 #48
  • Remove deprecated property selector from withProp() and hasProp(). Use elementSelector instead
  • Widen test_api version range to include 0.7.X

v0.10.0

05 Feb 22:00
Compare
Choose a tag to compare

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. Use spot<W>() instead, or spot<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 of spotAllWidgets() 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 has List<ElementFilter> stages, replacing the previous props, parents, children and elementFilters.
  • Breaking WidgetSelector constructor and copyWith signature changed, reflecting the new properties.
    createElementFilters(), createCandidateGenerator() and toStringWithoutParents() have been removed.
  • WidgetSelector now has a quantityConstraint property (deprecates expectedQuantity) that allows setting the min and max number of expected widgets.
  • WidgetSelector replaces SingleWidgetSelector and MultiWidgetSelector
  • Breaking Quantity assertions like .doesNotExist() or .existsOnce() now return WidgetMatcher/MultiWidgetMatcher instead of WidgetSnapshot.
    To get the WidgetSnapshot use snapshot() instead.
  • Breaking Remove WidgetSelector.cast because it lost information and was untested
  • Breaking PropFilter has been renamed to PredicateFilter
  • 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

25 Dec 19:59
Compare
Choose a tag to compare
  • New prop API with hasWidgetProp() makes it easy to filter and assert properties of Widgets.
    This replaces the old hasProp() 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 and RenderObject.

    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 a WidgetSelector are now annotated with @useResult.
    This will cause a lint warning when you only define a WidgetSelector 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 with snapshotWidget().
    It also works for the associated Element and RenderObject. Use snapshotElement() and snapshotRenderObject().

    -final checkbox = spotSingle<Checkbox>().snapshot().widget;
    +final checkbox = spotSingle<Checkbox>().snapshotWidget();
    print(checkbox.checkColor);

v0.6.0

25 Dec 18:13
Compare
Choose a tag to compare
  • 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 any WidgetSelector that returns a single widget #23

v0.5.0

30 Aug 23:38
Compare
Choose a tag to compare
  • Breaking act.tap is now async, use await act.tap() #17
  • New: spotText('foo') finds any text on screen using "contains". The new AnyText widget combines Text, SelectableText, RichText and EditableText #18
  • New: spotTextWhere((text) => ) allows to match text with custom logic #18
  • Deprecated: spotSingleText and spotTexts are deprecated in favor of spotText and the basic spot<Text>(), spot<SelectableText>(), ... #18
  • Fix: hasProp matcher can now check for null values with (it) => it.isNull() #18
  • Improvement: withDiagnosticProp now falls back to the default value of a DiagnosticNode #18
// deprecated
spotSingleText("Hello");
spotSingleText<Text>("Hello");
spotTexts<EditableText>("Hello");

// New
spotText("Hello");
spotText("Hello", exact: true);
spotTextWhere((it) => it.startsWith("He"));

// With exact widget type
spot<Text>().whereText((it) => it.equals("Hello")).first();

v0.4.1

18 Aug 00:53
Compare
Choose a tag to compare
  • 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.dart which are required to use hasProp
  • Update for Flutter 3.13