-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
141 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
service_name: travis-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## v0.1.3 | ||
|
||
* Added close account method | ||
|
||
## v0.1.0 | ||
|
||
* First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
require "bundler/gem_tasks" | ||
require 'rspec/core/rake_task' | ||
task :default => :spec | ||
RSpec::Core::RakeTask.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require 'aws_account_utils/base' | ||
require 'aws_account_utils/login' | ||
|
||
module AwsAccountUtils | ||
class Account < Base | ||
attr_reader :logger, :browser | ||
|
||
def initialize(logger, browser) | ||
@logger = logger | ||
@browser = browser | ||
end | ||
|
||
def close(account_email, account_password) | ||
logger.debug "Closing AWS account." | ||
|
||
Login.new(logger, browser).execute url, | ||
account_email, | ||
account_password | ||
|
||
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 | ||
|
||
private | ||
def url | ||
'https://console.aws.amazon.com/billing/home?#/account' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require 'spec_helper' | ||
|
||
describe AwsAccountUtils::Account do | ||
let(:logger) { Logger.new(STDOUT) } | ||
let(:subject) { AwsAccountUtils::Account.new logger, browser } | ||
let(:login) { AwsAccountUtils::Login.new logger, browser } | ||
let(:browser) { double 'browser' } | ||
let(:text_field) { double 'browser text field' } | ||
let(:checkbox) { double 'browser checkbox' } | ||
let(:text) { double 'browser text' } | ||
let(:p) { double 'browser p element' } | ||
let(:button) { double 'browser button' } | ||
let(:span) { double 'browser span' } | ||
let(:url) { 'https://console.aws.amazon.com/billing/home?#/account' } | ||
|
||
it "should create a url alias" do | ||
expect(logger).to receive(:debug).with('Closing AWS account.') | ||
|
||
expect(browser).to receive(:text_field).with({:id=>"ap_email"}).and_return text_field | ||
expect(text_field).to receive(:when_present).and_return text_field | ||
expect(text_field).to receive(:set) | ||
|
||
expect(browser).to receive(:text_field).with({:id=>"ap_password"}).and_return text_field | ||
expect(text_field).to receive(:when_present).and_return text_field | ||
expect(text_field).to receive(:set) | ||
|
||
expect(browser).to receive(:button).with({:id=>"signInSubmit-input"}).and_return button | ||
expect(button).to receive(:when_present).and_return button | ||
expect(button).to receive(:click) | ||
|
||
expect(browser).to receive(:goto).with(url) | ||
expect(browser).to receive(:url).and_return('https://www.amazon.com/ap/signin?') | ||
expect(logger).to receive(:debug).with('Logging into AWS.') | ||
|
||
expect(browser).to receive(:checkbox).with({:ng_model => "isClosingAccount"}).and_return checkbox | ||
expect(checkbox).to receive(:when_present).and_return checkbox | ||
expect(checkbox).to receive(:set) | ||
|
||
expect(browser).to receive(:button).with({:text => /Close Account/}).and_return button | ||
expect(button).to receive(:when_present).and_return button | ||
expect(button).to receive(:click) | ||
|
||
expect(browser).to receive(:wait_until).and_return browser | ||
|
||
expect(browser).to receive(:span).with({:text => /Close Account/}).and_return span | ||
expect(span).to receive(:when_present).and_return span | ||
expect(span).to receive(:click) | ||
|
||
expect(browser).to receive(:p).with({:text => /Are you sure you want to close your account?/}).and_return p | ||
expect(p).to receive(:wait_while_present).and_return p | ||
|
||
expect(browser).to receive(:wait_until).and_return browser | ||
|
||
expect(subject.close('my_user', 'my_password')).to be_truthy | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,4 @@ | |
3=>"answer3"}) | ||
|
||
end | ||
|
||
it "should generate random answers" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters