diff --git a/tests/features/cuke-steps.cpp b/tests/features/cuke-steps.cpp --- a/tests/features/cuke-steps.cpp +++ b/tests/features/cuke-steps.cpp @@ -541,6 +541,31 @@ context->waitForStableState(); } +WHEN("^I add a child named \"(.+)\" under the task named \"(.+)\"$") { + REGEX_PARAM(QString, childName); + REGEX_PARAM(QString, parentName); + + ScenarioScope context; + context->waitForStableState(); + + auto parentIndex = QModelIndex(); + for (int row = 0; row < context->indices.size(); row++) { + auto index = context->indices.at(row); + if (Zanshin::indexString(index) == parentName) { + parentIndex = index; + break; + } + } + + VERIFY_OR_DUMP(parentIndex.isValid()); + + VERIFY(QMetaObject::invokeMethod(context->presentation, + "addItem", + Q_ARG(QString, childName), + Q_ARG(QModelIndex, parentIndex))); + context->waitForStableState(); +} + WHEN("^I list the items$") { ScenarioScope context; context->waitForStableState(); diff --git a/tests/features/zanshin/features/editing/adding-task.feature b/tests/features/zanshin/features/editing/adding-task.feature --- a/tests/features/zanshin/features/editing/adding-task.feature +++ b/tests/features/zanshin/features/editing/adding-task.feature @@ -14,3 +14,16 @@ | page | title | | Inbox | Buy a book | | Projects / Backlog | Setup a release party | + + Scenario Outline: Adding a task as a child of another task in a page + Given I display the "" page + And I look at the central list + And I list the items + When I add a child named "" under the task named "<parent>" + And I list the items + Then the list contains "<parent> / <title>" + + Examples: + | page | parent | title | + | Inbox | Buy a book | Make sure it is a good book | + | Projects / Backlog | Setup a release party | Make sure there was a release |