<commit_before>require 'spec_helper'

describe 'User editing saved address during checkout', type: :feature, js: true do
  include_context 'store products'
  include_context 'checkout with product'
  include_context 'user with address'

  before(:each) { click_button 'Checkout'; sign_in!(user); click_button 'Checkout' }

  it 'can update billing address' do
    within("#billing #billing_address_#{address.id}") do
      click_link 'Edit'
    end
    expect(current_path).to eq spree.edit_address_path(address)
    new_street = FFaker::Address.street_address
    fill_in I18n.t('activerecord.attributes.spree/address.address1'), with: new_street
    click_button 'Update'
    expect(current_path).to eq spree.checkout_state_path('address')
    within('h1') { expect(page).to have_content('Checkout') }
    within('#billing') do
      expect(page).to have_content(new_street)
    end
  end

  it 'can update shipping address' do
    uncheck 'order_use_billing'
    within("#shipping #shipping_address_#{address.id}") do
      click_link 'Edit'
    end
    spree.edit_address_path(address)
    new_street = FFaker::Address.street_address
    fill_in I18n.t('activerecord.attributes.spree/address.address1'), with: new_street
    click_button 'Update'
    expect(current_path).to eq spree.checkout_state_path('address')
    within('h1') { expect(page).to have_content('Checkout') }<commit_msg>don't click Checkout button after sign in<commit_after>require 'spec_helper'

describe 'User editing saved address during checkout', type: :feature, js: true do
  include_context 'store products'
  include_context 'checkout with product'
  include_context 'user with address'

  before(:each) { click_button 'Checkout'; sign_in!(user) }

  it 'can update billing address' do
    within("#billing #billing_address_#{address.id}") do
      click_link 'Edit'
    end
    expect(current_path).to eq spree.edit_address_path(address)
    new_street = FFaker::Address.street_address
    fill_in I18n.t('activerecord.attributes.spree/address.address1'), with: new_street
    click_button 'Update'
    expect(current_path).to eq spree.checkout_state_path('address')
    within('h1') { expect(page).to have_content('Checkout') }
    within('#billing') do
      expect(page).to have_content(new_street)
    end
  end

  it 'can update shipping address' do
    uncheck 'order_use_billing'
    within("#shipping #shipping_address_#{address.id}") do
      click_link 'Edit'
    end
    spree.edit_address_path(address)
    new_street = FFaker::Address.street_address
    fill_in I18n.t('activerecord.attributes.spree/address.address1'), with: new_street
    click_button 'Update'
    expect(current_path).to eq spree.checkout_state_path('address')
    within('h1') { expect(page).to have_content('Checkout') }
{'fraction_non_alphanumeric': 0.11194833153928956, 'fraction_numerical': 0.0057409400789379264, 'mean_word_length': 4.796257796257796, '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': '6191542', 'n_tokens_mistral': 911, 'n_tokens_neox': 875, 'n_words': 194}