forked from iSoron/uhabits
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement acceptance tests for some basic features
- Loading branch information
Showing
19 changed files
with
739 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Copyright (C) 2016 Álinson Santos Xavier <[email protected]> | ||
~ | ||
~ This file is part of Loop Habit Tracker. | ||
~ | ||
~ Loop Habit Tracker 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 3 of the License, or (at your | ||
~ option) any later version. | ||
~ | ||
~ Loop Habit Tracker 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, see <http://www.gnu.org/licenses/>. | ||
--> | ||
<manifest | ||
package="org.isoron.uhabits" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<instrumentation> | ||
<meta-data android:name="notPackage" android:value="net.bytebuddy"/> | ||
</instrumentation> | ||
</manifest> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
uhabits-android/src/androidTest/java/org/isoron/uhabits/acceptance/AboutTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (C) 2017 Álinson Santos Xavier <[email protected]> | ||
* | ||
* This file is part of Loop Habit Tracker. | ||
* | ||
* Loop Habit Tracker 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 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* Loop Habit Tracker 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, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.isoron.uhabits.acceptance; | ||
|
||
import org.isoron.uhabits.*; | ||
import org.junit.*; | ||
|
||
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*; | ||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*; | ||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*; | ||
|
||
public class AboutTest extends BaseUIAutomatorTest | ||
{ | ||
@Test | ||
public void shouldDisplayAboutScreen() | ||
{ | ||
launchApp(); | ||
clickMenu(ABOUT); | ||
verifyDisplaysText("Loop Habit Tracker"); | ||
verifyDisplaysText("Rate this app on Google Play"); | ||
verifyDisplaysText("Developers"); | ||
verifyDisplaysText("Translators"); | ||
|
||
launchApp(); | ||
clickMenu(SETTINGS); | ||
clickText("About"); | ||
verifyDisplaysText("Translators"); | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
uhabits-android/src/androidTest/java/org/isoron/uhabits/acceptance/HabitsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Copyright (C) 2017 Álinson Santos Xavier <[email protected]> | ||
* | ||
* This file is part of Loop Habit Tracker. | ||
* | ||
* Loop Habit Tracker 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 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* Loop Habit Tracker 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, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.isoron.uhabits.acceptance; | ||
|
||
import org.isoron.uhabits.*; | ||
import org.junit.*; | ||
|
||
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*; | ||
import static org.isoron.uhabits.acceptance.steps.EditHabitSteps.*; | ||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*; | ||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*; | ||
|
||
public class HabitsTest extends BaseUIAutomatorTest | ||
{ | ||
@Test | ||
public void shouldCreateHabit() throws Exception | ||
{ | ||
launchApp(); | ||
clickMenu(CREATE_HABIT); | ||
typeName("Hello world"); | ||
typeQuestion("Did you say hello to the world today?"); | ||
pickFrequency("Every week"); | ||
pickColor(5); | ||
clickSave(); | ||
verifyDisplaysText("Hello world"); | ||
} | ||
|
||
@Test | ||
public void shouldShowHabitStatistics() throws Exception | ||
{ | ||
launchApp(); | ||
clickText("Track time"); | ||
verifyDisplayGraphs(); | ||
} | ||
|
||
@Test | ||
public void shouldDeleteHabit() throws Exception | ||
{ | ||
launchApp(); | ||
longClickText("Track time"); | ||
clickMenu(DELETE); | ||
clickOK(); | ||
verifyDoesNotDisplayText("Track time"); | ||
} | ||
|
||
@Test | ||
public void shouldEditHabit() throws Exception | ||
{ | ||
launchApp(); | ||
longClickText("Track time"); | ||
clickMenu(EDIT_HABIT); | ||
typeName("Take a walk"); | ||
typeQuestion("Did you take a walk today?"); | ||
clickSave(); | ||
verifyDisplaysText("Take a walk"); | ||
verifyDoesNotDisplayText("Track time"); | ||
} | ||
|
||
@Test | ||
public void shouldEditHabit_fromStatisticsScreen() throws Exception | ||
{ | ||
launchApp(); | ||
clickText("Track time"); | ||
clickMenu(EDIT_HABIT); | ||
typeName("Take a walk"); | ||
typeQuestion("Did you take a walk today?"); | ||
pickColor(10); | ||
clickSave(); | ||
verifyDisplaysText("Take a walk"); | ||
pressBack(); | ||
verifyDisplaysText("Take a walk"); | ||
verifyDoesNotDisplayText("Track time"); | ||
} | ||
|
||
@Test | ||
public void shouldArchiveAndUnarchiveHabits() throws Exception | ||
{ | ||
launchApp(); | ||
longClickText("Track time"); | ||
clickMenu(ARCHIVE); | ||
verifyDoesNotDisplayText("Track time"); | ||
clickMenu(HIDE_ARCHIVED); | ||
verifyDisplaysText("Track time"); | ||
|
||
longClickText("Track time"); | ||
clickMenu(UNARCHIVE); | ||
clickMenu(HIDE_ARCHIVED); | ||
verifyDisplaysText("Track time"); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
uhabits-android/src/androidTest/java/org/isoron/uhabits/acceptance/LinksTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (C) 2017 Álinson Santos Xavier <[email protected]> | ||
* | ||
* This file is part of Loop Habit Tracker. | ||
* | ||
* Loop Habit Tracker 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 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* Loop Habit Tracker 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, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.isoron.uhabits.acceptance; | ||
|
||
import org.isoron.uhabits.*; | ||
import org.junit.*; | ||
|
||
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*; | ||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*; | ||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.ABOUT; | ||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.HELP; | ||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.SETTINGS; | ||
|
||
public class LinksTest extends BaseUIAutomatorTest | ||
{ | ||
@Test | ||
public void shouldLinkToSourceCode() throws Exception | ||
{ | ||
launchApp(); | ||
clickMenu(ABOUT); | ||
clickText("View source code at GitHub"); | ||
verifyOpensWebsite("https://github.com/iSoron/uhabits"); | ||
} | ||
|
||
@Test | ||
public void shouldLinkToTranslationWebsite() throws Exception | ||
{ | ||
launchApp(); | ||
clickMenu(ABOUT); | ||
clickText("Help translate this app"); | ||
verifyOpensWebsite("translate.loophabits.org"); | ||
} | ||
|
||
@Test | ||
public void shouldLinkToHelp() throws Exception | ||
{ | ||
launchApp(); | ||
clickMenu(HELP); | ||
verifyOpensWebsite("loophabits.org/faq.html"); | ||
|
||
launchApp(); | ||
clickMenu(SETTINGS); | ||
clickText("Help & FAQ"); | ||
verifyOpensWebsite("loophabits.org/faq.html"); | ||
} | ||
} |
Oops, something went wrong.