<commit_before># coding: utf-8

module Acceptance
  module ConversationHelper
    def send_reply(reply_str)
      within(:css, "div.reply") do
        fill_in "reply", with: reply_str

        click_on "Send message"
      end

      page.find('.messages .text', text: reply_str)
    end

    def last_message_should_have_content(reply_str)
      within(:css, "div.messages li:last-child") do
        page.should have_content reply_str
      end
    end

    def send_message(message, factlink, recipients)
      visit friendly_fact_path(factlink)

      click_on "Share"

      wait_until_scope_exists '.start-conversation-form' do
        recipients.each {|r| add_recipient r.username}
        find(:css, '.text').set(message)

        click_button 'Send'
        wait_for_ajax
      end
    end

    def add_recipient name
      page.find(:css, 'input').set(name)
      wait_for_ajax
      page.find('li', text: name).click
      sleep 1
      page.find('.auto-complete-results-container a', text: name)
    end
<commit_msg>Removed wait_for_ajax and replaced with alert selector<commit_after># coding: utf-8

module Acceptance
  module ConversationHelper
    def send_reply(reply_str)
      within(:css, "div.reply") do
        fill_in "reply", with: reply_str

        click_on "Send message"
      end

      page.find('.messages .text', text: reply_str)
    end

    def last_message_should_have_content(reply_str)
      within(:css, "div.messages li:last-child") do
        page.should have_content reply_str
      end
    end

    def send_message(message, factlink, recipients)
      visit friendly_fact_path(factlink)

      click_on "Share"

      wait_until_scope_exists '.start-conversation-form' do
        recipients.each {|r| add_recipient r.username}
        find(:css, '.text').set(message)

        click_button 'Send'
        page.should have_selector(".alert-type-success", visible: true)
      end
    end

    def add_recipient name
      page.find(:css, 'input').set(name)
      wait_for_ajax
      page.find('li', text: name).click
      sleep 1
      page.find('.auto-complete-results-container a', text: name)
    end

{'fraction_non_alphanumeric': 0.09976689976689977, 'fraction_numerical': 0.0018648018648018648, 'mean_word_length': 2.7256944444444446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7144794', 'n_tokens_mistral': 682, 'n_tokens_neox': 657, 'n_words': 157}