aboutsummaryrefslogtreecommitdiff
path: root/test/system/sessions_test.rb
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2024-03-13 18:03:43 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2024-03-13 18:03:43 +0100
commita7791635aa98f012d35f97c3c5288494bbb28e38 (patch)
treebad987e6b4d10ad2f7cd02e40658d464907595ee /test/system/sessions_test.rb
downloadoperum-a7791635aa98f012d35f97c3c5288494bbb28e38.tar.gz
operum-a7791635aa98f012d35f97c3c5288494bbb28e38.zip
Initial commit
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'test/system/sessions_test.rb')
-rw-r--r--test/system/sessions_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/system/sessions_test.rb b/test/system/sessions_test.rb
new file mode 100644
index 0000000..2d01eef
--- /dev/null
+++ b/test/system/sessions_test.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+require 'application_system_test_case'
+
+class SessionsTest < ApplicationSystemTestCase
+ test 'logs in successfully' do
+ sign_in!
+ end
+
+ test 'fails to log in with wrong password' do
+ visit new_sessions_url
+
+ fill_in I18n.t('activerecord.attributes.user.username'), with: users(:user).username
+ fill_in I18n.t('activerecord.attributes.user.password'), with: 'I AM ERROR'
+ click_on I18n.t('sessions.sign-in')
+
+ assert_text I18n.t('sessions.wrong-credentials')
+ end
+
+ test 'logs out successfully' do
+ sign_in!
+
+ click_on I18n.t('sessions.sign-out')
+
+ assert_text I18n.t('sessions.title')
+ end
+end