Fixed broken Selenium test

The test is broken on beta cluster because the formula is rendered as
meta tag. It is rendered at img tag on my mediawiki-vagrant virtual
machine. The test now works on both environments.

Bug: T128190
Change-Id: I458d618af24533d104fcac25a8d8c6468b14605a
This commit is contained in:
Željko Filipin 2016-04-26 19:07:49 +02:00
parent 289e0d3031
commit d2ff0ef699
3 changed files with 10 additions and 13 deletions

View file

@ -5,6 +5,4 @@ Feature: Math
Given I am editing a random page with source editor
When I type <math>3 + 2</math>
And I click Preview
Then the page should contain an img tag
And alt for that img should be 3 + 2
And src for that img should contain /math/
Then the page should contain 3 + 2 image

View file

@ -10,14 +10,6 @@ When(/^I type (.+)$/) do |write_text|
on(EditPage).article_text = write_text
end
Then(/^alt for that img should be (.+)$/) do |alt|
expect(on(EditPage).math_image_element.element.alt).to eq(alt)
end
Then(/^src for that img should contain (.+)$/) do |src|
expect(on(EditPage).math_image_element.element.src).to match Regexp.escape src
end
Then(/^the page should contain an img tag$/) do
Then(/^the page should contain 3 \+ 2 image$/) do
expect(on(EditPage).math_image_element.when_present).to be_visible
end

View file

@ -4,6 +4,13 @@ class EditPage
page_url 'Special:Random?action=edit'
text_area(:article_text, id: 'wpTextbox1')
img(:math_image, class: 'tex')
button(:preview, id: 'wpPreview')
def math_image_element
if env.lookup(:mediawiki_environment, default: nil) == 'beta'
browser.meta(class: 'mwe-math-fallback-image-inline')
else
browser.img(class: 'tex')
end
end
end