Class: AwsAccountUtils::Account

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#screenshot

Constructor Details

#initialize(logger, browser) ⇒ Account

Returns a new instance of Account.



8
9
10
11
# File 'lib/aws_account_utils/account.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/account.rb', line 6

def browser
  @browser
end

#loggerObject (readonly)

Returns the value of attribute logger.



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

def logger
  @logger
end

Instance Method Details

#close(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
# File 'lib/aws_account_utils/account.rb', line 13

def close(, )
  logger.debug "Closing AWS account."

  Login.new(logger, browser).execute url,
                                     ,
                                     

  browser.checkbox(:ng_model =>'isClosingAccount').when_present.set
  screenshot(browser, "3")

  browser.button(:text => /Close Account/).when_present.click
  screenshot(browser, "2")

  browser.wait_until{ browser.text.include? 'Are you sure you want to close your account?'}
  browser.span(:text => /Close Account/).when_present.click
  screenshot(browser, "3")

  browser.p(:text => /Are you sure you want to close your account?/).wait_while_present

  browser.wait_until{ browser.text.include? 'Account has been closed'}

rescue Watir::Wait::TimeoutError, Net::ReadTimeout => e
  screenshot(browser, "error")
  raise StandardError, "#{self.class.name} - #{e}"
end