An ordered set of steps that collapse into editable summaries as they are completed, ending in one explicit commit.

Usage

import { PlumaTestHelpers } from '@customerio/pluma-components/react/test-helpers/pluma-test-helpers';

const flow = PlumaTestHelpers.find('SetupFlow');

// Read across every step.
flow.getStepCount();
flow.getStepLabels();
flow.getActiveStepLabel();
flow.hasStep('Choose data');

// Every step at once, or just the open one, as scoped step helpers.
flow.getSteps();
flow.getActiveStep();

// Drill into a single step (by label or index) for its detailed state.
const step = flow.getStep('Name the export'); // or flow.getStepAt(0)
step?.getLabel();
step?.getStatus();
step?.isActive();
step?.isComplete();
step?.isUpcoming();
step?.isInvalidated();

// Whether the step is unavailable — skipped when the flow advances, and never
// offered a way to be reopened. Orthogonal to the status above.
step?.isDisabled();

// A collapsed step shows its summary; an invalidated one shows its
// invalidatedSummary instead, and that is what is returned.
step?.getSummary();

// The Edit affordance a completed step carries — 'Edit', or 'Review' while the
// step is invalidated. The whole header row is what reopens the step; the
// affordance sits inside it, and clicking either one does the same thing.
step?.hasEdit();
step?.getEditLabel();

// The footer action, read from whichever step is open.
flow.getNextLabel();
flow.isNextDisabled();
flow.isNextLoading();

// Move the flow. All three throw rather than no-op — on a missing label, on a
// step with nothing to reopen, and on an action that is disabled or in flight.
await flow.clickNext();
await flow.clickEditStep('Name the export');
await step?.clickEdit();

Test Helpers

Reopens the step by activating its Edit / Review control. Throws when the step has no such control, rather than passing having reopened nothing.

Gets the label of the control that reopens the step — `Edit` by default, or `Review` while the step is invalidated.

Gets the step's label.

Gets the step's status. Always derived from which step the flow has open and which ones it counts as complete, never set by hand.

Gets the step's summary — the one-line record of what was chosen, shown while the step is collapsed. An invalidated step shows its `invalidatedSummary` instead, and that is what is returned.

Whether the step offers a control to reopen it. Only a completed or invalidated step does, and never a disabled or final one.

Whether the step is the one currently open — the only step whose body is rendered.

Whether the step has been completed and collapsed to its summary.

Whether the step is unavailable. A disabled step is skipped when the flow advances and offers no control to reopen it, so it holds whatever status it had — `isDisabled` is not one of them.

Whether an edit to an earlier step has broken this step's values, so it has to be re-confirmed before the flow can be committed.

Whether the flow has yet to record the step as done.

Related

On this page