diff --git a/features/build.feature b/features/build.feature new file mode 100644 index 00000000..a7b03af4 --- /dev/null +++ b/features/build.feature @@ -0,0 +1,8 @@ +Feature: Build process + + @deployment_tests + Scenario: Version numbers should stay in sync + Given we use the config "basic.yaml" + When we run "jrnl --version" + Then we should get no error + And the output should contain pyproject.toml version diff --git a/features/custom_dates.feature b/features/custom_dates.feature deleted file mode 100644 index d3489648..00000000 --- a/features/custom_dates.feature +++ /dev/null @@ -1,35 +0,0 @@ -Feature: Reading and writing to journal with custom date formats - - Scenario: Loading a sample journal - Given we use the config "little_endian_dates.yaml" - When we run "jrnl -n 2" - Then we should get no error - And the output should be - """ - 09.06.2013 15:39 My first entry. - | Everything is alright - - 10.06.2013 15:40 Life is good. - | But I'm better. - """ - - Scenario: Writing an entry from command line - Given we use the config "little_endian_dates.yaml" - When we run "jrnl 2013-07-12: A cold and stormy day. I ate crisps on the sofa." - Then we should see the message "Entry added" - When we run "jrnl -n 1" - Then the output should contain "12.07.2013 09:00 A cold and stormy day." - - Scenario: Filtering for dates - Given we use the config "little_endian_dates.yaml" - When we run "jrnl -on 2013-06-10 --short" - Then the output should be "10.06.2013 15:40 Life is good." - When we run "jrnl -on 'june 6 2013' --short" - Then the output should be "10.06.2013 15:40 Life is good." - - Scenario: Writing an entry at the prompt - Given we use the config "little_endian_dates.yaml" - When we run "jrnl" and enter "2013-05-10: I saw Elvis. He's alive." - Then we should get no error - And the journal should contain "[10.05.2013 09:00] I saw Elvis." - And the journal should contain "He's alive." \ No newline at end of file diff --git a/features/dates.feature b/features/dates.feature new file mode 100644 index 00000000..c7606695 --- /dev/null +++ b/features/dates.feature @@ -0,0 +1,72 @@ +Feature: Reading and writing to journal with custom date formats + + Scenario: Dates with time + # https://github.com/jrnl-org/jrnl/issues/117 + Given we use the config "basic.yaml" + When we run "jrnl 2013-11-30 15:42: Project Started." + Then we should see the message "Entry added" + And the journal should contain "[2013-11-30 15:42] Project Started." + + Scenario: Dates in the future + # https://github.com/jrnl-org/jrnl/issues/185 + Given we use the config "basic.yaml" + When we run "jrnl 26/06/2099: Planet? Earth. Year? 2099." + Then we should see the message "Entry added" + And the journal should contain "[2099-06-26 09:00] Planet?" + + Scenario: Loading a sample journal with custom date + Given we use the config "little_endian_dates.yaml" + When we run "jrnl -n 2" + Then we should get no error + And the output should be + """ + 09.06.2013 15:39 My first entry. + | Everything is alright + + 10.06.2013 15:40 Life is good. + | But I'm better. + """ + + Scenario: Writing an entry from command line with custom date + Given we use the config "little_endian_dates.yaml" + When we run "jrnl 2013-07-12: A cold and stormy day. I ate crisps on the sofa." + Then we should see the message "Entry added" + When we run "jrnl -n 1" + Then the output should contain "12.07.2013 09:00 A cold and stormy day." + + Scenario: Filtering for dates with custom date + Given we use the config "little_endian_dates.yaml" + When we run "jrnl -on 2013-06-10 --short" + Then the output should be "10.06.2013 15:40 Life is good." + When we run "jrnl -on 'june 6 2013' --short" + Then the output should be "10.06.2013 15:40 Life is good." + + Scenario: Writing an entry at the prompt with custom date + Given we use the config "little_endian_dates.yaml" + When we run "jrnl" and enter "2013-05-10: I saw Elvis. He's alive." + Then we should get no error + And the journal should contain "[10.05.2013 09:00] I saw Elvis." + And the journal should contain "He's alive." + + Scenario: Viewing today's entries does not print the entire journal + # https://github.com/jrnl-org/jrnl/issues/741 + Given we use the config "basic.yaml" + When we run "jrnl -on today" + Then the output should not contain "Life is good" + And the output should not contain "But I'm better." + + Scenario: Create entry using day of the week as entry date. + Given we use the config "basic.yaml" + When we run "jrnl monday: This is an entry on a Monday." + Then we should see the message "Entry added" + When we run "jrnl -1" + Then the output should contain "monday at 9am" in the local time + And the output should contain "This is an entry on a Monday." + + Scenario: Create entry using day of the week abbreviations as entry date. + Given we use the config "basic.yaml" + When we run "jrnl fri: This is an entry on a Friday." + Then we should see the message "Entry added" + When we run "jrnl -1" + Then the output should contain "friday at 9am" in the local time + diff --git a/features/dayone.feature b/features/dayone.feature index 4b69b0c9..d4f3ff69 100644 --- a/features/dayone.feature +++ b/features/dayone.feature @@ -90,3 +90,20 @@ Feature: Dayone specific implementation details. 2014-04-24 09:00 Ran 6.2 miles today in 1:02:03. | I'm feeling sore because I forgot to stretch. """ + + Scenario: Loading entry with ambiguous time stamp + #https://github.com/jrnl-org/jrnl/issues/153 + Given we use the config "bug153.yaml" + When we run "jrnl -1" + Then we should get no error + And the output should be + """ + 2013-10-27 03:27 Some text. + """ + + Scenario: Empty DayOne entry bodies should not error + # https://github.com/jrnl-org/jrnl/issues/780 + Given we use the config "bug780.yaml" + When we run "jrnl --short" + Then we should get no error + diff --git a/features/exporting.feature b/features/exporting.feature index 39375a96..fc22a4bb 100644 --- a/features/exporting.feature +++ b/features/exporting.feature @@ -85,6 +85,29 @@ Feature: Exporting a Journal more stuff again """ + # the "deletion" journal is used because it doesn't have a newline at the + # end of the last entry + Scenario: Add a blank line to Markdown export if there isn't one already + # https://github.com/jrnl-org/jrnl/issues/768 + # https://github.com/jrnl-org/jrnl/issues/881 + Given we use the config "deletion.yaml" + When we run "jrnl --export markdown" + Then the output should be + """ + # 2019 + + ## October + + ### 2019-10-29 11:11 First entry. + + + ### 2019-10-29 11:11 Second entry. + + + ### 2019-10-29 11:13 Third entry. + + """ + Scenario: Exporting to XML Given we use the config "tags.yaml" When we run "jrnl --export xml" @@ -145,3 +168,26 @@ Feature: Exporting a Journal (2) ??? (3) PROFIT! """ + + Scenario: Add a blank line to YAML export if there isn't one already + # https://github.com/jrnl-org/jrnl/issues/768 + # https://github.com/jrnl-org/jrnl/issues/881 + Given we use the config "deletion.yaml" + And we create cache directory "bug768" + When we run "jrnl --export yaml -o {cache_dir}" with cache directory "bug768" + Then cache directory "bug768" should contain the files + """ + [ + "2019-10-29_first-entry.md", + "2019-10-29_second-entry.md", + "2019-10-29_third-entry.md" + ] + """ + And the content of file "2019-10-29_third-entry.md" in cache directory "bug768" should be + """ + title: Third entry. + date: 2019-10-29 11:13 + starred: False + tags: + + """ diff --git a/features/loading.feature b/features/loading.feature new file mode 100644 index 00000000..9044ea6e --- /dev/null +++ b/features/loading.feature @@ -0,0 +1,21 @@ +Feature: Loading a journal from a file + + Scenario: Integers in square brackets should not be read as dates + Given we use the config "brackets.yaml" + When we run "jrnl -1" + Then the output should contain "[1] line starting with 1" + + Scenario: Journals with unreadable dates should still be loaded + Given we use the config "unreadabledates.yaml" + When we run "jrnl -2" + Then the output should contain "I've lost track of time." + And the output should contain "Time has no meaning." + + Scenario: Journals with readable dates AND unreadable dates should still contain all data. + Given we use the config "mostlyreadabledates.yaml" + When we run "jrnl -3" + Then the output should contain "Time machines are possible." + When we run "jrnl -1" + Then the output should contain "I'm going to activate the machine." + And the output should contain "I've crossed so many timelines. Is there any going back?" + diff --git a/features/regression.feature b/features/regression.feature deleted file mode 100644 index 7dc32942..00000000 --- a/features/regression.feature +++ /dev/null @@ -1,167 +0,0 @@ -Feature: Zapped bugs should stay dead. - - Scenario: Date with time should be parsed correctly - # https://github.com/jrnl-org/jrnl/issues/117 - Given we use the config "basic.yaml" - When we run "jrnl 2013-11-30 15:42: Project Started." - Then we should see the message "Entry added" - And the journal should contain "[2013-11-30 15:42] Project Started." - - Scenario: Loading entry with ambiguous time stamp - #https://github.com/jrnl-org/jrnl/issues/153 - Given we use the config "bug153.yaml" - When we run "jrnl -1" - Then we should get no error - And the output should be - """ - 2013-10-27 03:27 Some text. - """ - - Scenario: Date in the future should be parsed correctly - # https://github.com/jrnl-org/jrnl/issues/185 - Given we use the config "basic.yaml" - When we run "jrnl 26/06/2019: Planet? Earth. Year? 2019." - Then we should see the message "Entry added" - And the journal should contain "[2019-06-26 09:00] Planet?" - - Scenario: Empty DayOne entry bodies should not error - # https://github.com/jrnl-org/jrnl/issues/780 - Given we use the config "bug780.yaml" - When we run "jrnl --short" - Then we should get no error - - Scenario: Title with an embedded period. - Given we use the config "basic.yaml" - When we run "jrnl 04-24-2014: Created a new website - empty.com. Hope to get a lot of traffic." - Then we should see the message "Entry added" - When we run "jrnl -1" - Then the output should be - """ - 2014-04-24 09:00 Created a new website - empty.com. - | Hope to get a lot of traffic. - """ - - Scenario: Integers in square brackets should not be read as dates - Given we use the config "brackets.yaml" - When we run "jrnl -1" - Then the output should contain "[1] line starting with 1" - - Scenario: Journals with unreadable dates should still be viewable - Given we use the config "unreadabledates.yaml" - When we run "jrnl -2" - Then the output should contain "I've lost track of time." - And the output should contain "Time has no meaning." - - Scenario: Journals with readable dates AND unreadable dates should still contain all data. - Given we use the config "mostlyreadabledates.yaml" - When we run "jrnl -3" - Then the output should contain "Time machines are possible." - When we run "jrnl -1" - Then the output should contain "I'm going to activate the machine." - And the output should contain "I've crossed so many timelines. Is there any going back?" - - Scenario: Viewing today's entries does not print the entire journal - # https://github.com/jrnl-org/jrnl/issues/741 - Given we use the config "basic.yaml" - When we run "jrnl -on today" - Then the output should not contain "Life is good" - And the output should not contain "But I'm better." - - Scenario: Create entry using day of the week as entry date. - Given we use the config "basic.yaml" - When we run "jrnl monday: This is an entry on a Monday." - Then we should see the message "Entry added" - When we run "jrnl -1" - Then the output should contain "monday at 9am" in the local time - And the output should contain "This is an entry on a Monday." - - Scenario: Create entry using day of the week abbreviations as entry date. - Given we use the config "basic.yaml" - When we run "jrnl fri: This is an entry on a Friday." - Then we should see the message "Entry added" - When we run "jrnl -1" - Then the output should contain "friday at 9am" in the local time - - Scenario: Displaying entries using -on today should display entries created today. - Given we use the config "basic.yaml" - When we run "jrnl today: Adding an entry right now." - Then we should see the message "Entry added" - When we run "jrnl -on today" - Then the output should contain "Adding an entry right now." - - Scenario: Displaying entries using -from day should display correct entries - Given we use the config "basic.yaml" - When we run "jrnl yesterday: This thing happened yesterday" - Then we should see the message "Entry added" - When we run "jrnl today at 11:59pm: Adding an entry right now." - Then we should see the message "Entry added" - When we run "jrnl tomorrow: A future entry." - Then we should see the message "Entry added" - When we run "jrnl -from today" - Then the output should contain "Adding an entry right now." - And the output should contain "A future entry." - And the output should not contain "This thing happened yesterday" - - Scenario: Displaying entries using -from and -to day should display correct entries - Given we use the config "basic.yaml" - When we run "jrnl yesterday: This thing happened yesterday" - Then we should see the message "Entry added" - When we run "jrnl today at 11:59pm: Adding an entry right now." - Then we should see the message "Entry added" - When we run "jrnl tomorrow: A future entry." - Then we should see the message "Entry added" - When we run "jrnl -from yesterday -to today" - Then the output should contain "This thing happened yesterday" - And the output should contain "Adding an entry right now." - And the output should not contain "A future entry." - - # See issues #768 and #881 - # the "deletion" journal is used because it doesn't have a newline at the - # end of the last entry - Scenario: Add a blank line to Markdown export is there isn't one already - Given we use the config "deletion.yaml" - When we run "jrnl --export markdown" - Then the output should be - """ - # 2019 - - ## October - - ### 2019-10-29 11:11 First entry. - - - ### 2019-10-29 11:11 Second entry. - - - ### 2019-10-29 11:13 Third entry. - - """ - - # See issues #768 and #881 - Scenario: Add a blank line to YAML export if there isn't one already - Given we use the config "deletion.yaml" - And we create cache directory "bug768" - When we run "jrnl --export yaml -o {cache_dir}" with cache directory "bug768" - Then cache directory "bug768" should contain the files - """ - [ - "2019-10-29_first-entry.md", - "2019-10-29_second-entry.md", - "2019-10-29_third-entry.md" - ] - """ - And the content of file "2019-10-29_third-entry.md" in cache directory "bug768" should be - """ - title: Third entry. - date: 2019-10-29 11:13 - starred: False - tags: - - """ - - @deployment_tests - Scenario: Version numbers should stay in sync - Given we use the config "basic.yaml" - When we run "jrnl --version" - Then we should get no error - And the output should contain pyproject.toml version diff --git a/features/searching.feature b/features/searching.feature new file mode 100644 index 00000000..e718af0e --- /dev/null +++ b/features/searching.feature @@ -0,0 +1,34 @@ +Feature: Searching a journal + + Scenario: Displaying entries using -on today should display entries created today. + Given we use the config "basic.yaml" + When we run "jrnl today: Adding an entry right now." + Then we should see the message "Entry added" + When we run "jrnl -on today" + Then the output should contain "Adding an entry right now." + + Scenario: Displaying entries using -from day should display correct entries + Given we use the config "basic.yaml" + When we run "jrnl yesterday: This thing happened yesterday" + Then we should see the message "Entry added" + When we run "jrnl today at 11:59pm: Adding an entry right now." + Then we should see the message "Entry added" + When we run "jrnl tomorrow: A future entry." + Then we should see the message "Entry added" + When we run "jrnl -from today" + Then the output should contain "Adding an entry right now." + And the output should contain "A future entry." + And the output should not contain "This thing happened yesterday" + + Scenario: Displaying entries using -from and -to day should display correct entries + Given we use the config "basic.yaml" + When we run "jrnl yesterday: This thing happened yesterday" + Then we should see the message "Entry added" + When we run "jrnl today at 11:59pm: Adding an entry right now." + Then we should see the message "Entry added" + When we run "jrnl tomorrow: A future entry." + Then we should see the message "Entry added" + When we run "jrnl -from yesterday -to today" + Then the output should contain "This thing happened yesterday" + And the output should contain "Adding an entry right now." + And the output should not contain "A future entry." diff --git a/features/writing.feature b/features/writing.feature index 3638d9da..7c278b94 100644 --- a/features/writing.feature +++ b/features/writing.feature @@ -43,3 +43,15 @@ Feature: Writing new entries. Then we should see the message "Entry added" When we run "jrnl -n 1" Then the output should not contain "Life is good" + + Scenario: Title with an embedded period + Given we use the config "basic.yaml" + When we run "jrnl 04-24-2014: Created a new website - empty.com. Hope to get a lot of traffic." + Then we should see the message "Entry added" + When we run "jrnl -1" + Then the output should be + """ + 2014-04-24 09:00 Created a new website - empty.com. + | Hope to get a lot of traffic. + """ +