-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaseClass.rb
106 lines (80 loc) · 2.68 KB
/
baseClass.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# filename: baseClass.rb
require "selenium-webdriver"
require "test/unit"
class LoginTestCases < Test::Unit::TestCase
#________________________________________________________________
def setup
@driver = Selenium::WebDriver.for :firefox
@base_url = "https://ota-plus-web-staging.atsgarage.com"
@driver.manage.timeouts.implicit_wait = 10
@verification_errors = []
@wait = Selenium::WebDriver::Wait.new(timeout: 5)
end
def teardown
@driver.quit
assert_equal [], @verification_errors
end
#________________________________________________________________
# def find_id(x)
# @driver.find_element(:id, 'x')
# end
# def find_xpath(x)
# @driver.find_element(:xpath, 'x')
# end
# def find_link(x)
# @driver.find_element(:link, 'x')
# end
#________________________________________________________________
def login_username()
return @driver.find_element(:id,'a0-signin_easy_email')
end
def login_password()
return @driver.find_element(:id,'a0-signin_easy_password')
end
def submit_button()
return @driver.find_element(:xpath, '//*[@id="a0-onestep"]/div[2]/div/form/div[3]/div/button')
end
def forgot_password()
return @driver.find_element(:xpath, '//*[@id="a0-onestep"]/div[2]/div/form/div[3]/a')
end
def profile_carat()
return @driver.find_element(:xpath, '//*[@id="menuLogin"]/a/i')
end
def logout_link()
return @driver.find_element(:xpath, '//*[@id="link-signout"]')
end
def home_icon()
return @driver.find_element(:xpath, '//*[@id="app"]/div/div[2]/div/div/div/div[1]/div/div[2]/div')
end
def login_page_welcome_text()
return @driver.find_element(:xpath, '//*[@id="a0-onestep"]/div[1]/div[2]/h1')
end
def github_login()
return @driver.find_element(:xpath, '//*[@id="a0-onestep"]/div[2]/div/form/div[2]/div[2]/div[1]/div[1]')
end
def google_login()
return @driver.find_element(:xpath, '//*[@id="a0-onestep"]/div[2]/div/form/div[2]/div[2]/div[1]/div[2]')
end
#________________________________________________________________
def test_login_UNAP
@driver.get(@base_url+'/login')
login_username.send_keys ""
login_password.send_keys ""
submit_button.click
@wait.until { home_icon }
successMessage = home_icon
successMessage.text.eql? "Home"
end
# NEG TESTING GOES HERE
def test_login_Google
@driver.get(@base_url+'/login')
google_login.click
@wait.until { @driver.page_source.include?("One account. All of Google.") }
end
def test_login_Github
@driver.get(@base_url+'/login')
github_login.click
@wait.until { @driver.page_source.include?("Sign into <strong>GitHub</strong>
<br>to continue to <strong>ATS Garage Staging") }
end
end