Class: AwsAccountUtils::AccountRegistration
- Defined in:
- lib/aws_account_utils/account_registration.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(logger, browser) ⇒ AccountRegistration
constructor
A new instance of AccountRegistration.
- #signup(account_name, account_email, account_password) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(logger, browser) ⇒ AccountRegistration
Returns a new instance of AccountRegistration.
8 9 10 11 |
# File 'lib/aws_account_utils/account_registration.rb', line 8 def initialize(logger, browser) @logger = logger @browser = browser end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
6 7 8 |
# File 'lib/aws_account_utils/account_registration.rb', line 6 def browser @browser end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
6 7 8 |
# File 'lib/aws_account_utils/account_registration.rb', line 6 def logger @logger end |
Instance Method Details
#signup(account_name, account_email, account_password) ⇒ 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 40 |
# File 'lib/aws_account_utils/account_registration.rb', line 13 def signup(account_name, account_email, account_password) logger.debug "Signing up for a new account." login_details = { 'ap_customer_name' => account_name, 'ap_email' => account_email, 'ap_email_check' => account_email, 'ap_password' => account_password, 'ap_password_check' => account_password } browser.goto signup_url browser.text_field(:id => 'ap_customer_name').wait_until_present screenshot(browser, "1") login_details.each do |k,v| browser.text_field(:id => k).when_present.set v end screenshot(browser, "2") browser.(:id => 'continue-input').when_present.click raise StandardError if browser.div(:id => /message_(error|warning)/).exist? true rescue StandardError screenshot(browser, "error") error_header = browser.div(:id => /message_(error|warning)/).h6.text error_body = browser.div(:id => /message_(error|warning)/).p.text raise StandardError, "AWS signup error: \"#{error_header}: #{error_body}\"" rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e screenshot(browser, "error") raise StandardError, "#{self.class.name} - #{e}" end |