Fix more tests for phantomjs

As a bonus got rid of JavaScript call.

Refactored uls-position code to a method.

Change-Id: I1df384a02909d430c12225525d5722a0520177ee
This commit is contained in:
Niklas Laxström
2013-08-29 14:33:18 +03:00
parent 54afab7ffc
commit 773b8f42e6
3 changed files with 19 additions and 12 deletions

View File

@@ -40,22 +40,23 @@ After('@reset-preferences-after') do |scenario|
on(ResetPreferencesPage).submit_element.click
end
Before('@uls-in-sidebar-only') do |scenario|
def uls_position()
if !defined?($uls_position)
visit(ULSPage)
$uls_position = @browser.execute_script( "return mw.config.get( 'wgULSPosition' )" );
else
$uls_position
end
if $uls_position != 'interlanguage'
end
Before('@uls-in-sidebar-only') do |scenario|
if uls_position() != 'interlanguage'
scenario.skip_invoke!
end
end
Before('@uls-in-personal-only') do |scenario|
if !defined?($uls_position)
visit(ULSPage)
$uls_position = @browser.execute_script( "return mw.config.get( 'wgULSPosition' )" );
end
if $uls_position != 'personal'
if uls_position() != 'personal'
scenario.skip_invoke!
end
end