CompositeAction - Galad/tranquire GitHub Wiki

A composite action, represented by the abstract class CompositeAction is an action that is composed of multiple actions.

Implementing a composite action

You can inherit from it to create more complex actions, just by passing an array of actions.

Here is an example:

public class AddToDoItemTest : CompositeAction
{
    public AddToDoItemTest(string title) :
        base(Enter.TheValue(title).Into(ToDoPage.NewToDoItemInput),
             Hit.Enter().Into(ToDoPage.NewToDoItemInput)
            )
    {
    }

    public override string Name => "Add an item";
}

DefaultCompositeAction

You can also create an instance of a composite action without creating a new class, using DefaultCompositeAction:

var action = new DefaultCompositeAction(
    "Add an item",
    Enter.TheValue(title).Into(ToDoPage.NewToDoItemInput),
    Hit.Enter().Into(ToDoPage.NewToDoItemInput)
    );

ToAction extension method

A third way of creating a composite action is to use the extension method on a IEnumerable<IAction<T>>:

var actions = new []
{
  Enter.TheValue(title).Into(ToDoPage.NewToDoItemInput),
  Hit.Enter().Into(ToDoPage.NewToDoItemInput)
};

var action = actions.ToAction("Add an item");
⚠️ **GitHub.com Fallback** ⚠️