mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 05:26:13 +02:00
move some files around because pytest is being weird
This commit is contained in:
parent
cdad0d6289
commit
f99411f2f9
26 changed files with 81 additions and 907 deletions
7
tests/bdd/features/build.feature
Normal file
7
tests/bdd/features/build.feature
Normal file
|
@ -0,0 +1,7 @@
|
|||
Feature: Build process
|
||||
|
||||
Scenario: Version numbers should stay in sync
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --version"
|
||||
Then we should get no error
|
||||
And the output should contain pyproject.toml version
|
18
tests/bdd/features/core.feature
Normal file
18
tests/bdd/features/core.feature
Normal file
|
@ -0,0 +1,18 @@
|
|||
Feature: Functionality of jrnl outside of actually handling journals
|
||||
|
||||
Scenario: Displaying the version number
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --version"
|
||||
Then we should get no error
|
||||
Then the output should match "^jrnl version v\d+\.\d+(\.\d+)?(-(alpha|beta)\d*)?"
|
||||
|
||||
Scenario: Running the diagnostic command
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --diagnostic"
|
||||
Then the output should contain "jrnl"
|
||||
And the output should contain "Python"
|
||||
And the output should contain "OS"
|
||||
|
||||
@todo
|
||||
Scenario: Listing available journals
|
||||
|
174
tests/bdd/features/datetime.feature
Normal file
174
tests/bdd/features/datetime.feature
Normal file
|
@ -0,0 +1,174 @@
|
|||
Feature: Reading and writing to journal with custom date formats
|
||||
|
||||
Scenario: Dates can include a time
|
||||
# https://github.com/jrnl-org/jrnl/issues/117
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl 2013-11-30 15:42: Project Started."
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -999"
|
||||
Then the output should contain "2013-11-30 15:42 Project Started."
|
||||
|
||||
|
||||
Scenario: Dates can be in the future
|
||||
# https://github.com/jrnl-org/jrnl/issues/185
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl 26/06/2099: Planet? Earth. Year? 2099."
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -999"
|
||||
Then the output 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
|
||||
When we run "jrnl -n 999"
|
||||
Then the output should be
|
||||
09.06.2013 15:39 My first entry.
|
||||
| Everything is alright
|
||||
|
||||
10.07.2013 15:40 Life is good.
|
||||
| But I'm better.
|
||||
|
||||
|
||||
Scenario Outline: Writing an entry from command line with custom date
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl <command>"
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should contain "<expected_output>"
|
||||
|
||||
Examples: Day-first Dates
|
||||
| config_file | command | expected_output |
|
||||
| little_endian_dates.yaml | 2020-09-19: My first entry. | 19.09.2020 09:00 My first entry. |
|
||||
| little_endian_dates.yaml | 2020-08-09: My second entry. | 09.08.2020 09:00 My second entry. |
|
||||
| little_endian_dates.yaml | 2020-02-29: Test. | 29.02.2020 09:00 Test. |
|
||||
| little_endian_dates.yaml | 2019-02-29: Test. | 2019-02-29: Test. |
|
||||
| little_endian_dates.yaml | 2020-08-32: Test. | 2020-08-32: Test. |
|
||||
| little_endian_dates.yaml | 2032-02-01: Test. | 01.02.2032 09:00 Test. |
|
||||
| little_endian_dates.yaml | 2020-01-01: Test. | 01.01.2020 09:00 Test. |
|
||||
| little_endian_dates.yaml | 2020-12-31: Test. | 31.12.2020 09:00 Test. |
|
||||
|
||||
|
||||
Scenario Outline: Searching for dates with custom date
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl <command>"
|
||||
Then the output should be "<expected_output>"
|
||||
|
||||
Examples: Day-first Dates
|
||||
| config_file | command | expected_output |
|
||||
| little_endian_dates.yaml | -on '2013-07-10' --short | 10.07.2013 15:40 Life is good. |
|
||||
| little_endian_dates.yaml | -on 'june 9 2013' --short | 09.06.2013 15:39 My first entry. |
|
||||
| little_endian_dates.yaml | -on 'july 10 2013' --short | 10.07.2013 15:40 Life is good. |
|
||||
| little_endian_dates.yaml | -on 'june 2013' --short | 09.06.2013 15:39 My first entry. |
|
||||
| little_endian_dates.yaml | -on 'july 2013' --short | 10.07.2013 15:40 Life is good. |
|
||||
# @todo month alone with no year should work
|
||||
# | little_endian_dates.yaml | -on 'june' --short | 09.06.2013 15:39 My first entry. |
|
||||
# | little_endian_dates.yaml | -on 'july' --short | 10.07.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
|
||||
When we run "jrnl -999"
|
||||
Then the output should contain "10.05.2013 09:00 I saw Elvis."
|
||||
And the output should contain "He's alive."
|
||||
|
||||
|
||||
Scenario: Viewing today's entries does not print the entire journal
|
||||
# see: https://github.com/jrnl-org/jrnl/issues/741
|
||||
Given we use the config "simple.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 Outline: Create entry using day of the week as entry date one.
|
||||
Given we use the config "simple.yaml"
|
||||
And now is "2019-03-12 01:30:32 PM"
|
||||
When we run "jrnl <command>"
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should contain "<expected_output>"
|
||||
Then the output should contain the date "<date>"
|
||||
|
||||
Examples: Days of the week
|
||||
| command | expected_output | date |
|
||||
| Monday: entry on a monday | entry on a monday | 2019-03-11 09:00 |
|
||||
| Tuesday: entry on a tuesday | entry on a tuesday | 2019-03-05 09:00 |
|
||||
| Wednesday: entry on a wednesday | entry on a wednesday | 2019-03-06 09:00 |
|
||||
| Thursday: entry on a thursday | entry on a thursday | 2019-03-07 09:00 |
|
||||
| Friday: entry on a friday | entry on a friday | 2019-03-08 09:00 |
|
||||
| Saturday: entry on a saturday | entry on a saturday | 2019-03-09 09:00 |
|
||||
| Sunday: entry on a sunday | entry on a sunday | 2019-03-10 09:00 |
|
||||
| sunday: entry on a sunday | entry on a sunday | 2019-03-10 09:00 |
|
||||
| sUndAy: entry on a sunday | entry on a sunday | 2019-03-10 09:00 |
|
||||
|
||||
|
||||
Scenario Outline: Create entry using day of the week as entry date two.
|
||||
Given we use the config "simple.yaml"
|
||||
And now is "2019-03-12 01:30:32 PM"
|
||||
When we run "jrnl <command>"
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should contain "<expected_output>"
|
||||
Then the output should contain the date "<date>"
|
||||
|
||||
Examples: Days of the week
|
||||
| command | expected_output | date |
|
||||
| Mon: entry on a monday | entry on a monday | 2019-03-11 09:00 |
|
||||
| Tue: entry on a tuesday | entry on a tuesday | 2019-03-05 09:00 |
|
||||
| Wed: entry on a wednesday | entry on a wednesday | 2019-03-06 09:00 |
|
||||
| Thu: entry on a thursday | entry on a thursday | 2019-03-07 09:00 |
|
||||
| Fri: entry on a friday | entry on a friday | 2019-03-08 09:00 |
|
||||
| Sat: entry on a saturday | entry on a saturday | 2019-03-09 09:00 |
|
||||
| Sun: entry on a sunday | entry on a sunday | 2019-03-10 09:00 |
|
||||
| sun: entry on a sunday | entry on a sunday | 2019-03-10 09:00 |
|
||||
| sUn: entry on a sunday | entry on a sunday | 2019-03-10 09:00 |
|
||||
|
||||
|
||||
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 --short"
|
||||
Then the output should be
|
||||
2019-07-01 14:23 The third entry
|
||||
2019-07-18 14:23 The first entry
|
||||
2019-07-19 14:23 The second entry
|
||||
|
||||
|
||||
Scenario: Update near-valid dates after journal is edited
|
||||
Given we use the config "mostlyreadabledates.yaml"
|
||||
When we run "jrnl 2222-08-19: I have made it exactly one month into the future."
|
||||
When we run "jrnl -2"
|
||||
Then the output should contain "2019-07-19 14:23 The second entry"
|
||||
|
||||
|
||||
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"
|
||||
|
||||
|
||||
# broken still
|
||||
@skip
|
||||
Scenario: Dayone entries without timezone information are interpreted in current timezone
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl -until 'feb 2013'"
|
||||
Then we should get no error
|
||||
And the output should contain "2013-01-17T18:37Z" in the local time
|
||||
|
||||
|
||||
Scenario: Loading entry with ambiguous time stamp in timezone-aware journal (like Dayone)
|
||||
#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.
|
182
tests/bdd/features/delete.feature
Normal file
182
tests/bdd/features/delete.feature
Normal file
|
@ -0,0 +1,182 @@
|
|||
Feature: Delete entries from journal
|
||||
Scenario Outline: Delete flag allows deletion of single entry
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -1"
|
||||
Then the output should contain "2020-09-24 09:14 The third entry finally"
|
||||
When we run "jrnl --delete" and enter
|
||||
N
|
||||
N
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Backing out of interactive delete does not change journal
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -n 1" and enter
|
||||
N
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with nonsense input deletes nothing (issue #932)
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete asdfasdf"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with tag only deletes tagged entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete @ipsum" and enter
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with multiple tags deletes all entries matching any of the tags
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete @ipsum @tagthree" and enter
|
||||
Y
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with -and deletes boolean AND of tagged entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -and @tagone @tagtwo" and enter
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with -not does not delete entries from given tag
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete @tagone -not @ipsum" and enter
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with -from search operator only deletes entries since that date
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -from 2020-09-01" and enter
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with -to only deletes entries up to specified date
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -to 2020-08-31" and enter
|
||||
Y
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with -starred only deletes starred entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -starred" and enter
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Delete flag with -contains only entries containing expression
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -contains dignissim" and enter
|
||||
Y
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
42
tests/bdd/features/encrypt.feature
Normal file
42
tests/bdd/features/encrypt.feature
Normal file
|
@ -0,0 +1,42 @@
|
|||
Feature: Encrypting and decrypting journals
|
||||
|
||||
Scenario: Decrypting a journal
|
||||
Given we use the config "encrypted.yaml"
|
||||
When we run "jrnl --decrypt" and enter "bad doggie no biscuit"
|
||||
Then we should see the message "Journal decrypted"
|
||||
And the config for journal "default" should contain "encrypt: false"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
|
||||
|
||||
@todo
|
||||
Scenario: Trying to decrypt an already unencrypted journal
|
||||
# This should warn the user that the journal is already encrypted
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --decrypt"
|
||||
Then the config for journal "default" should contain "encrypt: false"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
|
||||
|
||||
@todo
|
||||
Scenario: Trying to encrypt an already encrypted journal
|
||||
# This should warn the user that the journal is already encrypted
|
||||
|
||||
|
||||
Scenario: Encrypting a journal
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --encrypt" and enter
|
||||
swordfish
|
||||
swordfish
|
||||
n
|
||||
Then we should see the message "Journal encrypted"
|
||||
And the config for journal "default" should contain "encrypt: true"
|
||||
When we run "jrnl -n 1" and enter "swordfish"
|
||||
Then we should be prompted for a password
|
||||
And the output should contain "2013-06-10 15:40 Life is good"
|
||||
|
52
tests/bdd/features/file_storage.feature
Normal file
52
tests/bdd/features/file_storage.feature
Normal file
|
@ -0,0 +1,52 @@
|
|||
Feature: Journals iteracting with the file system in a way that users can see
|
||||
|
||||
Scenario: Adding entries to a Folder journal should generate date files
|
||||
Given we use the config "empty_folder.yaml"
|
||||
When we run "jrnl 23 July 2013: Testing folder journal."
|
||||
Then we should see the message "Entry added"
|
||||
And the journal directory should contain
|
||||
2013/07/23.txt
|
||||
|
||||
Scenario: Adding multiple entries to a Folder journal should generate multiple date files
|
||||
Given we use the config "empty_folder.yaml"
|
||||
When we run "jrnl 23 July 2013: Testing folder journal."
|
||||
And we run "jrnl 3/7/2014: Second entry of journal."
|
||||
Then we should see the message "Entry added"
|
||||
And the journal directory should contain
|
||||
2013/07/23.txt
|
||||
|
||||
Scenario: If the journal and its parent directory don't exist, they should be created
|
||||
Given we use the config "missing_directory.yaml"
|
||||
Then the journal should not exist
|
||||
When we run "jrnl This is a new entry in my journal"
|
||||
Then the journal should exist
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should contain "This is a new entry in my journal"
|
||||
|
||||
Scenario: If the journal file doesn't exist, then it should be created
|
||||
Given we use the config "missing_journal.yaml"
|
||||
Then the journal should not exist
|
||||
When we run "jrnl This is a new entry in my journal"
|
||||
Then the journal should exist
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should contain "This is a new entry in my journal"
|
||||
|
||||
Scenario: Creating journal with relative path should update to absolute path
|
||||
When we run "jrnl hello world" and enter
|
||||
test.txt
|
||||
n
|
||||
Then the output should contain "Journal 'default' created"
|
||||
When we change directory to "subfolder"
|
||||
And we run "jrnl -n 1"
|
||||
Then the output should contain "hello world"
|
||||
|
||||
Scenario: the temporary filename suffix should default to ".jrnl"
|
||||
Given we use the config "editor.yaml"
|
||||
When we run "jrnl --edit"
|
||||
Then the editor should have been called
|
||||
Then the editor filename should end with ".jrnl"
|
||||
|
||||
Scenario: the temporary filename suffix should be "-{template_filename}"
|
||||
Given we use the config "editor_markdown_extension.yaml"
|
||||
When we run "jrnl --edit"
|
||||
Then the editor filename should end with "-extension.md"
|
561
tests/bdd/features/format.feature
Normal file
561
tests/bdd/features/format.feature
Normal file
|
@ -0,0 +1,561 @@
|
|||
Feature: Custom formats
|
||||
|
||||
Scenario Outline: JSON format
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --format json"
|
||||
Then we should get no error
|
||||
And the output should be valid JSON
|
||||
Given we parse the output as JSON
|
||||
Then "entries" in the parsed output should have 3 elements
|
||||
And "tags" in the parsed output should be
|
||||
@ipsum
|
||||
@tagone
|
||||
@tagtwo
|
||||
@tagthree
|
||||
And "entries.0.tags" in the parsed output should have 3 elements
|
||||
And "entries.1.tags" in the parsed output should have 1 elements
|
||||
And "entries.2.tags" in the parsed output should have 2 elements
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario: Exporting dayone to json should include UUID
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl --export json"
|
||||
Then we should get no error
|
||||
And the output should be valid JSON
|
||||
Given we parse the output as JSON
|
||||
Then "entries.0.uuid" in the parsed output should be
|
||||
4BB1F46946AD439996C9B59DE7C4DDC1
|
||||
|
||||
Scenario Outline: Printing a journal that has multiline entries with tags
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -n 1 @ipsum"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
| Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
|
||||
| quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus
|
||||
| pellentesque
|
||||
| augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu
|
||||
| consequat. Aenean ante ex, elementum ut interdum et, mattis eget lacus. In
|
||||
| commodo nulla nec tellus placerat, sed ultricies metus bibendum. Duis eget
|
||||
| venenatis erat. In at dolor dui. @tagone and maybe also @tagtwo.
|
||||
|
|
||||
| Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo
|
||||
| ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna. Suspendisse
|
||||
| potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas eget
|
||||
| molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed lectus
|
||||
| hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis
|
||||
| feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id, vestibulum
|
||||
| urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod enim.
|
||||
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget
|
||||
| velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
|
||||
| porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
|
||||
| conubia nostra, per inceptos himenaeos.
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Exporting using filters should only export parts of the journal
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -until 'August 2020' --format json"
|
||||
Then the output should be valid JSON
|
||||
Then we should get no error
|
||||
And the output should be valid JSON
|
||||
Given we parse the output as JSON
|
||||
Then "entries" in the parsed output should have 2 elements
|
||||
And "tags" in the parsed output should be
|
||||
@ipsum
|
||||
@tagone
|
||||
@tagtwo
|
||||
And "entries.0.tags" in the parsed output should have 3 elements
|
||||
And "entries.1.tags" in the parsed output should have 1 elements
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Exporting using custom templates
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -1 --format sample"
|
||||
Then the output should be
|
||||
The third entry finally after weeks without writing.
|
||||
----------------------------------------------------
|
||||
|
||||
I'm so excited about emojis. 💯 🎶 💩
|
||||
|
||||
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis.
|
||||
Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor. Nulla
|
||||
eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis
|
||||
dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh malesuada.
|
||||
Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis
|
||||
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan justo.
|
||||
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
|
||||
ante eget fringilla. @tagthree and also @tagone
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
@skip_editor # .TODO return after editor steps implemented
|
||||
Scenario Outline: Increasing Headings on Markdown export
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we open the editor and append
|
||||
[2020-10-14 13:23] Heading Test
|
||||
|
||||
H1-1
|
||||
=
|
||||
|
||||
H1-2
|
||||
===
|
||||
|
||||
H1-3
|
||||
============================
|
||||
|
||||
H2-1
|
||||
-
|
||||
|
||||
H2-2
|
||||
---
|
||||
|
||||
H2-3
|
||||
----------------------------------
|
||||
|
||||
Horizontal Rules (ignore)
|
||||
|
||||
---
|
||||
|
||||
===
|
||||
|
||||
# ATX H1
|
||||
|
||||
## ATX H2
|
||||
|
||||
### ATX H3
|
||||
|
||||
#### ATX H4
|
||||
|
||||
##### ATX H5
|
||||
|
||||
###### ATX H6
|
||||
|
||||
Stuff
|
||||
|
||||
More stuff
|
||||
more stuff again
|
||||
When we run "jrnl -1 --export markdown"
|
||||
Then the output should be
|
||||
# 2020
|
||||
|
||||
## October
|
||||
|
||||
### 2020-10-14 13:23 Heading Test
|
||||
|
||||
#### H1-1
|
||||
|
||||
#### H1-2
|
||||
|
||||
#### H1-3
|
||||
|
||||
##### H2-1
|
||||
|
||||
##### H2-2
|
||||
|
||||
##### H2-3
|
||||
|
||||
Horizontal Rules (ignore)
|
||||
|
||||
---
|
||||
|
||||
===
|
||||
|
||||
#### ATX H1
|
||||
|
||||
##### ATX H2
|
||||
|
||||
###### ATX H3
|
||||
|
||||
####### ATX H4
|
||||
|
||||
######## ATX H5
|
||||
|
||||
######### ATX H6
|
||||
|
||||
Stuff
|
||||
|
||||
More stuff
|
||||
more stuff again
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
@skip_editor # .TODO return after editor steps implemented
|
||||
Scenario Outline: 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 "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we open the editor and append
|
||||
[2020-10-29 11:11] First entry.
|
||||
[2020-10-29 11:11] Second entry.
|
||||
[2020-10-29 11:13] Third entry.
|
||||
When we run "jrnl -3 --format markdown"
|
||||
Then the output should be
|
||||
# 2020
|
||||
|
||||
## October
|
||||
|
||||
### 2020-10-29 11:11 First entry.
|
||||
|
||||
|
||||
### 2020-10-29 11:11 Second entry.
|
||||
|
||||
|
||||
### 2020-10-29 11:13 Third entry.
|
||||
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
@skip
|
||||
Scenario Outline: Exporting to XML
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --export xml"
|
||||
Then the output should be a valid XML string
|
||||
And "entries" in the xml output should have 3 elements
|
||||
And "tags" in the xml output should contain
|
||||
@ipsum
|
||||
@tagone
|
||||
@tagtwo
|
||||
@tagthree
|
||||
And there should be 10 "tag" elements
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
# | basic_onefile.yaml | @todo
|
||||
# | basic_encrypted.yaml | @todo
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
Scenario: Exporting to XML
|
||||
Given we use the config "tags.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --export xml"
|
||||
Then the output should be valid XML
|
||||
Given we parse the output as XML
|
||||
Then "entries" in the parsed output should have 2 elements
|
||||
And "tags" in the parsed output should be
|
||||
@idea
|
||||
@journal
|
||||
@dan
|
||||
And there should be 7 "tag" elements
|
||||
|
||||
Scenario Outline: Exporting tags
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --export tags"
|
||||
Then the output should be
|
||||
@tagtwo : 2
|
||||
@tagone : 2
|
||||
@tagthree : 1
|
||||
@ipsum : 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
@todo
|
||||
Scenario Outline: Exporting fancy
|
||||
# Needs better emoji support
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --export fancy"
|
||||
Then the output should be
|
||||
┎──────────────────────────────────────────────────────────────╮2020-08-29 11:11
|
||||
┃ Entry the first. ╘═══════════════╕
|
||||
┠╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
||||
┃ Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada │
|
||||
┃ quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus │
|
||||
┃ pellentesque │
|
||||
┃ augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu │
|
||||
┃ consequat. Aenean ante ex, elementum ut interdum et, mattis eget lacus. In │
|
||||
┃ commodo nulla nec tellus placerat, sed ultricies metus bibendum. Duis eget │
|
||||
┃ venenatis erat. In at dolor dui. @tagone and maybe also @tagtwo. │
|
||||
┃ │
|
||||
┃ Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo │
|
||||
┃ ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna. │
|
||||
┃ Suspendisse │
|
||||
┃ potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas │
|
||||
┃ eget │
|
||||
┃ molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed │
|
||||
┃ lectus │
|
||||
┃ hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis │
|
||||
┃ feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id, │
|
||||
┃ vestibulum │
|
||||
┃ urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod │
|
||||
┃ enim. │
|
||||
┃ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget │
|
||||
┃ velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac │
|
||||
┃ porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per │
|
||||
┃ conubia nostra, per inceptos himenaeos. │
|
||||
┖──────────────────────────────────────────────────────────────────────────────┘
|
||||
┎──────────────────────────────────────────────────────────────╮2020-08-31 14:32
|
||||
┃ A second entry in what I hope to be a long series. ╘═══════════════╕
|
||||
┠╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
||||
┃ Sed sit amet metus et sapien feugiat elementum. Aliquam bibendum lobortis │
|
||||
┃ leo │
|
||||
┃ vitae tempus. Donec eleifend nec mi non volutpat. Lorem ipsum dolor sit │
|
||||
┃ amet, │
|
||||
┃ consectetur adipiscing elit. Praesent ut sodales libero. Maecenas nisl │
|
||||
┃ lorem, │
|
||||
┃ vestibulum in tempus sit amet, fermentum ut arcu. Donec vel vestibulum │
|
||||
┃ lectus, │
|
||||
┃ eget pretium enim. Maecenas diam nunc, imperdiet vitae pharetra sed, pretium │
|
||||
┃ id │
|
||||
┃ lectus. Donec eu metus et turpis tempor tristique ac non ex. In tellus arcu, │
|
||||
┃ egestas at efficitur et, ultrices vel est. Sed commodo et nibh non │
|
||||
┃ elementum. │
|
||||
┃ Mauris tempus vitae neque vel viverra. @tagtwo all by its lonesome. │
|
||||
┃ │
|
||||
┃ Nulla mattis elementum magna, viverra pretium dui fermentum et. Cras vel │
|
||||
┃ vestibulum odio. Quisque sit amet turpis et urna finibus maximus. Interdum │
|
||||
┃ et │
|
||||
┃ malesuada fames ac ante ipsum primis in faucibus. Fusce porttitor iaculis │
|
||||
┃ sem, │
|
||||
┃ non dictum ipsum varius nec. Nulla eu erat at risus gravida blandit non vel │
|
||||
┃ ante. Nam egestas ipsum leo, eu ultricies ipsum tincidunt vel. Morbi a │
|
||||
┃ commodo │
|
||||
┃ eros. │
|
||||
┃ │
|
||||
┃ Nullam dictum, nisl ac varius tempus, ex tortor fermentum nisl, non │
|
||||
┃ tempus dolor neque a lorem. Suspendisse a faucibus ex, vel ornare tortor. │
|
||||
┃ Maecenas tincidunt id felis quis semper. Pellentesque enim libero, fermentum │
|
||||
┃ quis metus id, rhoncus euismod magna. Nulla finibus velit eu purus bibendum │
|
||||
┃ interdum. Integer id justo dui. Integer eu tellus in turpis bibendum │
|
||||
┃ blandit. │
|
||||
┃ Quisque auctor lacinia consectetur. │
|
||||
┖──────────────────────────────────────────────────────────────────────────────┘
|
||||
┎──────────────────────────────────────────────────────────────╮2020-09-24 09:14
|
||||
┃ The third entry finally after weeks without writing. ╘═══════════════╕
|
||||
┠╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
||||
┃ I'm so excited about emojis. 💯 🎶 💩 │
|
||||
┃ │
|
||||
┃ Donec semper pellentesque iaculis. Nullam cursus et justo sit amet │
|
||||
┃ venenatis. │
|
||||
┃ Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor. │
|
||||
┃ Nulla │
|
||||
┃ eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis │
|
||||
┃ dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh │
|
||||
┃ malesuada. │
|
||||
┃ Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis │
|
||||
┃ vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan │
|
||||
┃ justo. │
|
||||
┃ Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at │
|
||||
┃ ante eget fringilla. @tagthree and also @tagone │
|
||||
┖──────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
@skip_win
|
||||
Scenario Outline: Export to yaml
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we create a cache directory
|
||||
When we run "jrnl --format yaml --file {cache_dir}"
|
||||
Then the cache directory should contain the files
|
||||
2020-08-29_entry-the-first.md
|
||||
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md
|
||||
2020-09-24_the-third-entry-finally-after-weeks-without-writing.md
|
||||
|
||||
And the content of file "2020-08-29_entry-the-first.md" in the cache should be
|
||||
---
|
||||
title: Entry the first.
|
||||
date: 2020-08-29 11:11
|
||||
starred: False
|
||||
tags: tagone, ipsum, tagtwo
|
||||
body: |
|
||||
Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
|
||||
quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque
|
||||
augue et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu
|
||||
consequat. Aenean ante ex, elementum ut interdum et, mattis eget lacus. In
|
||||
commodo nulla nec tellus placerat, sed ultricies metus bibendum. Duis eget
|
||||
venenatis erat. In at dolor dui. @tagone and maybe also @tagtwo.
|
||||
|
||||
Curabitur accumsan nunc ac neque tristique, eleifend faucibus justo
|
||||
ullamcorper. Suspendisse at mattis nunc. Nullam eget lacinia urna. Suspendisse
|
||||
potenti. Ut urna est, venenatis sed ante in, ultrices congue mi. Maecenas eget
|
||||
molestie metus. Mauris porttitor dui ornare gravida porta. Quisque sed lectus
|
||||
hendrerit, lacinia ante eget, vulputate ante. Aliquam vitae erat non felis
|
||||
feugiat sagittis. Phasellus quis arcu fringilla, mattis ligula id, vestibulum
|
||||
urna. Vivamus facilisis leo a mi tincidunt condimentum. Donec eu euismod enim.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu ligula eget
|
||||
velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
|
||||
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
|
||||
conubia nostra, per inceptos himenaeos.
|
||||
...
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
# | basic_dayone.yaml |
|
||||
|
||||
@skip_win # @todo YAML exporter does not correctly export emoji on Windows
|
||||
Scenario Outline: 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 "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we create a cache directory
|
||||
When we run "jrnl --export yaml -o {cache_dir}"
|
||||
Then the cache should contain the files
|
||||
2020-08-29_entry-the-first.md
|
||||
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md
|
||||
2020-09-24_the-third-entry-finally-after-weeks-without-writing.md
|
||||
And the content of file "2020-09-24_the-third-entry-finally-after-weeks-without-writing.md" in the cache should be
|
||||
---
|
||||
title: The third entry finally after weeks without writing.
|
||||
date: 2020-09-24 09:14
|
||||
starred: False
|
||||
tags: tagone, tagthree
|
||||
body: |
|
||||
I'm so excited about emojis. 💯 🎶 💩
|
||||
|
||||
Donec semper pellentesque iaculis. Nullam cursus et justo sit amet venenatis.
|
||||
Vivamus tempus ex dictum metus vehicula gravida. Aliquam sed sem dolor. Nulla
|
||||
eget ultrices purus. Quisque at nunc at quam pharetra consectetur vitae quis
|
||||
dolor. Fusce ultricies purus eu est feugiat, quis scelerisque nibh malesuada.
|
||||
Quisque egestas semper nibh in hendrerit. Nam finibus ex in mi mattis
|
||||
vulputate. Sed mauris urna, consectetur in justo eu, volutpat accumsan justo.
|
||||
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
|
||||
ante eget fringilla. @tagthree and also @tagone
|
||||
...
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
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 Outline: --short displays the short version of entries (only the title)
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -on 2020-08-31 --short"
|
||||
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: -s displays the short version of entries (only the title)
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -on 2020-08-31 -s"
|
||||
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario: Markdown Support from config file
|
||||
Given we use the config "format_md.yaml"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should be
|
||||
# 2013
|
||||
|
||||
## June
|
||||
|
||||
### 2013-06-10 15:40 Life is good.
|
||||
|
||||
But I'm better.
|
||||
|
||||
Scenario: Text Formatter from config file
|
||||
Given we use the config "format_text.yaml"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should be
|
||||
[2013-06-10 15:40] Life is good.
|
||||
But I'm better.
|
||||
|
||||
Scenario Outline: Exporting entries with Cyrillic characters to directory should not fail
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we create a cache directory
|
||||
When we run "jrnl 2020-11-21: Первая"
|
||||
When we run "jrnl --format md --file {cache_dir} -on 2020-11-21"
|
||||
Then the cache should contain the files
|
||||
2020-11-21_первая.md
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Export date counts
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl 2020-08-31 01:01: Hi."
|
||||
And we run "jrnl --format dates"
|
||||
Then the output should be
|
||||
2020-08-29, 1
|
||||
2020-08-31, 2
|
||||
2020-09-24, 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
88
tests/bdd/features/import.feature
Normal file
88
tests/bdd/features/import.feature
Normal file
|
@ -0,0 +1,88 @@
|
|||
Feature: Importing data
|
||||
|
||||
Scenario Outline: --import allows new entry from stdin
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --import" and pipe "[2020-07-05 15:00] Observe and import."
|
||||
When we run "jrnl -9 --short"
|
||||
Then the output should contain "Observe and import"
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
Scenario Outline: --import allows new large entry from stdin
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --import" and pipe
|
||||
[2020-07-05 15:00] Observe and import.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis
|
||||
est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue
|
||||
et venenatis facilisis. Suspendisse potenti. Sed dignissim sed nisl eu consequat.
|
||||
Aenean ante ex, elementum ut interdum et, mattis eget lacus. In commodo nulla nec
|
||||
tellus placerat, sed ultricies metus bibendum. Duis eget venenatis erat. In at
|
||||
dolor dui end of entry.
|
||||
When we run "jrnl -on 2020-07-05"
|
||||
Then the output should contain "2020-07-05 15:00 Observe and import."
|
||||
And the output should contain "Lorem ipsum"
|
||||
And the output should contain "end of entry."
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
Scenario Outline: --import allows multiple new entries from stdin
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --import" and pipe
|
||||
[2020-07-05 15:00] Observe and import.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
|
||||
[2020-07-05 15:01] Twice as nice.
|
||||
Sed dignissim sed nisl eu consequat.
|
||||
When we run "jrnl -on 2020-07-05"
|
||||
Then the output should contain "2020-07-05 15:00 Observe and import."
|
||||
And the output should contain "Lorem ipsum"
|
||||
And the output should contain "2020-07-05 15:01 Twice as nice."
|
||||
And the output should contain "Sed dignissim"
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
# | basic_folder.yaml | @todo
|
||||
# | basic_dayone.yaml | @todo
|
||||
|
||||
Scenario: --import allows import new entries from file
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "Life is good."
|
||||
But the output should not contain "I have an @idea"
|
||||
And the output should not contain "I met with"
|
||||
When we run "jrnl --import --file features/journals/tags.journal"
|
||||
And we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "Life is good."
|
||||
And the output should contain "PROFIT!"
|
||||
|
||||
Scenario: --import prioritizes --file over pipe data if both are given
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "Life is good."
|
||||
But the output should not contain "I have an @idea"
|
||||
And the output should not contain "I met with"
|
||||
When we run "jrnl --import --file features/journals/tags.journal" and pipe
|
||||
[2020-07-05 15:00] I should not exist!
|
||||
And we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "PROFIT!"
|
||||
But the output should not contain "I should not exist!"
|
||||
|
90
tests/bdd/features/multiple_journals.feature
Normal file
90
tests/bdd/features/multiple_journals.feature
Normal file
|
@ -0,0 +1,90 @@
|
|||
Feature: Multiple journals
|
||||
|
||||
Scenario: Loading a config with two journals
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be empty
|
||||
|
||||
Scenario: Write to default config by default
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl this goes to default"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should contain
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
Then the output should contain
|
||||
this goes to default
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be empty
|
||||
|
||||
Scenario: Write to specified journal
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work a long day in the office"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should contain "a long day in the office"
|
||||
|
||||
Scenario: Tell user which journal was used
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work a long day in the office"
|
||||
Then we should see the message "Entry added to work journal"
|
||||
|
||||
Scenario: Write to specified journal with a timestamp
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work 23 july 2012: a long day in the office"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be
|
||||
2012-07-23 09:00 a long day in the office
|
||||
|
||||
Scenario: Write to specified journal without a timestamp but with colon
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work : a long day in the office"
|
||||
Then the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be contain
|
||||
a long day in the office
|
||||
|
||||
Scenario: Write to specified journal without a timestamp but with colon
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work: a long day in the office"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should contain
|
||||
a long day in the office
|
||||
|
||||
Scenario: Create new journals as required
|
||||
Given we use the config "multiple.yaml"
|
||||
Then journal "ideas" should not exist
|
||||
When we run "jrnl ideas 23 july 2012: sell my junk on ebay and make lots of money"
|
||||
When we run "jrnl ideas -99 --short"
|
||||
Then the output should be
|
||||
2012-07-23 09:00 sell my junk on ebay and make lots of money
|
||||
|
||||
Scenario: Don't crash if no default journal is specified
|
||||
Given we use the config "bug343.yaml"
|
||||
When we run "jrnl a long day in the office"
|
||||
Then the output should contain "No default journal configured"
|
||||
|
||||
Scenario: Don't crash if no file exists for a configured encrypted journal
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl new_encrypted Adding first entry" and enter
|
||||
these three eyes
|
||||
these three eyes
|
||||
n
|
||||
Then the output should contain "Encrypted journal 'new_encrypted' created"
|
122
tests/bdd/features/password.feature
Normal file
122
tests/bdd/features/password.feature
Normal file
|
@ -0,0 +1,122 @@
|
|||
Feature: Using the installed keyring
|
||||
|
||||
Scenario: Storing a password in keyring
|
||||
Given we use the config "multiple.yaml"
|
||||
And we have a keyring
|
||||
When we run "jrnl simple --encrypt" and enter
|
||||
sabertooth
|
||||
sabertooth
|
||||
Y
|
||||
Then the config for journal "simple" should contain "encrypt: true"
|
||||
When we run "jrnl simple -n 1"
|
||||
Then the output should contain "2013-06-10 15:40 Life is good"
|
||||
|
||||
|
||||
Scenario: Encrypt journal with no keyring backend and do not store in keyring
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl test entry"
|
||||
And we run "jrnl --encrypt" and enter
|
||||
password
|
||||
password
|
||||
n
|
||||
Then we should get no error
|
||||
And the output should not contain "Failed to retrieve keyring"
|
||||
|
||||
|
||||
Scenario: Encrypt journal with no keyring backend and do store in keyring
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl test entry"
|
||||
And we run "jrnl --encrypt" and enter
|
||||
password
|
||||
password
|
||||
y
|
||||
Then we should get no error
|
||||
And the output should not contain "Failed to retrieve keyring"
|
||||
# @todo add step to check contents of keyring
|
||||
|
||||
|
||||
@todo
|
||||
Scenario: Open an encrypted journal with wrong password in keyring
|
||||
# This should ask the user for the password after the keyring fails
|
||||
|
||||
|
||||
@todo
|
||||
Scenario: Decrypt journal with password in keyring
|
||||
|
||||
|
||||
@todo
|
||||
Scenario: Decrypt journal without a keyring
|
||||
|
||||
|
||||
Scenario: Encrypt journal when keyring exists but fails
|
||||
Given we use the config "simple.yaml"
|
||||
And we have a failed keyring
|
||||
When we run "jrnl --encrypt" and enter
|
||||
this password will not be saved in keyring
|
||||
this password will not be saved in keyring
|
||||
y
|
||||
Then we should see the message "Failed to retrieve keyring"
|
||||
And we should get no error
|
||||
And we should be prompted for a password
|
||||
And the config for journal "default" should contain "encrypt: true"
|
||||
|
||||
|
||||
Scenario: Decrypt journal when keyring exists but fails
|
||||
Given we use the config "encrypted.yaml"
|
||||
And we have a failed keyring
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl --decrypt"
|
||||
Then the error output should contain "Failed to retrieve keyring"
|
||||
And we should get no error
|
||||
And we should be prompted for a password
|
||||
And we should see the message "Journal decrypted"
|
||||
And the config for journal "default" should contain "encrypt: false"
|
||||
When we run "jrnl --short"
|
||||
Then we should not be prompted for a password
|
||||
And the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
|
||||
|
||||
Scenario: Open encrypted journal when keyring exists but fails
|
||||
# This should ask the user for the password after the keyring fails
|
||||
Given we use the config "encrypted.yaml"
|
||||
And we have a failed keyring
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl -n 1"
|
||||
Then we should get no error
|
||||
And we should be prompted for a password
|
||||
And the output should contain "Failed to retrieve keyring"
|
||||
And the output should contain "2013-06-10 15:40 Life is good"
|
||||
|
||||
|
||||
Scenario: Mistyping your password
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --encrypt" and enter
|
||||
swordfish
|
||||
sordfish
|
||||
Then we should be prompted for a password
|
||||
And we should see the message "Passwords did not match"
|
||||
And the config for journal "default" should not contain "encrypt: true"
|
||||
When we run "jrnl --short"
|
||||
Then the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
|
||||
|
||||
Scenario: Mistyping your password, then getting it right
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --encrypt" and enter
|
||||
swordfish
|
||||
sordfish
|
||||
swordfish
|
||||
swordfish
|
||||
n
|
||||
Then we should be prompted for a password
|
||||
And we should see the message "Passwords did not match"
|
||||
And we should see the message "Journal encrypted"
|
||||
And the config for journal "default" should contain "encrypt: true"
|
||||
When we run "jrnl -1" and enter "swordfish"
|
||||
Then we should be prompted for a password
|
||||
And the output should contain "2013-06-10 15:40 Life is good"
|
||||
|
293
tests/bdd/features/search.feature
Normal file
293
tests/bdd/features/search.feature
Normal file
|
@ -0,0 +1,293 @@
|
|||
Feature: Searching in a journal
|
||||
|
||||
Scenario Outline: Displaying entries using -on today should display entries created today
|
||||
Given we use the config "<config_file>"
|
||||
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."
|
||||
But the output should not contain "Everything is alright"
|
||||
And the output should not contain "Life is good"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
|
||||
Scenario Outline: Displaying entries using -from day should display correct entries
|
||||
Given we use the config "<config_file>"
|
||||
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"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
|
||||
Scenario Outline: Displaying entries using -from and -to day should display correct entries
|
||||
Given we use the config "<config_file>"
|
||||
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."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
|
||||
Scenario Outline: Searching for a string
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl -contains first --short"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
2020-08-29 11:11 Entry the first.
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Searching for a string within tag results
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl @tagone -contains maybe"
|
||||
Then we should get no error
|
||||
And the output should contain "maybe"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Searching for a string within AND tag results
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl -and @tagone @tagtwo -contains maybe"
|
||||
Then we should get no error
|
||||
And the output should contain "maybe"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Searching for a string within NOT tag results
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl -not @tagone -contains lonesome"
|
||||
Then we should get no error
|
||||
And the output should contain "lonesome"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Searching for dates
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl -on 2020-08-31 --short"
|
||||
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
|
||||
When we run "jrnl -on 'august 31 2020' --short"
|
||||
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario: Out of order entries to a Folder journal should be listed in date order
|
||||
Given we use the config "empty_folder.yaml"
|
||||
When we run "jrnl 3/7/2014 4:37pm: Second entry of journal."
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl 23 July 2013: Testing folder journal."
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -2"
|
||||
Then the output should be
|
||||
2013-07-23 09:00 Testing folder journal.
|
||||
|
||||
2014-03-07 16:37 Second entry of journal.
|
||||
|
||||
Scenario Outline: Searching for all tags should show counts of each tag
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
@tagtwo : 2
|
||||
@tagone : 2
|
||||
@tagthree : 1
|
||||
@ipsum : 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Filtering journals should also filter tags
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl -from 'september 2020' --tags"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
@tagthree : 1
|
||||
@tagone : 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Excluding a tag should filter out all entries with that tag
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags -not @tagtwo"
|
||||
Then the output should be
|
||||
@tagthree : 1
|
||||
@tagone : 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Excluding multiple tags should filter out all entries with those tags
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags -not @tagone -not @tagthree"
|
||||
Then the output should be
|
||||
@tagtwo : 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario: DayOne tag searching should work with tags containing a mixture of upper and lower case.
|
||||
# https://github.com/jrnl-org/jrnl/issues/354
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl @plAy"
|
||||
Then the output should contain "2013-05-17 11:39 This entry has tags!"
|
||||
|
||||
Scenario: Loading a sample journal
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl -2"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
2013-06-09 15:39 My first entry.
|
||||
| Everything is alright
|
||||
|
||||
2013-06-10 15:40 Life is good.
|
||||
| But I'm better.
|
||||
|
||||
Scenario Outline: Searching by month
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -month 9 --short"
|
||||
Then the output should be "2020-09-24 09:14 The third entry finally after weeks without writing."
|
||||
When we run "jrnl -month Sept --short"
|
||||
Then the output should be "2020-09-24 09:14 The third entry finally after weeks without writing."
|
||||
When we run "jrnl -month September --short"
|
||||
Then the output should be "2020-09-24 09:14 The third entry finally after weeks without writing."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Searching by day
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -day 31 --short"
|
||||
Then the output should be "2020-08-31 14:32 A second entry in what I hope to be a long series."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Searching by year
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl 2019-01-01 01:01: I like this year."
|
||||
And we run "jrnl -year 2019 --short"
|
||||
Then the output should be "2019-01-01 01:01 I like this year."
|
||||
When we run "jrnl -year 19 --short"
|
||||
Then the output should be "2019-01-01 01:01 I like this year."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Combining month, day, and year search terms
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl -month 08 -day 29 --short"
|
||||
Then the output should be "2020-08-29 11:11 Entry the first."
|
||||
When we run "jrnl -day 29 -year 2020 --short"
|
||||
Then the output should be "2020-08-29 11:11 Entry the first."
|
||||
When we run "jrnl -month 09 -year 2020 --short"
|
||||
Then the output should be "2020-09-24 09:14 The third entry finally after weeks without writing."
|
||||
When we run "jrnl -month 08 -day 29 -year 2020 --short"
|
||||
Then the output should be "2020-08-29 11:11 Entry the first."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Searching today in history
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And now is "2020-08-31 02:32:00 PM"
|
||||
When we run "jrnl 2019-08-31 01:01: Hi, from last year."
|
||||
And we run "jrnl -today-in-history --short"
|
||||
Then the output should be
|
||||
2019-08-31 01:01 Hi, from last year.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario: Loading a DayOne Journal
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl -from 'feb 2013'"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
2013-05-17 11:39 This entry has tags!
|
||||
|
||||
2013-06-17 20:38 This entry has a location.
|
||||
|
||||
2013-07-17 11:38 This entry is starred!
|
35
tests/bdd/features/star.feature
Normal file
35
tests/bdd/features/star.feature
Normal file
|
@ -0,0 +1,35 @@
|
|||
Feature: Starring entries
|
||||
|
||||
Scenario Outline: Starring an entry will mark it in the journal file
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl 20 july 2013 *: Best day of my life!"
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -on 2013-07-20 -starred"
|
||||
Then the output should contain "2013-07-20 09:00 Best day of my life!"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
|
||||
Scenario Outline: Filtering by starred entries will show only starred entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl -starred"
|
||||
Then the output should be empty
|
||||
When we run "jrnl 20 july 2013 *: Best day of my life!"
|
||||
When we run "jrnl -starred"
|
||||
Then the output should be "2013-07-20 09:00 Best day of my life!"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone_empty.yaml |
|
||||
|
||||
Scenario: Starring an entry will mark it in an encrypted journal
|
||||
Given we use the config "encrypted.yaml"
|
||||
When we run "jrnl 20 july 2013 *: Best day of my life!" and enter "bad doggie no biscuit"
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -on 2013-07-20 -starred" and enter "bad doggie no biscuit"
|
||||
Then the output should contain "2013-07-20 09:00 Best day of my life!"
|
48
tests/bdd/features/tag.feature
Normal file
48
tests/bdd/features/tag.feature
Normal file
|
@ -0,0 +1,48 @@
|
|||
Feature: Tagging
|
||||
# See search.feature for tag-related searches
|
||||
# And format.feature for tag-related output
|
||||
|
||||
Scenario Outline: Tags should allow certain special characters such as /, +, #
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl 2020-09-26: This is an entry about @os/2 and @c++ and @c#"
|
||||
When we run "jrnl --tags -on 2020-09-26"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
@os/2 : 1
|
||||
@c++ : 1
|
||||
@c# : 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Emails addresses should not be parsed as tags
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl 2020-09-26: The email address test@example.com does not seem to work for me"
|
||||
When we run "jrnl 2020-09-26: The email address test@example.org also does not work for me"
|
||||
When we run "jrnl 2020-09-26: I tried test@example.org and test@example.edu too"
|
||||
When we run "jrnl --tags -on 2020-09-26"
|
||||
Then we should get no error
|
||||
And the output should be "[No tags found in journal.]"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Entry can start and end with tags
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl 2020-09-26: @foo came over, we went to a @bar"
|
||||
When we run "jrnl --tags -on 2020-09-26"
|
||||
Then the output should be
|
||||
@foo : 1
|
||||
@bar : 1
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
54
tests/bdd/features/upgrade.feature
Normal file
54
tests/bdd/features/upgrade.feature
Normal file
|
@ -0,0 +1,54 @@
|
|||
Feature: Upgrading Journals from 1.x.x to 2.x.x
|
||||
|
||||
Scenario: Upgrade and parse journals with square brackets
|
||||
Given we use the config "upgrade_from_195.json"
|
||||
When we run "jrnl -9" and enter "Y"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
2010-06-10 15:00 A life without chocolate is like a bad analogy.
|
||||
2013-06-10 15:40 He said "[this] is the best time to be alive".Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
|
||||
And the output should contain
|
||||
2010-06-10 15:00 A life without chocolate is like a bad analogy.
|
||||
And the output should contain
|
||||
2013-06-10 15:40 He said "[this] is the best time to be alive".
|
||||
|
||||
Scenario: Upgrading a journal encrypted with jrnl 1.x
|
||||
Given we use the config "encrypted_old.json"
|
||||
When we run "jrnl -n 1" and enter
|
||||
Y
|
||||
bad doggie no biscuit
|
||||
bad doggie no biscuit
|
||||
Then we should be prompted for a password
|
||||
And the output should contain "2013-06-10 15:40 Life is good"
|
||||
|
||||
Scenario: Upgrading a config without colors to colors
|
||||
Given we use the config "no_colors.yaml"
|
||||
When we run "jrnl -n 1"
|
||||
Then the config should contain
|
||||
colors:
|
||||
date: none
|
||||
title: none
|
||||
body: none
|
||||
tags: none
|
||||
|
||||
Scenario: Upgrade and parse journals with little endian date format
|
||||
Given we use the config "upgrade_from_195_little_endian_dates.json"
|
||||
When we run "jrnl -9 --short" and enter "Y"
|
||||
Then the output should contain
|
||||
10.06.2010 15:00 A life without chocolate is like a bad analogy.
|
||||
10.06.2013 15:40 He said "[this] is the best time to be alive".
|
||||
|
||||
Scenario: Upgrade with missing journal
|
||||
Given we use the config "upgrade_from_195_with_missing_journal.json"
|
||||
When we run "jrnl --list" and enter "Y"
|
||||
Then the output should contain "Error: features/journals/missing.journal does not exist."
|
||||
And we should get no error
|
||||
|
||||
Scenario: Upgrade with missing encrypted journal
|
||||
Given we use the config "upgrade_from_195_with_missing_encrypted_journal.json"
|
||||
When we run "jrnl --list" and enter
|
||||
Y
|
||||
bad doggie no biscuit
|
||||
Then the output should contain "Error: features/journals/missing.journal does not exist."
|
||||
And the output should contain "We're all done"
|
||||
And we should get no error
|
213
tests/bdd/features/write.feature
Normal file
213
tests/bdd/features/write.feature
Normal file
|
@ -0,0 +1,213 @@
|
|||
Feature: Writing new entries.
|
||||
|
||||
Scenario Outline: Multiline entry with punctuation should keep title punctuation
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl This is. the title\\n This is the second line"
|
||||
And we run "jrnl -n 1"
|
||||
Then the output should contain "This is. the title"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
| encrypted.yaml |
|
||||
|
||||
Scenario Outline: Single line entry with period should be split at period
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl This is. the title"
|
||||
And we run "jrnl -1"
|
||||
Then the output should contain "| the title"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: CJK entry should be split at fullwidth period without following space.
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl 七転び。八起き"
|
||||
And we run "jrnl -1"
|
||||
Then the output should contain "| 八起き"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
| basic_dayone.yaml |
|
||||
|
||||
Scenario Outline: Writing an entry from command line should store the entry
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl 23 july 2013: 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 "2013-07-23 09:00 A cold and stormy day."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
| encrypted.yaml |
|
||||
|
||||
Scenario Outline: Writing a partial entry from command line with edit flag should go to the editor
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl this is a partial --edit"
|
||||
Then we should see the message "Entry added"
|
||||
Then the editor should have been called
|
||||
And the editor file content should be
|
||||
this is a partial
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_dayone.yaml |
|
||||
| basic_folder.yaml |
|
||||
|
||||
Scenario Outline: Writing an empty entry from the editor should yield "Nothing saved to file" message
|
||||
Given we use the config "<config_file>"
|
||||
And we write nothing to the editor if opened
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --edit"
|
||||
Then the error output should contain "[Nothing saved to file]"
|
||||
And the editor should have been called
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| editor.yaml |
|
||||
| editor_empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_onefile.yaml |
|
||||
|
||||
@skip
|
||||
Scenario Outline: Writing an empty entry from the command line with no editor should yield nothing
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl" and enter nothing
|
||||
Then the output should be empty
|
||||
And the error output should contain "Writing Entry; on a blank line"
|
||||
And the editor should not have been called
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| config_simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| encrypted.yaml |
|
||||
# | dayone | @todo
|
||||
|
||||
Scenario Outline: Writing an entry does not print the entire journal
|
||||
# https://github.com/jrnl-org/jrnl/issues/87
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl 23 july 2013: 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 not contain "Life is good"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| editor.yaml |
|
||||
| editor_empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
| encrypted.yaml |
|
||||
|
||||
Scenario Outline: Embedded period stays in title
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
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.
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
| encrypted.yaml |
|
||||
|
||||
Scenario Outline: Write and read emoji support
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl 23 july 2013: 🌞 sunny day. Saw an 🐘"
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should contain "🌞"
|
||||
And the output should contain "🐘"
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| dayone.yaml |
|
||||
| encrypted.yaml |
|
||||
|
||||
Scenario Outline: Writing an entry at the prompt (no editor) should store the entry
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl" and enter "25 jul 2013: I saw Elvis. He's alive."
|
||||
Then we should get no error
|
||||
When we run "jrnl -on '2013-07-25'"
|
||||
Then the output should contain "2013-07-25 09:00 I saw Elvis."
|
||||
And the output should contain "| He's alive."
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| simple.yaml |
|
||||
| empty_folder.yaml |
|
||||
| encrypted.yaml |
|
||||
|
||||
@todo
|
||||
Scenario: Writing an entry at the prompt (no editor) in DayOne journal
|
||||
# Need to test DayOne w/out an editor
|
||||
|
||||
Scenario: Writing into Dayone
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl 01 may 1979: Being born hurts."
|
||||
And we run "jrnl -until 1980"
|
||||
Then the output should be "1979-05-01 09:00 Being born hurts."
|
||||
|
||||
Scenario: Writing into Dayone adds extended metadata
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl 01 may 1979: Being born hurts."
|
||||
And we run "jrnl --export json"
|
||||
Then we should get no error
|
||||
And the output should be valid JSON
|
||||
Given we parse the output as JSON
|
||||
Then "entries" in the parsed output should have 5 elements
|
||||
And "entries.0.creator" in the parsed output should be
|
||||
software_agent
|
||||
os_agent
|
||||
host_name
|
||||
generation_date
|
||||
device_agent
|
||||
And "entries.0.creator.software_agent" in the parsed output should contain
|
||||
jrnl
|
||||
|
||||
Scenario: Title with an embedded period on DayOne journal
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl 04-24-2014: Ran 6.2 miles today in 1:02:03. I am feeling sore because I forgot to stretch."
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should be
|
||||
2014-04-24 09:00 Ran 6.2 miles today in 1:02:03.
|
||||
| I am feeling sore because I forgot to stretch.
|
||||
|
||||
Scenario: Opening an folder that's not a DayOne folder should treat as folder journal
|
||||
Given we use the config "empty_folder.yaml"
|
||||
When we run "jrnl 23 july 2013: Testing folder journal."
|
||||
Then we should see the message "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should be "2013-07-23 09:00 Testing folder journal."
|
17
tests/bdd/test_features.py
Normal file
17
tests/bdd/test_features.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from pytest_bdd import scenarios
|
||||
|
||||
scenarios("features/build.feature")
|
||||
scenarios("features/core.feature")
|
||||
scenarios("features/datetime.feature")
|
||||
scenarios("features/delete.feature")
|
||||
scenarios("features/encrypt.feature")
|
||||
scenarios("features/file_storage.feature")
|
||||
scenarios("features/format.feature")
|
||||
scenarios("features/import.feature")
|
||||
scenarios("features/multiple_journals.feature")
|
||||
scenarios("features/password.feature")
|
||||
scenarios("features/search.feature")
|
||||
scenarios("features/star.feature")
|
||||
scenarios("features/tag.feature")
|
||||
scenarios("features/upgrade.feature")
|
||||
scenarios("features/write.feature")
|
Loading…
Add table
Add a link
Reference in a new issue