-
Notifications
You must be signed in to change notification settings - Fork 0
/
testMultPlatBrowclick.rb
76 lines (63 loc) · 1.73 KB
/
testMultPlatBrowclick.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
require 'rspec/expectations'
require 'selenium-webdriver'
include RSpec::Matchers
def setupMac(browser_name)
@driver = Selenium::WebDriver.for browser_name
@wait= Selenium::WebDriver::Wait.new(:timeout=>30)
rescue Exception => e
puts e.message
puts "Could not start driver"
exit 1
end
def setupWin(browser_name)
@driver = Selenium::WebDriver.for(
:remote,
:url=> 'http://localhost:4444/wd/hub',
:desired_capabilities=> browser_name)
#@wait= Selenium::WebDriver::Wait.new(:timeout=>30)
rescue Exception => e
puts e.message
puts "Could not start driver #{@browser_name}"
exit 1
end
def teardown
puts "in teardown"
@driver.quit
end
MACBROWSERS = [:firefox, :chrome, :safari]
WINBROWSERS = [:firefox, :chrome, :ie]
def run
MACBROWSERS.each do |macbrowser|
puts macbrowser
setupMac(macbrowser)
yield
teardown
end
WINBROWSERS.each do |winbrowser|
puts winbrowser
setupWin(winbrowser)
yield
teardown
end
end
run do
@driver.get "http://codap.concord.org/~eireland/testframe.html"
@[email protected]_name
puts @browser_name
puts page_title
if @browser_name == "internet explorer"
puts ("#{@browser_name} inside if statement")
expect(page_title).to eql("TestFrame")#this is sensitive. Have to check actual title before setting the equality
else
puts ("#{@browser_name} inside else statement")
expect(page_title).to eql("TestFrame")
end
[email protected]_element(:id=>"numTrialsId")
numTrials.clear
numTrials.send_keys("7")
runButton = @driver.find_element(:name=>"run")
runButton.click
logs = @driver.manage.logs.get :chrome
puts("#{@browser_name} logs #{logs}")
end