This repository has been archived by the owner on Jun 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
/
pre_test.rb
76 lines (59 loc) · 1.98 KB
/
pre_test.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
# feature tests for Pre
# revision: $Revision: 1.0 $
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
require 'unittests/setup'
class TC_Pre < Test::Unit::TestCase
def setup
goto_page("pre.html")
end
def test_Pre_Count
assert( browser.pres.length == 3 )
end
def test_Pre_Exists
assert_false( browser.pre( :id, 'missingPre' ).exists? )
assert_false( browser.pre( :index, 33 ).exists? )
assert( browser.pre( :id, '1' ).exists? )
assert( browser.pre( :id, /[3-9]/ ).exists? )
assert_false( browser.pre( :id, /missing_pre/ ).exists? )
assert( browser.pre( :index, 1 ).exists? )
assert( browser.pre( :index, 2 ).exists? )
assert( browser.pre( :index, 3 ).exists? )
assert( browser.pre( :name, '3' ).exists? )
assert_false( browser.pre( :name, "name_missing" ).exists? )
end
def test_simple_access
pre = browser.pre( :index, 1 )
assert( pre.text.include?( "simple pre space" ) )
assert_false( pre.text.include?( "A second block" ) )
pre = browser.pre( :index, 2 )
assert( pre.text.include?( "A second block" ) )
assert_false( pre.text.include?( "this is the last block" ) )
end
tag_method :test_embedded_spaces, :fails_on_firefox # http://jira.openqa.org/browse/WTR-267
def test_embedded_spaces
pre = browser.pre( :index, 3 )
assert( pre.text.include?( "continue to work" ) )
assert_false( pre.text.include?( "Pre Tag Test" ) )
end
end
class TC_Pres_Display < Test::Unit::TestCase
include MockStdoutTestCase
tag_method :test_showPres, :fails_on_ie
def test_showPres
goto_page("pre.html")
$stdout = @mockout
browser.showPres
assert_equal(<<END_OF_MESSAGE, @mockout)
There are 3 pres
pre: id: 1
name: 1
index: 1
pre: id: 2
name: 2
index: 2
pre: id: 3
name: 3
index: 3
END_OF_MESSAGE
end
end