Stories

The above is the stories interface. Typing filters the list of stories and you can use up and down to move between them. Stories are not interactive, though this may change.

cy's user interface is complex and some UI states are tedious to navigate to when you're trying to iterate quickly. To remedy this, the cy repository contains a mechanism (uncreatively) called stories.

A story is a preconfigured Screen along with an (optional) sequence of user inputs that will be played back on that screen. Every story also has a unique string name that looks like a path, e.g. input/find/search. After defining a story in Go code, you can open a special interface that lets you quickly view that story.

Stories can be registered by any package in cy and can be browsed in a central interface.

This functionality was inspired by Storybook, a framework used to develop UI components.

Viewing stories

Run the following to open the stories interface:

go run ./cmd/stories/...

Press q to quit at any time.

The stories executable accepts a range of arguments. Provide --help to see them all.

To run only a single story:

go run ./cmd/stories/... -s input/find/search

To filter the list of stories with a prefix:

go run ./cmd/stories/... -p input

Any stories with names that do not begin with input will be filtered out.

Registering a new story

Stories are registered using the Register function in the stories package. Search the codebase for usage examples.