Skip to content

Commit

Permalink
Add system test with osm website oauth app registration
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Dec 25, 2023
1 parent f41bb4c commit 169513e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
20 changes: 14 additions & 6 deletions test/system/note_comments_test.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
require "application_system_test_case"
require "website_oauth_application_system_test_case"

class NoteCommentsTest < ApplicationSystemTestCase
def test_action_text
class NoteCommentsTest < WebsiteOauthApplicationSystemTestCase
def test_add_comment
note = create(:note_with_comments)
sign_in_as(create(:user))
user = create(:user)
sign_in_as(user)
visit note_path(note)

assert_no_content "Comment from #{user.display_name}"
assert_no_content "Some newly added note comment"
assert_button "Resolve"
assert_button "Comment", :disabled => true

fill_in "text", :with => "Some text"
fill_in "text", :with => "Some newly added note comment"

assert_button "Comment & Resolve"
assert_button "Comment"
assert_button "Comment", :disabled => false

click_button "Comment"

assert_content "Comment from #{user.display_name}"
assert_content "Some newly added note comment"
end
end
14 changes: 14 additions & 0 deletions test/website_oauth_application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require "application_system_test_case"

class WebsiteOauthApplicationSystemTestCase < ApplicationSystemTestCase
def before_setup
super
osm_website_app = create(:oauth_application, :name => "OpenStreetMap Web Site", :scopes => "write_api write_notes")
Settings.oauth_application = osm_website_app.uid
end

def after_teardown
Settings.reload!
super
end
end

0 comments on commit 169513e

Please sign in to comment.