Class: Juxtapose::AppiumStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/juxtapose/strategy/appium_strategy.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ AppiumStrategy

Returns a new instance of AppiumStrategy.



9
10
11
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 9

def initialize(context)
  self.context = context
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



3
4
5
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 3

def context
  @context
end

#project_rootObject

Returns the value of attribute project_root.



4
5
6
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 4

def project_root
  @project_root
end

Class Method Details

.setupObject



5
6
7
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 5

def self.setup
  Cucumber::RbSupport::RbDsl.register_rb_hook('before', [], Proc.new {|scenario, block| @__scenario = scenario })
end

Instance Method Details

#current_spec_descriptionObject



25
26
27
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 25

def current_spec_description
  context.instance_variable_get('@__scenario').name
end

#device_nameObject



17
18
19
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 17

def device_name
  context.driver_attributes[:caps][:deviceName].gsub(" ","-").downcase
end

#save_current(filename) ⇒ Object



29
30
31
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 29

def save_current(filename)
  context.screenshot(filename)
end

#spec_dirObject



13
14
15
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 13

def spec_dir
  "features/screens"
end

#versionObject



21
22
23
# File 'lib/juxtapose/strategy/appium_strategy.rb', line 21

def version
  context.driver_attributes[:caps][:platformVersion]
end