Skip to content

Commit

Permalink
Regionのシステムテストを改善
Browse files Browse the repository at this point in the history
  • Loading branch information
dowdiness committed Jan 15, 2024
1 parent 24b81fe commit 4806f75
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/system/user/regions_test.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
# frozen_string_literal: true

require 'application_system_test_case'
require 'uri'

class User::RegionsTest < ApplicationSystemTestCase
test 'show users devided by regions' do
visit_with_auth '/users/areas', 'komagata'
test 'show tokyo users without search params' do
visit_with_auth '/users/regions', 'komagata'
assert_equal '都道府県別ユーザー一覧 | FBC', title
within "[data-testid='regions']" do
assert_text '関東地方'
assert_text '東京都'
assert_selector "[data-login-name='kimura']"
end
end

test 'show selected subdivision or country users by search params' do
query = URI.encode_www_form(region: '九州・沖縄地方', subdivision_or_country: '長崎県')
visit_with_auth "/users/regions?#{query}", 'komagata'
within "[data-testid='regions']" do
assert_text '長崎県'
assert_selector "[data-login-name='advisernocolleguetrainee']"
end
end

test 'show empty message when no users exist' do
query = URI.encode_www_form(region: '関東地方', subdivision_or_country: '神奈川県')
visit_with_auth "/users/regions?#{query}", 'komagata'
within "[data-testid='regions']" do
assert_text '都道府県別ユーザー一覧はありません'
end
end
end

0 comments on commit 4806f75

Please sign in to comment.