Sort the grid by a column: one click sorts ascending, a click on the sorted column reverses it. The step clicks until the column has the direction asked for.
Examples
When I sort the grid by "Name" ascending
When I sort the grid by "Name" descending
And I sort the grid by "ID" ascending
When we sort the grid by "Price" descending
When sort the grid by "SKU" ascending
Pattern
When(/^(I |we )*sort the grid by "([^"]*)" (ascending|descending)$/, …)
Part of @webship-js/magento-steps (github.com/webship/magento-steps), a step pack for Webship-js 2.0.x.