aboutsummaryrefslogtreecommitdiff
path: root/test/application_system_test_case.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/application_system_test_case.rb
downloadoperum-a7791635aa98f012d35f97c3c5288494bbb28e38.tar.gz
operum-a7791635aa98f012d35f97c3c5288494bbb28e38.zip
Initial commit
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'test/application_system_test_case.rb')
-rw-r--r--test/application_system_test_case.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
new file mode 100644
index 0000000..eaa28b0
--- /dev/null
+++ b/test/application_system_test_case.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
+ driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
+
+ # Sign in with the default user.
+ def sign_in!
+ 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: '12341234'
+ click_on I18n.t('sessions.sign-in')
+
+ assert_text I18n.t('searches.home')
+ end
+
+ # Sign out the current user if it's already signed in, otherwise do nothing.
+ def sign_out_maybe!
+ click_on I18n.t('sessions.sign-out')
+ assert_text I18n.t('sessions.title')
+ rescue Capybara::ElementNotFound
+ # We were not logged in, do nothing.
+ end
+end