taf 0.2.5 → 0.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a80f7340cca5705ee5dcc7bf4c18a68d021385968999ac7aa02fb09624449822
4
- data.tar.gz: ba179749dfd4b6c74ca1d8bf872f11bfbdc563259174a62e7574d935b424410f
3
+ metadata.gz: 68dc766c595d259d02242dfc34a39309531aa63ffabc912ffc85c9cad2ceb46b
4
+ data.tar.gz: cf0d163c682cebe8c794c19281dc18006ecceae413030e6e81a11ae9e09c5f76
5
5
  SHA512:
6
- metadata.gz: 267a05594871c7d98a59431ffe34e786cfce670b84cf97791a803fb2c89a6bdd0c940e493e4716d747be2118955dee927064246690066a13215c86cb8e654665
7
- data.tar.gz: 9d9d594a563722e220827fa26150fed7be12ea7cda1963c801deef8c9cae5dadeba412914a24e31d96b998580cc1b29d6cfe73521a0c6ac89c0aee11a56aa6fb
6
+ metadata.gz: ad1dc2b44ccf4f29566adcfee38f679560cb1e5b8d040dd169a44e0d19073416bae4f9dab681189caa3cedc71f0c0b92d27ac6503278a1de58114bb949ca8767
7
+ data.tar.gz: 689cb611844b398d6f04148916c25c87136e6ec65612c1612ed18458323fb25aef0c1cd83b41838f80ad1a49079f24eb5568210e95ec8e758b3cc1e3561d9b9a
@@ -47,7 +47,7 @@ module TestSteps
47
47
  end
48
48
 
49
49
  def mem_word_check(user, b_title_sucess)
50
- if Browser.b.title.eql?('Memorable word ')
50
+ if Browser.b.title.eql?('Memorable word')
51
51
  portal_mem_word(user, b_title_sucess)
52
52
  elsif Browser.b.title.eql?(b_title_sucess)
53
53
  MyLog.log.info("User: #{user} has logged in successful.")
@@ -0,0 +1,54 @@
1
+ require_relative 'base_handler'
2
+
3
+ module TestSteps
4
+ module Handlers
5
+ class Login < Base
6
+ register :login
7
+
8
+ def perform(step_attributes)
9
+ login_type = step_attributes[:testvalue]
10
+ user = step_attributes[:testvalue2]
11
+ user = ENV[user.to_s] if ENV[user.to_s]
12
+
13
+ lc_login_type = login_type.downcase
14
+ case lc_login_type
15
+ when 'portal_login'
16
+ portal_login(user)
17
+ when 'sso_login'
18
+ sso_login(user)
19
+ else
20
+ MyLog.log.error "unable to find login: #{lc_login_type}"
21
+ raise LoginTypeFailed
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def portal_login(user)
28
+ url = ENV['PORTAL_URL']
29
+ pass = ENV['PORTAL_USER_PASS']
30
+ b_title = 'Log in'
31
+ b_title_sucess = 'Home'
32
+ user_elm = 'user_email'
33
+ pass_elm = 'user_password'
34
+
35
+ open_url_process(url)
36
+ login_process(b_title, user_elm, pass_elm, user, pass)
37
+ mem_word_check(user, b_title_sucess)
38
+ end
39
+
40
+ def sso_login(user)
41
+ pass = ENV['SSO_USER_PASS']
42
+ # b_title = 'Log in to rh-sso'
43
+ # b_title_sucess = 'RHS-SSO Admin Console'
44
+ b_title = ''
45
+ b_title_sucess = ''
46
+ user_elm = 'username'
47
+ pass_elm = 'password'
48
+
49
+ login_process(b_title, user_elm, pass_elm, user, pass)
50
+ login_check(b_title_sucess, user)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -87,7 +87,8 @@ module Report
87
87
  MyLog.log.info "Test step duration: #{test_duration}"
88
88
  end
89
89
 
90
- # check if the test failure threshold has been reached for total failures or consecutive failures.
90
+ # check if the test failure threshold has been reached for total failures
91
+ # or consecutive failures.
91
92
  # If a certain number of consecutive tests fail then throw an exception
92
93
  def self.check_failure_threshold(test_file_name, _test_step_index)
93
94
  consecutive_fail_threshold = 5
@@ -4,3 +4,4 @@ class TafError < StandardError; end
4
4
  class UnknownTestStep < TafError; end
5
5
  class FailureThresholdExceeded < TafError; end
6
6
  class BrowserFailedOpen < TafError; end
7
+ class LoginTypeFailed < TafError; end
@@ -3,7 +3,7 @@
3
3
  module Taf
4
4
  # This module holds the TAF version information.
5
5
  module Version
6
- STRING = '0.2.5'
6
+ STRING = '0.2.6'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
9
9
  '%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Perrett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-16 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -191,9 +191,9 @@ files:
191
191
  - lib/functions/handlers/handle_browser_window.rb
192
192
  - lib/functions/handlers/ipause.rb
193
193
  - lib/functions/handlers/list_all_dropdowns_values.rb
194
+ - lib/functions/handlers/login.rb
194
195
  - lib/functions/handlers/open_url.rb
195
196
  - lib/functions/handlers/ping_test.rb
196
- - lib/functions/handlers/portal_login.rb
197
197
  - lib/functions/handlers/radio_button.rb
198
198
  - lib/functions/handlers/select_dropdown.rb
199
199
  - lib/functions/handlers/send_special_keys.rb
@@ -1,25 +0,0 @@
1
- require_relative 'base_handler'
2
-
3
- module TestSteps
4
- module Handlers
5
- class PortalLogin < Base
6
- register :portal_login
7
-
8
- def perform(step_attributes)
9
- value = step_attributes[:testvalue]
10
-
11
- url = ENV['PORTAL_URL']
12
- user = ENV[value.to_s]
13
- pass = ENV['PORTAL_USER_PASS']
14
- b_title = 'Log in '
15
- b_title_sucess = 'Home '
16
- user_elm = 'user_email'
17
- pass_elm = 'user_password'
18
-
19
- open_url_process(url)
20
- login_process(b_title, user_elm, pass_elm, user, pass)
21
- mem_word_check(user, b_title_sucess)
22
- end
23
- end
24
- end
25
- end