My terminal-based Cycle Steps don't always perfectly coincide with the actions a human operator performs on their device.
There are 3 terminal Steps that can provide a clear picture of the business process and end user operation. Using these three steps correctly will lead to increased efficiency and readability. They also allow for your Features to be used as process documentation.
This Step does precisely what it says. It types the specified characters in the terminal. This Step is intended to replicate when the Operator is using the terminal’s keypad for input. If the input field requires an ENTER to proceed on the form then this Step needs to be followed with the I press keys ENTER in terminal Step. Other instances, Y/N prompts for example, do not require a succeeding ENTER.
Given I type "SUPER" in terminal
Then I press keys ENTER in terminal
Given I type “Y” in terminal
This Step combines the I type... Step with the I press keys Enter Step. It is intended to efficiently type text and proceed to the next field or screen. That might be the best approach when building Features depending on intent. Using this will help reduce the number of Cycle Steps when typing and entering is required from the Operator. However, this Step isn’t always indicative of the actual process the Operator follows since there is no configuration that will auto-enter after an Operator types in a terminal.
Given I enter "SUPER" in terminal
Functionally, this Step performs identically to I enter "<TEXT>" in terminal. The difference between the two centers on readability for process documentation. This Step is intended to replicate the process of an Operator scanning a barcode with their terminal. Most terminals are configured to automatically add an ENTER following a scan so that is exactly what this Step does. This Step accurately reflects what the Operator on the floor will do while also performing efficiently in the Cycle Feature. It should be clear to the reader of a Feature file what is happening on the floor when this Step is used.
Given I scan "LPN00123" in terminal