-
Notifications
You must be signed in to change notification settings - Fork 0
/
testPHObject.rb
48 lines (41 loc) · 1.26 KB
/
testPHObject.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
require 'selenium-webdriver'
require 'rspec/expectations'
require './performance_harness_object'
include RSpec::Matchers
def setup
caps = Selenium::Webdriver::Remote::Capablities.firefox
caps[:log_type] = 'ALL'
@driver = Selenium::WebDriver.for(
:remote,
:url=> 'http://localhost:4444/wd/hub',
:desired_capabilities => caps)
#@driver = Selenium::WebDriver.for :firefox
#ENV['base_url'] = 'http://localhost:4020/dg?di=http://localhost:4020/codap-data-interactives/PerformanceHarness/PerformanceHarness.html'
ENV['base_url'] = 'http://codap.concord.org/releases/latest/?di=http://concord-consortium.github.io/codap-data-interactives/PerformanceHarness/PerformanceHarness.html'
end
def teardown
@driver.quit
end
def run
setup
yield
teardown
end
run do
$i=0
ph = PerformanceHarnessObject.new(@driver)
begin
num_trials = 50
delay = 1
ph.start_sim(num_trials, delay)
if ph.status_result_present? 'Time = '
time_result = ph.get_time_result(time_result)
rate_result = ph.get_rate_result(rate_result)
end
puts "Time: #{time_result} Rate: #{rate_result}"
log = @driver.manage.logs.get :firefox
@driver.save_screenshot "CODAPshot.png"
puts "Log from browser is #{log}"
$i +=1
end while $i < 6
end