Zfilipin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/119271

Change subject: WIP mediawiki_selenium Ruby gem should be able to start local 
and remote browsers with optional browser setup
......................................................................

WIP mediawiki_selenium Ruby gem should be able to start local and remote 
browsers with optional browser setup

Paired with Kartik Mistry.

Bug: 62512
Change-Id: Idb2cd0277278f85506273f80c3c975bc7db9f010
---
M tests/browser/features/step_definitions/common_steps.rb
M tests/browser/features/support/env.rb
2 files changed, 2 insertions(+), 45 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/71/119271/1

diff --git a/tests/browser/features/step_definitions/common_steps.rb 
b/tests/browser/features/step_definitions/common_steps.rb
index 4818e7e..3288ee1 100644
--- a/tests/browser/features/step_definitions/common_steps.rb
+++ b/tests/browser/features/step_definitions/common_steps.rb
@@ -2,9 +2,10 @@
 # Add tags to no_javascript_site.feature when resolved
 Given /^I am using user agent "(.+)"$/ do |user_agent|
   @user_agent = user_agent
-  @browser = browser(environment, test_name(@scenario), user_agent)
+  @browser = browser(test_name(@scenario), {user_agent: user_agent})
   @browser.window.resize_to(480, 800)
   $session_id = @browser.driver.instance_variable_get(:@bridge).session_id
+  step 'I am on the "Main Page" page'
 end
 
 Given /^I am logged into the mobile website$/ do
diff --git a/tests/browser/features/support/env.rb 
b/tests/browser/features/support/env.rb
index 80a0f8e..8ac08ea 100644
--- a/tests/browser/features/support/env.rb
+++ b/tests/browser/features/support/env.rb
@@ -1,45 +1 @@
 require "mediawiki_selenium"
-
-def local_browser(user_agent)
-  if ENV["BROWSER"]
-    browser_label = ENV["BROWSER"].to_sym
-  else
-    browser_label = :firefox
-  end
-
-  if user_agent =="default" && !ENV["NEARBY_FIREFOX"]
-    browser = Watir::Browser.new browser_label
-  else
-    if browser_label == :firefox && !ENV["NEARBY_FIREFOX"]
-      profile = Selenium::WebDriver::Firefox::Profile.new
-      profile["general.useragent.override"] = user_agent
-      browser = Watir::Browser.new browser_label, :profile => profile
-    else
-      if ENV["NEARBY_FIREFOX"]
-        permissions_file = "./features/support/permissions.sqlite"
-        if RUBY_PLATFORM =~ /darwin/
-          firefox_executable = 
"/Applications/Firefox.app/Contents/MacOS/firefox"
-        elsif RUBY_PLATFORM =~ /linux/
-          firefox_executable = '/usr/bin/firefox'
-        else
-          puts 'Cannot identify local OS, so cannot locate Firefox executable!'
-        end
-        profile_path = ("/tmp/NearbyProfile/")
-        Dir.mkdir(profile_path) unless File.exists?(profile_path)
-        system(firefox_executable + " -CreateProfile 'NearbyProfile " + 
profile_path + "'")
-        system("cp " + permissions_file + " " + profile_path)
-        browser = Watir::Browser.new :firefox, :profile => 'NearbyProfile'
-      else
-        raise "Changing user agent is currently supported only for Firefox!"
-      end
-    end
-  end
-
-
-    # we can set cookies only for current domain
-    # see http://code.google.com/p/selenium/issues/detail?id=1953
-    browser.goto URL.url("Main_Page")
-    # set a cookie forcing mobile mode
-    browser.cookies.add "mf_useformat", "true"
-    browser
-  end

-- 
To view, visit https://gerrit.wikimedia.org/r/119271
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb2cd0277278f85506273f80c3c975bc7db9f010
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Zfilipin <zfili...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to