Class: AwsAccountUtils::CustomerInformation

Inherits:
Base
  • Object
show all
Defined in:
lib/aws_account_utils/customer_information.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#screenshot

Constructor Details

#initialize(logger, browser) ⇒ CustomerInformation

Returns a new instance of CustomerInformation.



8
9
10
11
# File 'lib/aws_account_utils/customer_information.rb', line 8

def initialize(logger, browser)
  @logger = logger
  @browser = browser
end

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



6
7
8
# File 'lib/aws_account_utils/customer_information.rb', line 6

def browser
  @browser
end

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/aws_account_utils/customer_information.rb', line 6

def logger
  @logger
end

Instance Method Details

#submit(account_email, account_password, customer_details) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/aws_account_utils/customer_information.rb', line 13

def submit(, , customer_details)
  logger.debug "Entering customer details."
  Login.new(logger, browser).execute url,
                                     ,
                                     

  browser.wait_until{ browser.text.include? 'AWS Customer Agreement'}
  browser.select_list(:ng_model =>'address.countryCode').when_present.select 'United States'
  customer_details.each do |k,v|
    browser.text_field(:name => k).when_present.set v
  end
  browser.checkbox(:name, /ccepted/).when_present.set
  screenshot(browser, "1")
  browser.button(:text=> /Continue/).when_present.click

  browser.h2(:text => /Payment Information/).wait_until_present
  screenshot(browser, "2")
  raise StandardError if browser.text.include? 'error'
  browser.input(:id => "accountId", :value => "").wait_while_present(30)
  browser.input(:id => "accountId").value
rescue StandardError
  screenshot(browser, 'error')
  raise StandardError, 'Aws returned error on the page when submitting customer information.'
rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e
  screenshot(browser, "error")
  raise StandardError, "#{self.class.name} - #{e}"
end