fluttium 0.1.0-dev.1 copy "fluttium: ^0.1.0-dev.1" to clipboard
fluttium: ^0.1.0-dev.1 copied to clipboard

The core package for the Fluttium user flow testing framework

example/main.dart

import 'package:fluttium/fluttium.dart';

/// {@template custom_action}
/// A custom action for Fluttium.
///
/// An action is immutable and it represents a step in the user flow.
///
/// This action can be invoked either using the short-hand version:
///
/// ```yaml
/// - customAction: "Hello World"
/// ```
///
/// Or using the verbose version:
///
/// ```yaml
/// - customAction:
///   - text: "Hello World"
/// ```
/// {@endtemplate}
class CustomAction extends Action {
  /// {@macro custom_action}
  const CustomAction({
    required this.text,
  });

  final String? text;

  /// Called when it executes the action in a flow file.
  @override
  Future<bool> execute(Tester tester) async {
    if (text == null) {
      return false;
    }

    if (await ExpectVisible(text: text!).execute(tester)) {
      return PressOn(text: text).execute(tester);
    }
    return false;
  }

  @override
  String description() => 'Custom action "$text"';
}

/// Will be executed by Fluttium on startup.
void register(Registry registry) {
  registry.registerAction(
    'customAction',
    CustomAction.new,
    shortHandIs: #text,
  );
}
30
likes
0
pub points
79%
popularity

Publisher

verified publisherfluttium.dev

The core package for the Fluttium user flow testing framework

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

clock, flutter, fluttium_interfaces, fluttium_protocol

More

Packages that depend on fluttium