]> git.openstreetmap.org Git - rails.git/blob - test/application_system_test_case.rb
Check if db is writable on oauth authorization pages
[rails.git] / test / application_system_test_case.rb
1 require "test_helper"
2
3 ENV.delete("http_proxy")
4
5 ActiveSupport.on_load(:action_dispatch_system_test_case) do
6   ActionDispatch::SystemTesting::Server.silence_puma = true
7 end
8
9 class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
10   driven_by :selenium, :using => :headless_firefox do |options|
11     options.add_preference("intl.accept_languages", "en")
12   end
13
14   def before_setup
15     super
16     osm_website_app = create(:oauth_application, :name => "OpenStreetMap Web Site", :scopes => "write_api write_notes")
17     Settings.oauth_application = osm_website_app.uid
18   end
19
20   def after_teardown
21     Settings.reload!
22     super
23   end
24
25   private
26
27   def sign_in_as(user)
28     visit login_path
29     within "form", :text => "Email Address or Username" do
30       fill_in "username", :with => user.email
31       fill_in "password", :with => "test"
32       click_on "Log in"
33     end
34   end
35
36   def sign_out
37     visit logout_path
38     click_on "Logout", :match => :first
39   end
40
41   def within_sidebar(&)
42     within("#sidebar_content", &)
43   end
44 end