taf 0.4.1 → 0.4.2
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 +4 -4
- data/lib/taf/browser.rb +18 -12
- data/lib/taf/test_engine.rb +30 -26
- data/lib/taf/test_steps/handlers/base/login.rb +5 -4
- data/lib/taf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c2a7cbae2cd4f9ec43c57b441f2182a8477cb2ce763964800aa9b3b0500f1ff
|
4
|
+
data.tar.gz: 9f7343f0a1edc9ff6df54ec04645e48e2fcdc18667a38458c2d9490a53b19f65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5b3dbe44aebbf959b489b05e82e73599c887863b544927b6a18aa2f8d642bd23de47080f5b11a583cb7083ee695b08bba8926cc753b9309d6851510d3e479c0
|
7
|
+
data.tar.gz: f7b6711f47c6f3094c5ae7307f759667e49011cc68ff1184c4af263f4cfc0a9b56e8e2f3552fa6655de0e8b8d80d1fd48d688dc0b5c1550eb9853646d1aba6f0
|
data/lib/taf/browser.rb
CHANGED
@@ -9,14 +9,20 @@
|
|
9
9
|
module Taf
|
10
10
|
# browser_setup.rb - a browser functions
|
11
11
|
module Browser
|
12
|
+
# Suppoerted Browser names
|
13
|
+
@chrome_name = 'chrome'
|
14
|
+
@chrome_headless_name = 'chrome-headless'
|
15
|
+
@firefox_name = 'firefox'
|
16
|
+
@firefox_headless_name = 'firefox-headless'
|
17
|
+
|
12
18
|
# open_browser function
|
13
19
|
def self.open_browser
|
14
20
|
browser = Taf::CMDLine.browser_type.downcase
|
15
21
|
case browser
|
16
|
-
when
|
17
|
-
when
|
18
|
-
when
|
19
|
-
when
|
22
|
+
when @chrome_name then chrome
|
23
|
+
when @chrome_headless_name then chrome_headless
|
24
|
+
when @firefox_name then firefox
|
25
|
+
when @firefox_headless_name then firefox_headless
|
20
26
|
else
|
21
27
|
raise Taf::BrowserFailedOpen,
|
22
28
|
"unable to open selected browser: #{browser}"
|
@@ -77,27 +83,27 @@ module Taf
|
|
77
83
|
def self.browser_version
|
78
84
|
browser_name = Taf::CMDLine.browser_type.downcase
|
79
85
|
case browser_name
|
80
|
-
when
|
86
|
+
when @chrome_name, @chrome_headless_name
|
81
87
|
@browser.driver.capabilities[:version]
|
82
|
-
when
|
88
|
+
when @firefox_name, @firefox_headless_name
|
83
89
|
@browser.execute_script('return navigator.userAgent;').split('/')[-1]
|
90
|
+
else
|
91
|
+
'No Browser version'
|
84
92
|
end
|
85
|
-
rescue StandardError
|
86
|
-
'No Browser version'
|
87
93
|
end
|
88
94
|
|
89
95
|
# Check platform
|
90
96
|
def self.browser_platform
|
91
97
|
browser_name = Taf::CMDLine.browser_type.downcase
|
92
98
|
case browser_name
|
93
|
-
when
|
99
|
+
when @chrome_name, @chrome_headless_name
|
94
100
|
@browser.execute_script('return navigator.userAgent;')
|
95
101
|
.split(';')[1].split(')')[0]
|
96
|
-
when
|
102
|
+
when @firefox_name, @firefox_headless_name
|
97
103
|
@browser.execute_script('return navigator.userAgent;').split(';')[1]
|
104
|
+
else
|
105
|
+
'No Platform found'
|
98
106
|
end
|
99
|
-
rescue StandardError
|
100
|
-
'No Platform found'
|
101
107
|
end
|
102
108
|
end
|
103
109
|
end
|
data/lib/taf/test_engine.rb
CHANGED
@@ -9,6 +9,34 @@
|
|
9
9
|
module Taf
|
10
10
|
# test_engine.rb - controls the iteration through the test suite and specs
|
11
11
|
module TestEngine
|
12
|
+
def self.get_test_data(test_file_name)
|
13
|
+
# read in the test data
|
14
|
+
tests = Taf::Parser.read_test_data(test_file_name)
|
15
|
+
tests
|
16
|
+
# if unable to read the test data, show the error and move onto the
|
17
|
+
# next file (if there is one)
|
18
|
+
rescue StandardError => e
|
19
|
+
Taf::MyLog.log.warn 'Terminating the current test spec: ' \
|
20
|
+
"#{test_file_name} #{e}"
|
21
|
+
Taf::MyLog.log.info
|
22
|
+
'...continuing with the next test file (if there is one)'
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.get_step_data(test_file_name, tests, metrics)
|
26
|
+
tests['steps'].each_with_index do |test_step, test_step_idx|
|
27
|
+
test_step_idx += 1
|
28
|
+
|
29
|
+
parsed_steps = Taf::Parser.parse_test_step_data(test_step)
|
30
|
+
|
31
|
+
# process the test step data
|
32
|
+
Taf::TestSteps.process_test_steps(test_file_name, test_step_idx,
|
33
|
+
parsed_steps, metrics)
|
34
|
+
end
|
35
|
+
rescue Taf::TafError => e
|
36
|
+
warn e
|
37
|
+
Taf::MyLog.log.warn e
|
38
|
+
end
|
39
|
+
|
12
40
|
# process the test files to execute the tests
|
13
41
|
def self.process_testfiles
|
14
42
|
total_passes = 0
|
@@ -20,37 +48,13 @@ module Taf
|
|
20
48
|
metrics = Struct.new(:stepPasses, :stepFailures, :stepSkipped)
|
21
49
|
.new(0, 0, 0)
|
22
50
|
|
23
|
-
|
24
|
-
# read in the test data
|
25
|
-
tests = Taf::Parser.read_test_data(test_file_name)
|
26
|
-
# if unable to read the test data, show the error and move onto the
|
27
|
-
# next file (if there is one)
|
28
|
-
rescue StandardError => e
|
29
|
-
Taf::MyLog.log.warn 'Terminating the current test spec: ' \
|
30
|
-
"#{test_file_name} #{e}"
|
31
|
-
Taf::MyLog.log.info
|
32
|
-
'...continuing with the next test file (if there is one)'
|
33
|
-
end
|
51
|
+
tests = get_test_data(test_file_name)
|
34
52
|
|
35
53
|
# create project folders - these only need creating once per test suite
|
36
54
|
Taf::CreateDirectories.construct_projectdirs
|
37
55
|
|
38
56
|
Taf::Browser.open_browser
|
39
|
-
|
40
|
-
begin
|
41
|
-
tests['steps'].each_with_index do |test_step, test_step_idx|
|
42
|
-
test_step_idx += 1
|
43
|
-
|
44
|
-
parsed_steps = Taf::Parser.parse_test_step_data(test_step)
|
45
|
-
|
46
|
-
# process the test step data
|
47
|
-
Taf::TestSteps.process_test_steps(test_file_name, test_step_idx,
|
48
|
-
parsed_steps, metrics)
|
49
|
-
end
|
50
|
-
rescue Taf::TafError => e
|
51
|
-
warn e
|
52
|
-
Taf::MyLog.log.warn e
|
53
|
-
end
|
57
|
+
get_step_data(test_file_name, tests, metrics)
|
54
58
|
|
55
59
|
# output the test results summary to console
|
56
60
|
Taf::ReportSummary.test_step_summary(test_file_name, test_file_idx,
|
@@ -19,10 +19,10 @@ module Taf
|
|
19
19
|
|
20
20
|
def login_user(user)
|
21
21
|
case @value.downcase
|
22
|
-
when 'portal_login'
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
when 'portal_login' then portal_login(user)
|
23
|
+
when 'sso_login' then sso_login(user)
|
24
|
+
else
|
25
|
+
Taf::MyLog.log.error 'Not a valid Login'
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -50,6 +50,7 @@ module Taf
|
|
50
50
|
user_elm = 'username'
|
51
51
|
pass_elm = 'password'
|
52
52
|
|
53
|
+
Taf::Browser.b.goto(url)
|
53
54
|
login_process(b_title, user_elm, pass_elm, user, pass)
|
54
55
|
login_check(b_title_sucess, user)
|
55
56
|
end
|
data/lib/taf/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.2
|
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-06-
|
11
|
+
date: 2019-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|