Page MenuHomePhabricator

Move user_agent string manipulation to the Ruby gem
Closed, DuplicatePublic

Description

Echo, Flow, and MobileFrontend today all duplicate code that looks something like

Given(/^I am using user agent "(.+)"$/) do |user_agent|
  @user_agent = 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
end

and other repos will need it soon also. This should be shared code, we should not have to duplicate it in all the repos

Event Timeline

Cmcmahon assigned this task to zeljkofilipin.
Cmcmahon updated the task description. (Show Details)
Cmcmahon changed Security from none to None.
Cmcmahon subscribed.
zeljkofilipin updated the task description. (Show Details)
zeljkofilipin updated the task description. (Show Details)
zeljkofilipin lowered the priority of this task from Medium to Low.Nov 20 2014, 2:51 PM

Echo:

Given(/^I am using user agent "(.+)"$/) do |user_agent|
  @user_agent = user_agent
  @browser = browser(test_name(@scenario), user_agent: user_agent)
  $session_id = @browser.driver.instance_variable_get(:@bridge).session_id
end

Flow:

Given(/^I am using user agent "(.+)"$/) do |user_agent|
  @user_agent = user_agent
  @browser = browser(test_name(@scenario), { user_agent: user_agent })
  $session_id = @browser.driver.instance_variable_get(:@bridge).session_id
end

MobileFrontend:

Given(/^I am using user agent "(.+)"$/) do |user_agent|
  @user_agent = 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
end