-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccounts.rb
65 lines (51 loc) · 1.92 KB
/
accounts.rb
1
2
3
4
5
6
7
8
9
10
11
12
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#-------------------------------------------------------------#
# Sample test for the Recurly UI
#
# Purpose: to verify that a Recurly user can:
# * log in to the Recurly UI,
# * navigate to the Accounts page,
# * view the accounts for the Recurly subdomain.
#-------------------------------------------------------------#
# the Watir Ruby gem enables Web Application Testing in Ruby
require 'watir-webdriver'
# set some variables for our login credentials
test_site = 'https://app.recurly.com/login'
test_subdomain = 'karentobo'
test_email = '[email protected]'
test_password = 'testersR0ck!'
test_username = 'Karen Tobo'
expected_accounts = 0
# open a browser
browser = Watir::Browser.new
# print some comments
puts "Beginning of test: Recurly account list"
puts " Step 1: go to the login page: " + test_site
browser.goto test_site
puts " Step 2: enter #{test_email} in the email field"
t = browser.text_field(:id => 'user_email')
t.exists?
t.set test_email
puts " Step 3: enter #{test_password} in the email field"
t = browser.text_field(:id => 'user_password')
t.exists?
t.set test_password
puts " Step 4: click the Log In button"
browser.button(:id => 'submit_button').click
puts " Verify we are on https://#{test_subdomain}.recurly.com"
browser.url.include? "https://#{test_subdomain}.recurly.com"
puts " Verify user name #{test_username} appears on page"
browser.text.include? test_username
puts " Step 5: click the Accounts navigation link"
l = browser.link(:text => 'Accounts')
l.exists?
l.click
puts " Verify we are on accounts page"
if (browser.url == "https://#{test_subdomain}.recurly.com/accounts")
puts " URL is as expected: https://#{test_subdomain}.recurly.com/accounts"
else
puts " URL is not as expected, actual URL: " + browser.url
end
puts " Verify the number of accounts is #{expected_accounts}"
browser.text.include? 'Displaying all #{expected_accounts} accounts'
puts "End of test: Recurly account list"
browser.close