diff --git a/tests/features/editing/CMakeLists.txt b/tests/features/editing/CMakeLists.txt --- a/tests/features/editing/CMakeLists.txt +++ b/tests/features/editing/CMakeLists.txt @@ -1,6 +1,6 @@ zanshin_feature_tests( + addingtaskfeature completingtaskfeature editingtaskfeature + removingtaskfeature ) -# TODO addingtaskfeature, broken by the "Examples" thing -# TODO removingtaskfeature, broken by the "Examples" thing diff --git a/tests/features/editing/addingtaskfeature.cpp b/tests/features/editing/addingtaskfeature.cpp new file mode 100644 --- /dev/null +++ b/tests/features/editing/addingtaskfeature.cpp @@ -0,0 +1,89 @@ +/* This file is part of Zanshin + + Copyright 2019 Kevin Ottens + Copyright 2019 David Faure + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License or (at your option) version 3 or any later version + accepted by the membership of KDE e.V. (or its successor approved + by the membership of KDE e.V.), which shall act as a proxy + defined in Section 14 of version 3 of the license. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + USA. +*/ + +#include +#include + +using namespace Testlib; + +// Feature: Adding tasks +// As a task junkie +// I can create task by giving a title +// In order to collect ideas while reflecting on my life +class AddingTaskFeature : public QObject +{ + Q_OBJECT +private slots: + void Adding_a_task_in_a_page_data() + { + QTest::addColumn("page"); + QTest::addColumn("title"); + + QTest::newRow("inbox") << "Inbox" << "Buy a book"; + QTest::newRow("release") << "Projects / TestData » Calendar1 » Calendar2 / Backlog" << "Start a release party"; + } + + void Adding_a_task_in_a_page() + { + QFETCH(QString, page); + QFETCH(QString, title); + + ZANSHIN_CONTEXT; + Given(I_display_the_page(page)); + And(I_look_at_the_central_list()); + When(I_add_a_task(title)); + And(I_list_the_items()); + Then(the_list_contains(title)); + } + + void Adding_a_task_as_a_child_of_another_task_in_a_page_data() + { + QTest::addColumn("page"); + QTest::addColumn("parent"); + QTest::addColumn("title"); + + QTest::newRow("inbox") << "Inbox" << "Buy a book" << "Make sure it is a good book"; + QTest::newRow("release") << "Projects / TestData » Calendar1 » Calendar2 / Backlog" << "Start a release party" << "Make sure there was a release"; + } + + void Adding_a_task_as_a_child_of_another_task_in_a_page() + { + QFETCH(QString, page); + QFETCH(QString, parent); + QFETCH(QString, title); + + ZANSHIN_CONTEXT; + Given(I_display_the_page(page)); + And(I_add_a_task(parent)); + And(I_look_at_the_central_list()); + And(I_list_the_items()); + When(I_add_a_task_child(title, parent)); + And(I_list_the_items()); + Then(the_list_contains(parent + " / " + title)); + } +}; + +ZANSHIN_TEST_MAIN(AddingTaskFeature) + +#include "addingtaskfeature.moc" diff --git a/tests/features/editing/removingtaskfeature.cpp b/tests/features/editing/removingtaskfeature.cpp new file mode 100644 --- /dev/null +++ b/tests/features/editing/removingtaskfeature.cpp @@ -0,0 +1,63 @@ +/* This file is part of Zanshin + + Copyright 2019 Kevin Ottens + Copyright 2019 David Faure + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License or (at your option) version 3 or any later version + accepted by the membership of KDE e.V. (or its successor approved + by the membership of KDE e.V.), which shall act as a proxy + defined in Section 14 of version 3 of the license. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + USA. +*/ + +#include +#include + +using namespace Testlib; + +// Feature: Removing tasks +// As a task junkie +// I can delete a task so it is removed +// In order to clean up the old junk I accumulated +class RemovingTaskFeature : public QObject +{ + Q_OBJECT +private slots: + void Removing_a_simple_task_from_a_page_data() + { + QTest::addColumn("page"); + QTest::addColumn("title"); + + QTest::newRow("inbox") << "Inbox" << "Buy cheese"; + QTest::newRow("readlist") << "Projects / TestData » Calendar1 / Read List" << "\"Domain Driven Design\" by Eric Evans"; + } + + void Removing_a_simple_task_from_a_page() + { + QFETCH(QString, page); + QFETCH(QString, title); + + ZANSHIN_CONTEXT; + Given(I_display_the_page(page)); + And(there_is_an_item_in_the_central_list(title)); + When(I_remove_the_item()); + And(I_list_the_items()); + Then(the_list_does_not_contain(title)); + } +}; + +ZANSHIN_TEST_MAIN(RemovingTaskFeature) + +#include "removingtaskfeature.moc" diff --git a/tests/features/zanshin/features/editing/adding-task.feature b/tests/features/zanshin/features/editing/adding-task.feature deleted file mode 100644 --- a/tests/features/zanshin/features/editing/adding-task.feature +++ /dev/null @@ -1,30 +0,0 @@ -Feature: Adding tasks - As a task junkie - I can create task by giving a title - In order to collect ideas while reflecting on my life - - Scenario Outline: Adding a task in a page - Given I display the "" page - And I look at the central list - When I add a "task" named "" - And I list the items - Then the list contains "<title>" - - Examples: - | page | title | - | Inbox | Buy a book | - | Projects / TestData » Calendar1 » Calendar2 / Backlog | Setup a release party | - - Scenario Outline: Adding a task as a child of another task in a page - Given I display the "<page>" page - And I add a "task" named "<parent>" - And I look at the central list - And I list the items - When I add a child named "<title>" 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 / TestData » Calendar1 » Calendar2 / Backlog | Setup a release party | Make sure there was a release | diff --git a/tests/features/zanshin/features/editing/removing-task.feature b/tests/features/zanshin/features/editing/removing-task.feature deleted file mode 100644 --- a/tests/features/zanshin/features/editing/removing-task.feature +++ /dev/null @@ -1,17 +0,0 @@ -Feature: Removing tasks - As a task junkie - I can delete a task so it is removed - In order to clean up the old junk I accumulated - - Scenario Outline: Removing a simple task from a page - Given I display the "<page>" page - And there is an item named "<title>" in the central list - When I remove the item - And I list the items - Then the list does not contain "<title>" - - Examples: - | page | title | - | Inbox | Buy cheese | - | Projects / TestData » Calendar1 / Read List | "Domain Driven Design" by Eric Evans | -