This repository has been archived by the owner on Jun 6, 2018. It is now read-only.
/
frames_spec.rb
75 lines (60 loc) · 1.62 KB
/
frames_spec.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
# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)
describe "<frame> Frames" do
before :each do
browser.goto(WatirSpec.url_for("frames.html"))
end
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
describe "with selectors" do
it "returns the matching elements" do
browser.frames(:name => "frame1").to_a.should == [browser.frame(:name => "frame1")]
end
end
end
describe "#length" do
it "returns the correct number of frames" do
browser.frames.length.should == 2
end
end
describe "#[]" do
it "returns the frame at the given index" do
browser.frames[0].id.should == "frame_1"
end
end
describe "#each" do
it "iterates through frames correctly" do
count = 0
browser.frames.each_with_index do |f, index|
f.id.should == browser.frame(:index, index).id
count += 1
end
count.should > 0
end
end
end
describe "<iframe> Frames" do
before :each do
browser.goto(WatirSpec.url_for("iframes.html"))
end
describe "#length" do
it "returns the correct number of frames" do
browser.frames.length.should == 2
end
end
describe "#[]" do
it "returns the frame at the given index" do
browser.frames[0].id.should == "frame_1"
end
end
describe "#each" do
it "iterates through frames correctly" do
count = 0
browser.frames.each_with_index do |f, index|
f.name.should == browser.frame(:index, index).name
f.id.should == browser.frame(:index, index).id
count += 1
end
count.should > 0
end
end
end