SurfCustomCalabash 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc36d47dbb465e8902af53b0d6519f9caf644ef1
|
4
|
+
data.tar.gz: b6fab405830127ae15c75932c68ec40114b4cd74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41d1423cf682108dbde016efebcfa9a36b7ab6ac77d409aafc01bede5a1dd5209d93440f9225fe64ed04a7724380925b7d01ea43b1c19815db8eeafc2051a307
|
7
|
+
data.tar.gz: 739e4e246b6c0f2b40691b7f8d75b61cc4059748a316d156906faf1b2b62533d772b0efc3e80134f83352e7b3ff760c6ce1e02fec1d199f4b35618a665eb156e
|
@@ -1,8 +1,5 @@
|
|
1
1
|
require 'rspec/expectations'
|
2
2
|
|
3
|
-
# module CommonMethods
|
4
|
-
|
5
|
-
|
6
3
|
def enter_text_from_keyboard(text)
|
7
4
|
wait_for_keyboard(:timeout=>5)
|
8
5
|
keyboard_enter_text(text)
|
@@ -252,17 +249,68 @@ require 'rspec/expectations'
|
|
252
249
|
sleep(1)
|
253
250
|
end
|
254
251
|
|
252
|
+
# --------------------------------------------------Localization------------------------------------------------------
|
253
|
+
# get locale apps - Ru or Eng
|
254
|
+
# parameter - element with text
|
255
|
+
def get_app_location(element)
|
256
|
+
sleep(1.5)
|
257
|
+
if element_exists(element)
|
258
|
+
text_element = remember(element)
|
259
|
+
if check_cyrillic(text_element)
|
260
|
+
locale = 'RUS'
|
261
|
+
else
|
262
|
+
locale = 'ENG'
|
263
|
+
end
|
264
|
+
else
|
265
|
+
p "Fail localization"
|
266
|
+
end
|
267
|
+
p locale
|
268
|
+
return locale
|
269
|
+
end
|
270
|
+
|
271
|
+
# check cyrillic symbols in string
|
272
|
+
def check_cyrillic(str)
|
273
|
+
regexp = /\p{Cyrillic}+.*?\.?/
|
274
|
+
if str.match(regexp).nil?
|
275
|
+
return false
|
276
|
+
else
|
277
|
+
return true
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
255
281
|
# if apps support two localization, this method check exists text in different locations
|
256
282
|
def text_with_locale(text_locale1, text_locale2)
|
257
283
|
sleep(1)
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
284
|
+
|
285
|
+
# $locale is global variables
|
286
|
+
# $locale setup in first app launch
|
287
|
+
if !$locale.nil?
|
288
|
+
if check_cyrillic(text_locale1)
|
289
|
+
rus_locale = "* {text CONTAINS '#{text_locale1}'}"
|
290
|
+
eng_locale = "* {text CONTAINS '#{text_locale2}'}"
|
291
|
+
elsif check_cyrillic(text_locale2)
|
292
|
+
rus_locale = "* {text CONTAINS '#{text_locale2}'}"
|
293
|
+
eng_locale = "* {text CONTAINS '#{text_locale1}'}"
|
294
|
+
end
|
295
|
+
|
296
|
+
if $locale == "RUS"
|
297
|
+
return rus_locale
|
298
|
+
elsif $locale == "ENG"
|
299
|
+
return eng_locale
|
300
|
+
end
|
264
301
|
else
|
265
|
-
|
302
|
+
# if $locale is not Rus or Eng
|
303
|
+
# wait element on screen with text_locale1 or text_locale2
|
304
|
+
locale_el1 = "* {text CONTAINS '#{text_locale1}'}"
|
305
|
+
locale_el2 = "* {text CONTAINS '#{text_locale2}'}"
|
306
|
+
|
307
|
+
if element_exists(locale_el1)
|
308
|
+
return locale_el1
|
309
|
+
elsif element_exists(locale_el2)
|
310
|
+
return locale_el2
|
311
|
+
else
|
312
|
+
return ("No such query!")
|
313
|
+
end
|
266
314
|
end
|
267
315
|
end
|
268
316
|
|
@@ -277,4 +325,3 @@ require 'rspec/expectations'
|
|
277
325
|
end
|
278
326
|
end
|
279
327
|
|
280
|
-
# end
|
@@ -1,10 +1,6 @@
|
|
1
1
|
require 'calabash-android'
|
2
2
|
require 'SurfCustomCalabash/CommonMethods'
|
3
3
|
|
4
|
-
# module DroidMethods
|
5
|
-
# include Calabash::Android::Operations
|
6
|
-
# include CommonMethods
|
7
|
-
|
8
4
|
def close_keyboard
|
9
5
|
if keyboard_visible?
|
10
6
|
hide_soft_keyboard
|
@@ -91,4 +87,3 @@ require 'SurfCustomCalabash/CommonMethods'
|
|
91
87
|
perform_action('drag', 50, 50, 15, 75, 4)
|
92
88
|
end
|
93
89
|
|
94
|
-
# end
|
@@ -1,9 +1,6 @@
|
|
1
1
|
require 'calabash-cucumber/ibase'
|
2
2
|
require 'SurfCustomCalabash/CommonMethods'
|
3
3
|
|
4
|
-
# module IosMethods
|
5
|
-
# include CommonMethods
|
6
|
-
|
7
4
|
# tap on Done on keyboard
|
8
5
|
def submit_keyboard
|
9
6
|
if element_exists("* marked:'Toolbar Done Button'")
|
@@ -94,5 +91,3 @@ require 'SurfCustomCalabash/CommonMethods'
|
|
94
91
|
def ptr
|
95
92
|
swipe(:down, :offset => {:x => 0, :y => -200})
|
96
93
|
end
|
97
|
-
|
98
|
-
# end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SurfCustomCalabash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Hripunov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|