Sha256: bacf2d7e5b3c1e703ffe2575d7b67bcebbda65dbd6d523ca4db7c65848f5422d

Contents?: true

Size: 963 Bytes

Versions: 44

Compression:

Stored size: 963 Bytes

Contents

module ApplicationHelper
  def login
    Capybara.server_host = "localhost"
    Capybara.default_driver = :selenium

    visit root_path
    click_link 'OAuth2'
    using_wait_time 10 do
      unless has_css?("a[href*=\"oauth/#{ENV['HUBSPOT_USER_ID']}/authorize\"]")
        find("input[id$='username']").fill_in with: ENV['HUBSPOT_EMAIL']
        find("input[id$='password']").fill_in with: ENV['HUBSPOT_PASSWORD']
        find("button[id$='loginBtn']").click
      end

      find("a[href*=\"oauth/#{ENV['HUBSPOT_USER_ID']}/authorize\"]").first('span').click
    end
  end

  def remove_test_contact(email)
    id = find('.contacts .contact-email', text: email).find(:xpath, 'ancestor::tr[@class="contact"]').find('.contact-id').text
    Services::Hubspot::Contacts::Destroy.new(id).call
  end

  def create_contact(email)
    find("a[id$='new-contact']").click
    find("input[id$='email']").fill_in with: email
    find("input[type='submit']").click
  end
end

Version data entries

44 entries across 22 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-9.0.0 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-8.0.1 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-8.0.1 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-8.0.0 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-8.0.0 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-7.3.0 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-7.3.0 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-7.2.0 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-7.2.0 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-7.1.1 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-7.1.1 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-7.1.0 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-7.1.0 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-7.0.0 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-7.0.0 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-6.0.0 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-6.0.0 sample-apps/oauth-app/spec/support/application_helper.rb
hubspot-api-client-5.0.0 sample-apps/contacts-app/spec/support/application_helper.rb
hubspot-api-client-5.0.0 sample-apps/oauth-app/spec/support/application_helper.rb