Class: TestCentricity::Environ

Inherits:
DataObject show all
Defined in:
lib/testcentricity_web/data_objects/environment.rb

Instance Attribute Summary collapse

Attributes inherited from DataObject

#context, #current, #hash_table

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

current, current=

Constructor Details

#initialize(data) ⇒ Environ

Returns a new instance of Environ.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/testcentricity_web/data_objects/environment.rb', line 67

def initialize(data)
  @protocol      = data['PROTOCOL']
  @hostname      = data['HOST_NAME']
  @base_url      = data['BASE_URL']
  @user_id	     = data['USER_ID']
  @password	     = data['PASSWORD']
  @append	       = data['APPEND']
  @option1	     = data['OPTIONAL_1']
  @option2	     = data['OPTIONAL_2']
  @dns	         = data['DNS']
  @db_username   = data['DB_USERNAME']
  @db_password   = data['DB_PASSWORD']
  @a11y_standard = ENV['ACCESSIBILITY_STANDARD'] || 'best-practice'

  super
end

Instance Attribute Details

#a11y_standard ⇒ Object

Returns the value of attribute a11y_standard.



53
54
55
# File 'lib/testcentricity_web/data_objects/environment.rb', line 53

def a11y_standard
  @a11y_standard
end

#append ⇒ Object

Returns the value of attribute append.



60
61
62
# File 'lib/testcentricity_web/data_objects/environment.rb', line 60

def append
  @append
end

#base_url ⇒ Object

Returns the value of attribute base_url.



57
58
59
# File 'lib/testcentricity_web/data_objects/environment.rb', line 57

def base_url
  @base_url
end

#browser ⇒ Object

Returns the value of attribute browser.



29
30
31
# File 'lib/testcentricity_web/data_objects/environment.rb', line 29

def browser
  @browser
end

#browser_size ⇒ Object

Returns the value of attribute browser_size.



30
31
32
# File 'lib/testcentricity_web/data_objects/environment.rb', line 30

def browser_size
  @browser_size
end

#db_password ⇒ Object

Returns the value of attribute db_password.



65
66
67
# File 'lib/testcentricity_web/data_objects/environment.rb', line 65

def db_password
  @db_password
end

#db_username ⇒ Object

Returns the value of attribute db_username.



64
65
66
# File 'lib/testcentricity_web/data_objects/environment.rb', line 64

def db_username
  @db_username
end

#device ⇒ Object

Returns the value of attribute device.



35
36
37
# File 'lib/testcentricity_web/data_objects/environment.rb', line 35

def device
  @device
end

#device_name ⇒ Object

Returns the value of attribute device_name.



36
37
38
# File 'lib/testcentricity_web/data_objects/environment.rb', line 36

def device_name
  @device_name
end

#device_orientation ⇒ Object

Returns the value of attribute device_orientation.



39
40
41
# File 'lib/testcentricity_web/data_objects/environment.rb', line 39

def device_orientation
  @device_orientation
end

#device_os ⇒ Object

Returns the value of attribute device_os.



38
39
40
# File 'lib/testcentricity_web/data_objects/environment.rb', line 38

def device_os
  @device_os
end

#device_type ⇒ Object

Returns the value of attribute device_type.



37
38
39
# File 'lib/testcentricity_web/data_objects/environment.rb', line 37

def device_type
  @device_type
end

#dns ⇒ Object

Returns the value of attribute dns.



63
64
65
# File 'lib/testcentricity_web/data_objects/environment.rb', line 63

def dns
  @dns
end

#driver ⇒ Object

Returns the value of attribute driver.



41
42
43
# File 'lib/testcentricity_web/data_objects/environment.rb', line 41

def driver
  @driver
end

#external_page ⇒ Object

Returns the value of attribute external_page.



51
52
53
# File 'lib/testcentricity_web/data_objects/environment.rb', line 51

def external_page
  @external_page
end

#grid ⇒ Object

Returns the value of attribute grid.



42
43
44
# File 'lib/testcentricity_web/data_objects/environment.rb', line 42

def grid
  @grid
end

#headless ⇒ Object

Returns the value of attribute headless.



31
32
33
# File 'lib/testcentricity_web/data_objects/environment.rb', line 31

def headless
  @headless
end

#hostname ⇒ Object

Returns the value of attribute hostname.



56
57
58
# File 'lib/testcentricity_web/data_objects/environment.rb', line 56

def hostname
  @hostname
end

#option1 ⇒ Object

Returns the value of attribute option1.



61
62
63
# File 'lib/testcentricity_web/data_objects/environment.rb', line 61

def option1
  @option1
end

#option2 ⇒ Object

Returns the value of attribute option2.



62
63
64
# File 'lib/testcentricity_web/data_objects/environment.rb', line 62

def option2
  @option2
end

#os ⇒ Object

Returns the value of attribute os.



34
35
36
# File 'lib/testcentricity_web/data_objects/environment.rb', line 34

def os
  @os
end

#parallel ⇒ Object

Returns the value of attribute parallel.



45
46
47
# File 'lib/testcentricity_web/data_objects/environment.rb', line 45

def parallel
  @parallel
end

#password ⇒ Object

Returns the value of attribute password.



59
60
61
# File 'lib/testcentricity_web/data_objects/environment.rb', line 59

def password
  @password
end

#platform ⇒ Object

Returns the value of attribute platform.



40
41
42
# File 'lib/testcentricity_web/data_objects/environment.rb', line 40

def platform
  @platform
end

#portal_context ⇒ Object

Returns the value of attribute portal_context.



50
51
52
# File 'lib/testcentricity_web/data_objects/environment.rb', line 50

def portal_context
  @portal_context
end

#portal_status ⇒ Object

Returns the value of attribute portal_status.



49
50
51
# File 'lib/testcentricity_web/data_objects/environment.rb', line 49

def portal_status
  @portal_status
end

#process_num ⇒ Object

Returns the value of attribute process_num.



46
47
48
# File 'lib/testcentricity_web/data_objects/environment.rb', line 46

def process_num
  @process_num
end

#protocol ⇒ Object

Returns the value of attribute protocol.



55
56
57
# File 'lib/testcentricity_web/data_objects/environment.rb', line 55

def protocol
  @protocol
end

#session_code ⇒ Object

Returns the value of attribute session_code.



33
34
35
# File 'lib/testcentricity_web/data_objects/environment.rb', line 33

def session_code
  @session_code
end

#session_state ⇒ Object

Returns the value of attribute session_state.



32
33
34
# File 'lib/testcentricity_web/data_objects/environment.rb', line 32

def session_state
  @session_state
end

#signed_in ⇒ Object

Returns the value of attribute signed_in.



48
49
50
# File 'lib/testcentricity_web/data_objects/environment.rb', line 48

def signed_in
  @signed_in
end

#test_environment ⇒ Object

Returns the value of attribute test_environment.



28
29
30
# File 'lib/testcentricity_web/data_objects/environment.rb', line 28

def test_environment
  @test_environment
end

#tunneling ⇒ Object

Returns the value of attribute tunneling.



43
44
45
# File 'lib/testcentricity_web/data_objects/environment.rb', line 43

def tunneling
  @tunneling
end

#user_id ⇒ Object

Returns the value of attribute user_id.



58
59
60
# File 'lib/testcentricity_web/data_objects/environment.rb', line 58

def user_id
  @user_id
end

Class Method Details

.browser ⇒ Object



128
129
130
# File 'lib/testcentricity_web/data_objects/environment.rb', line 128

def self.browser
  @browser
end

.browser=(browser) ⇒ Object



124
125
126
# File 'lib/testcentricity_web/data_objects/environment.rb', line 124

def self.browser=(browser)
  @browser = browser.downcase.to_sym
end

.browser_size ⇒ Object



136
137
138
# File 'lib/testcentricity_web/data_objects/environment.rb', line 136

def self.browser_size
  @browser_size
end

.browser_size=(size) ⇒ Object



132
133
134
# File 'lib/testcentricity_web/data_objects/environment.rb', line 132

def self.browser_size=(size)
  @browser_size = size
end

.device ⇒ Object



168
169
170
# File 'lib/testcentricity_web/data_objects/environment.rb', line 168

def self.device
  @device
end

.device=(device) ⇒ Object



164
165
166
# File 'lib/testcentricity_web/data_objects/environment.rb', line 164

def self.device=(device)
  @device = device
end

.device_name ⇒ Object



196
197
198
# File 'lib/testcentricity_web/data_objects/environment.rb', line 196

def self.device_name
  @device_name
end

.device_name=(name) ⇒ Object



192
193
194
# File 'lib/testcentricity_web/data_objects/environment.rb', line 192

def self.device_name=(name)
  @device_name = name
end

.device_orientation ⇒ Object



220
221
222
# File 'lib/testcentricity_web/data_objects/environment.rb', line 220

def self.device_orientation
  @device_orientation
end

.device_orientation=(orientation) ⇒ Object



216
217
218
# File 'lib/testcentricity_web/data_objects/environment.rb', line 216

def self.device_orientation=(orientation)
  @device_orientation = orientation.downcase.to_sym
end

.device_os ⇒ Object



204
205
206
# File 'lib/testcentricity_web/data_objects/environment.rb', line 204

def self.device_os
  @device_os
end

.device_os=(os) ⇒ Object



200
201
202
# File 'lib/testcentricity_web/data_objects/environment.rb', line 200

def self.device_os=(os)
  @device_os = os.downcase.to_sym
end

.device_type ⇒ Object



188
189
190
# File 'lib/testcentricity_web/data_objects/environment.rb', line 188

def self.device_type
  @device_type
end

.device_type=(type) ⇒ Object



184
185
186
# File 'lib/testcentricity_web/data_objects/environment.rb', line 184

def self.device_type=(type)
  @device_type = type.downcase.to_sym
end

.driver ⇒ Object



228
229
230
# File 'lib/testcentricity_web/data_objects/environment.rb', line 228

def self.driver
  @driver
end

.driver=(type) ⇒ Object



224
225
226
# File 'lib/testcentricity_web/data_objects/environment.rb', line 224

def self.driver=(type)
  @driver = type
end

.external_page ⇒ Object



288
289
290
# File 'lib/testcentricity_web/data_objects/environment.rb', line 288

def self.external_page
  @external_page
end

.get_screen_shots ⇒ Object



296
297
298
# File 'lib/testcentricity_web/data_objects/environment.rb', line 296

def self.get_screen_shots
  @screen_shots
end

.grid ⇒ Object



236
237
238
# File 'lib/testcentricity_web/data_objects/environment.rb', line 236

def self.grid
  @grid
end

.grid=(type) ⇒ Object



232
233
234
# File 'lib/testcentricity_web/data_objects/environment.rb', line 232

def self.grid=(type)
  @grid = type
end

.headless ⇒ Object



144
145
146
# File 'lib/testcentricity_web/data_objects/environment.rb', line 144

def self.headless
  @headless
end

.headless=(state) ⇒ Object



140
141
142
# File 'lib/testcentricity_web/data_objects/environment.rb', line 140

def self.headless=(state)
  @headless = state
end

.is_android? ⇒ Boolean

Returns:

  • (Boolean)


212
213
214
# File 'lib/testcentricity_web/data_objects/environment.rb', line 212

def self.is_android?
  @device_os == :android
end

.is_desktop? ⇒ Boolean

Returns:

  • (Boolean)


256
257
258
# File 'lib/testcentricity_web/data_objects/environment.rb', line 256

def self.is_desktop?
  @platform == :desktop
end

.is_device? ⇒ Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/testcentricity_web/data_objects/environment.rb', line 172

def self.is_device?
  @device == :device
end

.is_ios? ⇒ Boolean

Returns:

  • (Boolean)


208
209
210
# File 'lib/testcentricity_web/data_objects/environment.rb', line 208

def self.is_ios?
  @device_os == :ios
end

.is_mobile? ⇒ Boolean

Returns:

  • (Boolean)


252
253
254
# File 'lib/testcentricity_web/data_objects/environment.rb', line 252

def self.is_mobile?
  @platform == :mobile
end

.is_signed_in? ⇒ Boolean

Returns:

  • (Boolean)


264
265
266
# File 'lib/testcentricity_web/data_objects/environment.rb', line 264

def self.is_signed_in?
  @signed_in
end

.is_simulator? ⇒ Boolean

Returns:

  • (Boolean)


176
177
178
# File 'lib/testcentricity_web/data_objects/environment.rb', line 176

def self.is_simulator?
  @device == :simulator
end

.is_web? ⇒ Boolean

Returns:

  • (Boolean)


180
181
182
# File 'lib/testcentricity_web/data_objects/environment.rb', line 180

def self.is_web?
  @device == :web
end

.os ⇒ Object



160
161
162
# File 'lib/testcentricity_web/data_objects/environment.rb', line 160

def self.os
  @os
end

.os=(os) ⇒ Object



156
157
158
# File 'lib/testcentricity_web/data_objects/environment.rb', line 156

def self.os=(os)
  @os = os
end

.parallel ⇒ Object



104
105
106
# File 'lib/testcentricity_web/data_objects/environment.rb', line 104

def self.parallel
  @parallel
end

.parallel=(state) ⇒ Object



100
101
102
# File 'lib/testcentricity_web/data_objects/environment.rb', line 100

def self.parallel=(state)
  @parallel = state
end

.platform=(platform) ⇒ Object



248
249
250
# File 'lib/testcentricity_web/data_objects/environment.rb', line 248

def self.platform=(platform)
  @platform = platform
end

.portal_context ⇒ Object



280
281
282
# File 'lib/testcentricity_web/data_objects/environment.rb', line 280

def self.portal_context
  @portal_context
end

.portal_context=(portal_context) ⇒ Object



276
277
278
# File 'lib/testcentricity_web/data_objects/environment.rb', line 276

def self.portal_context=(portal_context)
  @portal_context = portal_context
end

.portal_state ⇒ Object



272
273
274
# File 'lib/testcentricity_web/data_objects/environment.rb', line 272

def self.portal_state
  @portal_status
end

.portal_state=(portal_state) ⇒ Object



268
269
270
# File 'lib/testcentricity_web/data_objects/environment.rb', line 268

def self.portal_state=(portal_state)
  @portal_status = portal_state
end

.process_num ⇒ Object



112
113
114
# File 'lib/testcentricity_web/data_objects/environment.rb', line 112

def self.process_num
  @process_num
end

.process_num=(num) ⇒ Object



108
109
110
# File 'lib/testcentricity_web/data_objects/environment.rb', line 108

def self.process_num=(num)
  @process_num = num
end

.report_header ⇒ Object



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/testcentricity_web/data_objects/environment.rb', line 304

def self.report_header
  report_header = "\n<b><u>TEST ENVIRONMENT</u>:</b> #{ENV['TEST_ENVIRONMENT']}\n"\
  "  <b>Browser:</b>\t #{Environ.browser.capitalize}\n"
  report_header = "#{report_header}  <b>Device:</b>\t\t #{Environ.device_name}\n" if Environ.device_name
  report_header = "#{report_header}  <b>Device OS:</b>\t #{Environ.device_os}\n" if Environ.device_os
  report_header = "#{report_header}  <b>Device type:</b>\t #{Environ.device_type}\n" if Environ.device_type
  report_header = "#{report_header}  <b>Driver:</b>\t\t #{Environ.driver}\n" if Environ.driver
  report_header = "#{report_header}  <b>Grid:</b>\t\t #{Environ.grid}\n" if Environ.grid
  report_header = "#{report_header}  <b>OS:</b>\t\t\t #{Environ.os}\n" if Environ.os
  report_header = "#{report_header}  <b>Locale:</b>\t\t #{ENV['LOCALE']}\n" if ENV['LOCALE']
  report_header = "#{report_header}  <b>Language:</b>\t #{ENV['LANGUAGE']}\n" if ENV['LANGUAGE']
  report_header = "#{report_header}  <b>Country:</b>\t #{ENV['COUNTRY']}\n" if ENV['COUNTRY']
  report_header = "#{report_header}  <b>WCAG Accessibility Standard:</b>\t #{ENV['ACCESSIBILITY_STANDARD']}\n" if ENV['ACCESSIBILITY_STANDARD']
  "#{report_header}\n\n"
end

.reset_contexts ⇒ Object



300
301
302
# File 'lib/testcentricity_web/data_objects/environment.rb', line 300

def self.reset_contexts
  @screen_shots = []
end

.save_screen_shot(screen_shot) ⇒ Object



292
293
294
# File 'lib/testcentricity_web/data_objects/environment.rb', line 292

def self.save_screen_shot(screen_shot)
  @screen_shots.push(screen_shot)
end

.session_code ⇒ Object



84
85
86
87
88
89
90
# File 'lib/testcentricity_web/data_objects/environment.rb', line 84

def self.session_code
  if @session_code.nil?
    characters = ('a'..'z').to_a
    @session_code = (0..12).map { characters.sample }.join
  end
  @session_code
end

.session_id ⇒ Object



92
93
94
# File 'lib/testcentricity_web/data_objects/environment.rb', line 92

def self.session_id
  @session_id
end

.session_state ⇒ Object



152
153
154
# File 'lib/testcentricity_web/data_objects/environment.rb', line 152

def self.session_state
  @session_state
end

.session_state=(session_state) ⇒ Object



148
149
150
# File 'lib/testcentricity_web/data_objects/environment.rb', line 148

def self.session_state=(session_state)
  @session_state = session_state
end

.session_time_stamp ⇒ Object



96
97
98
# File 'lib/testcentricity_web/data_objects/environment.rb', line 96

def self.session_time_stamp
  @session_time_stamp
end

.set_external_page(state) ⇒ Object



284
285
286
# File 'lib/testcentricity_web/data_objects/environment.rb', line 284

def self.set_external_page(state)
  @external_page = state
end

.set_signed_in(signed_in) ⇒ Object



260
261
262
# File 'lib/testcentricity_web/data_objects/environment.rb', line 260

def self.set_signed_in(signed_in)
  @signed_in = signed_in
end

.test_environment ⇒ Object



116
117
118
119
120
121
122
# File 'lib/testcentricity_web/data_objects/environment.rb', line 116

def self.test_environment
  if @test_environment.blank?
    nil
  else
    @test_environment.downcase.to_sym
  end
end

.tunneling ⇒ Object



244
245
246
# File 'lib/testcentricity_web/data_objects/environment.rb', line 244

def self.tunneling
  @tunneling
end

.tunneling=(state) ⇒ Object



240
241
242
# File 'lib/testcentricity_web/data_objects/environment.rb', line 240

def self.tunneling=(state)
  @tunneling = state
end