Skip to content

Commit 772547f

Browse files
committed
Fix Ruby relative locator tests based on new proximity sorting
See 0d0b1f8 for more details on the actual proximity sorting algorithm
1 parent 8d5bcf8 commit 772547f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

rb/spec/integration/selenium/webdriver/driver_spec.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ module WebDriver
108108
driver.navigate.to url_for('relative_locators.html')
109109

110110
above = driver.find_element(relative: {tag_name: 'td', above: {id: 'center'}})
111-
expect(above.attribute('id')).to eq('first')
111+
expect(above.attribute('id')).to eq('second')
112112
end
113113

114114
it 'should find child element' do
@@ -153,14 +153,14 @@ module WebDriver
153153

154154
lowest = driver.find_element(id: 'below')
155155
above = driver.find_elements(relative: {tag_name: 'p', above: lowest})
156-
expect(above.map { |e| e.attribute('id') }).to eq(%w[above mid])
156+
expect(above.map { |e| e.attribute('id') }).to eq(%w[mid above])
157157
end
158158

159159
it 'should find above another' do
160160
driver.navigate.to url_for('relative_locators.html')
161161

162162
above = driver.find_elements(relative: {tag_name: 'td', above: {id: 'center'}})
163-
expect(above.map { |e| e.attribute('id') }).to eq(%w[first second third])
163+
expect(above.map { |e| e.attribute('id') }).to eq(%w[second first third])
164164
end
165165

166166
it 'should find below element' do
@@ -175,28 +175,28 @@ module WebDriver
175175
driver.navigate.to url_for('relative_locators.html')
176176

177177
near = driver.find_elements(relative: {tag_name: 'td', near: {id: 'sixth'}})
178-
expect(near.map { |e| e.attribute('id') }).to eq(%w[second third center eighth ninth])
178+
expect(near.map { |e| e.attribute('id') }).to eq(%w[third ninth center second eighth])
179179
end
180180

181181
it 'should find near another within custom distance' do
182182
driver.navigate.to url_for('relative_locators.html')
183183

184184
near = driver.find_elements(relative: {tag_name: 'td', near: {id: 'sixth', distance: 100}})
185-
expect(near.map { |e| e.attribute('id') }).to eq(%w[second third center eighth ninth])
185+
expect(near.map { |e| e.attribute('id') }).to eq(%w[third ninth center second eighth])
186186
end
187187

188188
it 'should find to the left of another' do
189189
driver.navigate.to url_for('relative_locators.html')
190190

191191
left = driver.find_elements(relative: {tag_name: 'td', left: {id: 'center'}})
192-
expect(left.map { |e| e.attribute('id') }).to eq(%w[first fourth seventh])
192+
expect(left.map { |e| e.attribute('id') }).to eq(%w[fourth first seventh])
193193
end
194194

195195
it 'should find to the right of another' do
196196
driver.navigate.to url_for('relative_locators.html')
197197

198198
right = driver.find_elements(relative: {tag_name: 'td', right: {id: 'center'}})
199-
expect(right.map { |e| e.attribute('id') }).to eq(%w[third sixth ninth])
199+
expect(right.map { |e| e.attribute('id') }).to eq(%w[sixth third ninth])
200200
end
201201

202202
it 'should find by combined relative locators' do

0 commit comments

Comments
 (0)