<commit_before>module Acceptance
  module CommentHelper
      def open_search_factlink
        return if all('.spec-open-search-facts-link').empty?

        page.find('.spec-open-search-facts-link').click
      end

      def fill_in_comment_textarea text
        within '.spec-add-comment-form' do
          comment_input = find('.text_area_view')
          comment_input.click

          comment_input = find('.text_area_view')
          comment_input.value.should eq ''
          comment_input.click
          comment_input.set text
          comment_input.value.should eq text
        end
      end

      def add_comment text
        fill_in_comment_textarea text

        within '.spec-add-comment-form' do
          click_button "Post"
        end

        wait_until_argument_has_one_vote text
      end

      def add_existing_factlink evidence_factlink
        open_search_factlink

        text = evidence_factlink.to_s

        within '.spec-add-comment-form' do
          comment_input = find('.text_area_view')
          comment_input.click

          # Open search by entering something
          comment_input.set 'something'
          comment_input.set ''
          open_search_factlink

          page.find("input[type=text]").click
          page.find("input[type=text]").set(text)
          page.find(".spec-fact-search-result", text: text).click

          click_button "Post"
        end

        wait_until_argument_has_one_vote text
      end

      def wait_until_argument_has_one_vote text<commit_msg>rename method substring argument -> comment<commit_after>module Acceptance
  module CommentHelper
      def open_search_factlink
        return if all('.spec-open-search-facts-link').empty?

        page.find('.spec-open-search-facts-link').click
      end

      def fill_in_comment_textarea text
        within '.spec-add-comment-form' do
          comment_input = find('.text_area_view')
          comment_input.click

          comment_input = find('.text_area_view')
          comment_input.value.should eq ''
          comment_input.click
          comment_input.set text
          comment_input.value.should eq text
        end
      end

      def add_comment text
        fill_in_comment_textarea text

        within '.spec-add-comment-form' do
          click_button "Post"
        end

        wait_until_comment_has_one_vote text
      end

      def add_existing_factlink evidence_factlink
        open_search_factlink

        text = evidence_factlink.to_s

        within '.spec-add-comment-form' do
          comment_input = find('.text_area_view')
          comment_input.click

          # Open search by entering something
          comment_input.set 'something'
          comment_input.set ''
          open_search_factlink

          page.find("input[type=text]").click
          page.find("input[type=text]").set(text)
          page.find(".spec-fact-search-result", text: text).click

          click_button "Post"
        end

        wait_until_comment_has_one_vote text
      end

      def wait_until_comment_has_one_vote text
{'fraction_non_alphanumeric': 0.0759493670886076, 'fraction_numerical': 0.0, 'mean_word_length': 2.122593718338399, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2265334', 'n_tokens_mistral': 877, 'n_tokens_neox': 841, 'n_words': 165}