Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/components/product/product_component_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_render_approval_stamp_and_does_not_render_product_checker_when_there_ar

assert_selector '.stamp.stamp-approve' do
assert_text '合格'
assert_text I18n.l(Time.zone.today, format: :short)
assert_text I18n.l(checked_product.checks.last.created_at.to_date, format: :short)
assert_text 'komagata'
end

Expand Down
19 changes: 12 additions & 7 deletions test/supports/tag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@

module TagHelper
def fill_in_tag(name, selector = '.tagify__input')
tag_input = find(selector)
sleep 1
tag_input.set name
tag_input.native.send_keys :return
tag_count_before = all('.tagify__tag', visible: :all).count
tag_input = find(selector, match: :first)
tag_input.click
tag_input.native.send_keys(name, :return)
assert_selector('.tagify__tag', count: tag_count_before + 1, wait: 10, visible: :all)
# Wait for the hidden input to be updated with the new tag (React components only)
return unless has_selector?("input[type='hidden'][name*='tag_list']", visible: :all)

assert_selector("input[type='hidden'][name*='tag_list'][value*='#{name}']", visible: :all, wait: 10)
end

def fill_in_tag_with_alert(name, selector = '.tagify__input')
tag_input = find(selector)
sleep 1
tag_input.set name
tag_input.click
accept_alert do
tag_input.native.send_keys :return
tag_input.native.send_keys(name, :return)
end
assert_selector(selector)
end

def find_tags(taggable_name)
Expand Down
2 changes: 0 additions & 2 deletions test/system/article/tags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class Article::TagsTest < ApplicationSystemTestCase
tags.each do |tag|
fill_in_tag tag
end
assert page.has_text?(tags.first)
assert page.has_text?(tags.second)
page.accept_confirm do
click_on '公開する'
end
Expand Down
2 changes: 1 addition & 1 deletion test/system/mail_notification_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class MailNotificationsTest < ApplicationSystemTestCase
test "update user's mail_notification" do
visit "/users/#{users(:kimura).id}/mail_notification/edit?token=#{users(:kimura).unsubscribe_email_token}"

refute_text 'ユーザーIDもしくはTOKENが違います。'
assert_selector 'article.unauthorized'
assert_text 'メール通知をオフにしますか?'
assert_title 'メール通知解除の確認'
assert_selector '.unauthorized-actions a', text: 'オフにする'
refute_text 'ユーザーIDもしくはTOKENが違います。'

click_link 'オフにする'

Expand Down
4 changes: 1 addition & 3 deletions test/system/movie/tags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class Movie::TagsTest < ApplicationSystemTestCase
test 'update tags without page transitions' do
visit_with_auth movie_path(movies(:movie2)), 'komagata'
find('.tag-links__item-edit').click
tag_input = find('.tagify__input')
tag_input.set '追加タグ'
tag_input.native.send_keys :return
fill_in_tag '追加タグ'
click_on '保存'
assert_text '追加タグ'
end
Expand Down
4 changes: 1 addition & 3 deletions test/system/question/tags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class Question::TagsTest < ApplicationSystemTestCase
test 'update tags without page transitions' do
visit_with_auth question_path(questions(:question2)), 'komagata'
find('.tag-links__item-edit').click
tag_input = find('.tagify__input')
tag_input.set '追加タグ'
tag_input.native.send_keys :return
fill_in_tag '追加タグ'
click_on '保存'
assert_text '追加タグ'
end
Expand Down