diff --git a/tests/bdd/features/config_file.feature b/tests/bdd/features/config_file.feature index 5f93aa62..4502fd0e 100644 --- a/tests/bdd/features/config_file.feature +++ b/tests/bdd/features/config_file.feature @@ -29,7 +29,7 @@ Feature: Multiple journals Given the config "multiple.yaml" exists And we use the config "basic_onefile.yaml" When we run "jrnl --cf multiple.yaml work a long day in the office" - Then we should see the message "Entry added to work journal" + Then the output should contain "Entry added to work journal" Scenario: Write to specified journal with a timestamp using an alternate config Given the config "multiple.yaml" exists @@ -64,7 +64,7 @@ Feature: Multiple journals Given the config "bug343.yaml" exists And we use the config "basic_onefile.yaml" When we run "jrnl --cf bug343.yaml a long day in the office" - Then we should see the message "No default journal configured" + Then the output should contain "No default journal configured" Scenario: Don't crash if no file exists for a configured encrypted journal using an alternate config Given the config "multiple.yaml" exists @@ -73,7 +73,7 @@ Feature: Multiple journals these three eyes these three eyes n - Then we should see the message "Encrypted journal 'new_encrypted' created" + Then the output should contain "Encrypted journal 'new_encrypted' created" Scenario: Don't overwrite main config when encrypting a journal in an alternate config Given the config "basic_onefile.yaml" exists @@ -82,7 +82,7 @@ Feature: Multiple journals these three eyes these three eyes n - Then we should see the message "Journal encrypted to features/journals/basic_onefile.journal" + Then the output should contain "Journal encrypted to features/journals/basic_onefile.journal" And the config should contain "encrypt: false" diff --git a/tests/bdd/features/datetime.feature b/tests/bdd/features/datetime.feature index 0da3027f..167dcf33 100644 --- a/tests/bdd/features/datetime.feature +++ b/tests/bdd/features/datetime.feature @@ -4,7 +4,7 @@ Feature: Reading and writing to journal with custom date formats # 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" + Then the output should contain "Entry added" When we run "jrnl -999" Then the output should contain "2013-11-30 15:42 Project Started." @@ -13,7 +13,7 @@ Feature: Reading and writing to journal with custom date formats # 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" + Then the output should contain "Entry added" When we run "jrnl -999" Then the output should contain "2099-06-26 09:00 Planet?" @@ -34,7 +34,7 @@ Feature: Reading and writing to journal with custom date formats Scenario Outline: Writing an entry from command line with custom date Given we use the config "" When we run "jrnl " - Then we should see the message "Entry added" + Then the output should contain "Entry added" When we run "jrnl -n 1" Then the output should contain "" @@ -87,7 +87,7 @@ Feature: Reading and writing to journal with custom date formats Given we use the config "simple.yaml" And now is "2019-03-12 01:30:32 PM" When we run "jrnl " - Then we should see the message "Entry added" + Then the output should contain "Entry added" When we run "jrnl -1" Then the output should contain "" Then the output should contain the date "" @@ -109,7 +109,7 @@ Feature: Reading and writing to journal with custom date formats Given we use the config "simple.yaml" And now is "2019-03-12 01:30:32 PM" When we run "jrnl " - Then we should see the message "Entry added" + Then the output should contain "Entry added" When we run "jrnl -1" Then the output should contain "" Then the output should contain the date "" diff --git a/tests/bdd/features/encrypt.feature b/tests/bdd/features/encrypt.feature index 117181be..7f466c1d 100644 --- a/tests/bdd/features/encrypt.feature +++ b/tests/bdd/features/encrypt.feature @@ -4,7 +4,7 @@ Feature: Encrypting and decrypting journals Given we use the config "encrypted.yaml" # And we use the password "bad doggie no biscuit" if prompted When we run "jrnl --decrypt" and enter "bad doggie no biscuit" - Then we should see the message "Journal decrypted" + Then the output should contain "Journal decrypted" And the config for journal "default" should contain "encrypt: false" When we run "jrnl -99 --short" Then the output should be @@ -36,7 +36,7 @@ Feature: Encrypting and decrypting journals swordfish n Then we should get no error - And we should see the message "Journal encrypted" + And the output should contain "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 diff --git a/tests/bdd/features/file_storage.feature b/tests/bdd/features/file_storage.feature index f81f2710..49e54838 100644 --- a/tests/bdd/features/file_storage.feature +++ b/tests/bdd/features/file_storage.feature @@ -3,7 +3,7 @@ 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" + Then the output should contain "Entry added" And the journal directory should contain 2013/07/23.txt @@ -11,7 +11,7 @@ Feature: Journals iteracting with the file system in a way that users can see 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" + Then the output should contain "Entry added" And the journal directory should contain 2013/07/23.txt diff --git a/tests/bdd/features/multiple_journals.feature b/tests/bdd/features/multiple_journals.feature index 381463bf..35df069b 100644 --- a/tests/bdd/features/multiple_journals.feature +++ b/tests/bdd/features/multiple_journals.feature @@ -34,7 +34,7 @@ Feature: Multiple journals 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" + Then the output should contain "Entry added to work journal" Scenario: Write to specified journal with a timestamp Given we use the config "multiple.yaml" diff --git a/tests/bdd/features/override.feature b/tests/bdd/features/override.feature index b29b11f0..723e74cc 100644 --- a/tests/bdd/features/override.feature +++ b/tests/bdd/features/override.feature @@ -61,7 +61,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys And we use the password "test" if prompted When we run "jrnl --config-override journals.default features/journals/simple.journal 20 Mar 2000: The rain in Spain comes from clouds" Then we should get no error - And we should see the message "Entry added" + And the output should contain "Entry added" When we run "jrnl -3 --config-override journals.default features/journals/simple.journal" Then the output should be 2000-03-20 09:00 The rain in Spain comes from clouds @@ -78,7 +78,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys And we use the password "test" if prompted When we run "jrnl --config-override journals.temp features/journals/simple.journal temp Sep 06 1969: @say Ni" Then we should get no error - And we should see the message "Entry added" + And the output should contain "Entry added" When we run "jrnl --config-override journals.temp features/journals/simple.journal temp -3" Then the output should be 1969-09-06 09:00 @say Ni diff --git a/tests/bdd/features/password.feature b/tests/bdd/features/password.feature index ed8aea5f..23a08aab 100644 --- a/tests/bdd/features/password.feature +++ b/tests/bdd/features/password.feature @@ -55,7 +55,7 @@ Feature: Using the installed keyring 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" + Then the output should contain "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" @@ -69,7 +69,7 @@ Feature: Using the installed keyring 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 output should contain "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 @@ -96,7 +96,7 @@ Feature: Using the installed keyring swordfish sordfish Then we should be prompted for a password - And we should see the message "Passwords did not match" + And the output should contain "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 @@ -113,8 +113,8 @@ Feature: Using the installed keyring 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 output should contain "Passwords did not match" + And the output should contain "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 diff --git a/tests/bdd/features/search.feature b/tests/bdd/features/search.feature index 8d951aaf..d52273f6 100644 --- a/tests/bdd/features/search.feature +++ b/tests/bdd/features/search.feature @@ -3,7 +3,7 @@ Feature: Searching in a journal Scenario Outline: Displaying entries using -on today should display entries created today Given we use the config "" When we run "jrnl today: Adding an entry right now." - Then we should see the message "Entry added" + Then the output should contain "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" @@ -18,11 +18,11 @@ Feature: Searching in a journal Scenario Outline: Displaying entries using -from day should display correct entries Given we use the config "" When we run "jrnl yesterday: This thing happened yesterday" - Then we should see the message "Entry added" + Then the output should contain "Entry added" When we run "jrnl today at 11:59pm: Adding an entry right now." - Then we should see the message "Entry added" + Then the output should contain "Entry added" When we run "jrnl tomorrow: A future entry." - Then we should see the message "Entry added" + Then the output should contain "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." @@ -37,11 +37,11 @@ Feature: Searching in a journal Scenario Outline: Displaying entries using -from and -to day should display correct entries Given we use the config "" When we run "jrnl yesterday: This thing happened yesterday" - Then we should see the message "Entry added" + Then the output should contain "Entry added" When we run "jrnl today at 11:59pm: Adding an entry right now." - Then we should see the message "Entry added" + Then the output should contain "Entry added" When we run "jrnl tomorrow: A future entry." - Then we should see the message "Entry added" + Then the output should contain "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." @@ -118,9 +118,9 @@ Feature: Searching in a journal 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" + Then the output should contain "Entry added" When we run "jrnl 23 July 2013: Testing folder journal." - Then we should see the message "Entry added" + Then the output should contain "Entry added" When we run "jrnl -2" Then the output should be 2013-07-23 09:00 Testing folder journal. diff --git a/tests/bdd/features/star.feature b/tests/bdd/features/star.feature index 7b1b42f1..f1340f7b 100644 --- a/tests/bdd/features/star.feature +++ b/tests/bdd/features/star.feature @@ -3,7 +3,7 @@ Feature: Starring entries Scenario Outline: Starring an entry will mark it in the journal file Given we use the config "" When we run "jrnl 20 july 2013 *: Best day of my life!" - Then we should see the message "Entry added" + Then the output should contain "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!" @@ -30,6 +30,6 @@ Feature: Starring entries 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" + Then the output should contain "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!" diff --git a/tests/bdd/features/write.feature b/tests/bdd/features/write.feature index 1cb822b5..d6f95b80 100644 --- a/tests/bdd/features/write.feature +++ b/tests/bdd/features/write.feature @@ -46,7 +46,7 @@ Feature: Writing new entries. Given we use the config "" 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" + Then the output should contain "Entry added" When we run "jrnl -n 1" Then the output should contain "2013-07-23 09:00 A cold and stormy day." @@ -61,7 +61,7 @@ Feature: Writing new entries. Given we use the config "" 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 output should contain "Entry added" Then the editor should have been called And the editor file content should be this is a partial @@ -110,7 +110,7 @@ Feature: Writing new entries. Given we use the config "" 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" + Then the output should contain "Entry added" When we run "jrnl -n 1" Then the output should not contain "Life is good" @@ -125,7 +125,7 @@ Feature: Writing new entries. Given we use the config "" 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" + Then the output should contain "Entry added" When we run "jrnl -1" Then the output should be 2014-04-24 09:00 Created a new website - empty.com. @@ -142,7 +142,7 @@ Feature: Writing new entries. Given we use the config "" 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" + Then the output should contain "Entry added" When we run "jrnl -n 1" Then the output should contain "🌞" And the output should contain "🐘" @@ -199,7 +199,7 @@ Feature: Writing new entries. 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" + Then the output should contain "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. @@ -208,6 +208,6 @@ Feature: Writing new entries. 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" + Then the output should contain "Entry added" When we run "jrnl -1" Then the output should be "2013-07-23 09:00 Testing folder journal." diff --git a/tests/lib/then_steps.py b/tests/lib/then_steps.py index 99648a6e..57cf3bf1 100644 --- a/tests/lib/then_steps.py +++ b/tests/lib/then_steps.py @@ -90,12 +90,6 @@ def output_should_be_columns_wide(cli_run, width): assert len(line) <= width -@then(parse('we should see the message "{text}"')) -def should_see_the_message(text, cli_run): - out = cli_run["stderr"] - assert text in out, [text, out] - - @then( parse( 'the config for journal "{journal_name}" {should_or_should_not} contain "{some_yaml}"'