<commit_before>class SettingsPage < SitePrism::Page
  set_url '/settings'

  text_field(:email, 'input#email')
  label(:email_status, '#email-status')
  button(:save_email, 'input[value="Update Email"]')

  button(:connect_with_a_different_account, '#trello-connect')
  label(:trello_connect_status, '#trello-connect-status')

  checkbox(:confirm_delete, '#i-am-sure')
  button(:delete_account, '#delete-account-button')
  label(:delete_status, '#delete-account-status')

  def update_email
    save_email
    wait_until { email_status != 'Saving...' }
  end

  alias_method :orig_connect, :connect_with_a_different_account
  def connect_with_a_different_account(&block)
    orig_connect
    block.call(self) if block
    allow_alternative_account unless block
  end

  private
  def allow_alternative_account
    LoginPage.new.allow
    wait_until { trello_connect_status != 'Saving...' }
  end
end<commit_msg>make SettingsPage#delete_account more ajax robust<commit_after>class SettingsPage < SitePrism::Page
  set_url '/settings'

  text_field(:email, 'input#email')
  label(:email_status, '#email-status')
  button(:save_email, 'input[value="Update Email"]')

  button(:connect_with_a_different_account, '#trello-connect')
  label(:trello_connect_status, '#trello-connect-status')

  checkbox(:confirm_delete, '#i-am-sure')
  button(:choose_to_delete_account, '#delete-account-button')
  label(:delete_status, '#delete-account-status')

  def update_email
    save_email
    wait_until { email_status != 'Saving...' }
  end

  def delete_account
    choose_to_delete_account
    wait_until { delete_status != 'Deleting...' }
  end

  alias_method :orig_connect, :connect_with_a_different_account
  def connect_with_a_different_account(&block)
    orig_connect
    block.call(self) if block
    allow_alternative_account unless block
  end

  private
  def allow_alternative_account
    LoginPage.new.allow
    wait_until { trello_connect_status != 'Saving...' }
  end
end
{'fraction_non_alphanumeric': 0.11443037974683544, 'fraction_numerical': 0.0, 'mean_word_length': 5.155763239875389, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3722858', 'n_tokens_mistral': 653, 'n_tokens_neox': 621, 'n_words': 112}