catgem 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/catgem.rb +57 -0
- metadata +43 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e91a143c4406c57d42c98750597cfa8fdec77f25e46398415c2be8991d468e12
|
|
4
|
+
data.tar.gz: 39ec4478151105686d7eedc1828739a44c79cccd710a94e7d323e112a0ae011d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 108388ca19e920210b0b4d45db15d7818e14cb971dc8511be794f1e0a928b4bf4321a7418d90145784d83cfbc37db8006fc73d1b6bffa9dd4677482b3fe6d9b0
|
|
7
|
+
data.tar.gz: 835ce8124c520fb14892f3b6313dd69d34b93e9b19b23a122e47c0f57d24f233fd54ee3dd930e3aa62e32a9183cc3dd7cfc40baffaf7dd6f6f4547e2573da44b
|
data/lib/catgem.rb
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
class CatGem
|
|
3
|
+
|
|
4
|
+
def fill_text_box(the_text,the_field, browser)
|
|
5
|
+
puts("Inside " + __method__.to_s)
|
|
6
|
+
# populate using java script, much faster
|
|
7
|
+
browser.execute_script("arguments[0].value = '#{the_text}';", the_field)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def doc_count(browser)
|
|
11
|
+
puts("Inside " + __method__.to_s)
|
|
12
|
+
browser.divs(:class => ['col-12','col-sm-6','my-2','ng-star-inserted']).count
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def cat_sleep(secs)
|
|
16
|
+
# todo replace sleep with something better at a later date
|
|
17
|
+
# for now break the sleep into 0.5 second chucks to stop CPU becoming locked
|
|
18
|
+
puts("Inside " + __method__.to_s)
|
|
19
|
+
counter = secs * 2
|
|
20
|
+
counter.times {sleep(0.5)}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def check_for_firefox(browser)
|
|
24
|
+
# check which browser is running
|
|
25
|
+
# if firefox add the dreaded sleep at selected points
|
|
26
|
+
# to assist with firefox slowness
|
|
27
|
+
#
|
|
28
|
+
if(browser.driver.browser.to_s.downcase == "firefox")
|
|
29
|
+
puts("Inside " + __method__.to_s)
|
|
30
|
+
cat_sleep 2
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def login_members_portal(username, password, browser)
|
|
35
|
+
# login to the trades portal
|
|
36
|
+
puts("Inside " + __method__.to_s + " with username " + username + " and password " + password)
|
|
37
|
+
cat_sleep 2
|
|
38
|
+
browser.text_field(:id => "username").set username
|
|
39
|
+
browser.text_field(:id => "password").set password
|
|
40
|
+
#sometimes this process can be very slow on preview, so allow a little sleep
|
|
41
|
+
cat_sleep 2
|
|
42
|
+
browser.button(:class => 'btn-primary').click
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def login_members_portal_rename(username, password, tempusername, browser)
|
|
46
|
+
puts("Inside " + __method__.to_s + " with username " + username + " and password " + password + " and temp username " + tempusername)
|
|
47
|
+
login_members_portal(username, password, browser)
|
|
48
|
+
# unable to use a wait here because depending on result
|
|
49
|
+
# different pages could be visible, so sleep is only option
|
|
50
|
+
cat_sleep 3
|
|
51
|
+
if browser.div(:class => 'alert-danger').present?
|
|
52
|
+
#unable to login, try standard username
|
|
53
|
+
login_members_portal(FigNewton::tempusername, password, browser)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: catgem
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kev Martin
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Cat shared gem for automation suites
|
|
14
|
+
email: kevin.martin@checkatrade.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/catgem.rb
|
|
20
|
+
homepage: https://rubygems.org/gems/catgem
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubygems_version: 3.0.3
|
|
40
|
+
signing_key:
|
|
41
|
+
specification_version: 4
|
|
42
|
+
summary: Cat shared gem
|
|
43
|
+
test_files: []
|