itms_automation 2.3 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/generate.rb +3 -37
- data/bin/helper.rb +23 -10
- data/bin/itms_automation +18 -23
- data/doc/installation.md +16 -0
- data/doc/itms-automation-API.md +103 -0
- data/doc/itms-automation-help.md +18 -0
- data/example/android/android_app/android_app_calculator.zip +0 -0
- data/example/android/android_app/android_app_calculator/AndroidCalculator.apk +0 -0
- data/example/android/android_app/android_app_calculator/features/calculator.feature +36 -0
- data/example/android/android_app/android_app_calculator/features/my_first.feature +13 -0
- data/example/android/android_app/android_app_calculator/features/screenshots/test.png +0 -0
- data/example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb +5 -0
- data/example/android/android_app/android_app_calculator/features/support/env.rb +52 -0
- data/example/android/android_app/android_app_calculator/features/support/hooks.rb +26 -0
- data/example/android/android_web/android_web_gmail_login.zip +0 -0
- data/example/android/android_web/android_web_gmail_login/features/gmail_login.feature +12 -0
- data/example/android/android_web/android_web_gmail_login/features/my_first.feature +1 -0
- data/example/android/android_web/android_web_gmail_login/features/screenshots/test.png +0 -0
- data/example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
- data/example/android/android_web/android_web_gmail_login/features/support/env.rb +51 -0
- data/example/android/android_web/android_web_gmail_login/features/support/hooks.rb +27 -0
- data/example/desktop web/desktop_web_gmail_login.zip +0 -0
- data/example/desktop web/desktop_web_gmail_login/features/gmail_login.feature +9 -0
- data/example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature +21 -0
- data/example/desktop web/desktop_web_gmail_login/features/my_first.feature +1 -0
- data/example/desktop web/desktop_web_gmail_login/features/screenshots/test.png +0 -0
- data/example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb +5 -0
- data/example/desktop web/desktop_web_gmail_login/features/support/env.rb +106 -0
- data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +38 -0
- data/features-skeleton/my_first.feature +5 -0
- data/features-skeleton/screenshots/test.png +0 -0
- data/features-skeleton/step_definitions/custom_steps.rb +5 -0
- data/features-skeleton/step_definitions/repositories/project_object.yml +1 -0
- data/features-skeleton/support/env.rb +108 -0
- data/features-skeleton/support/hooks.rb +38 -0
- data/lib/itms_automation.rb +1 -3
- data/lib/itms_automation/assertion_steps.rb +68 -0
- data/lib/itms_automation/click_elements_steps.rb +24 -0
- data/lib/itms_automation/configuration_steps.rb +7 -0
- data/lib/itms_automation/input_steps.rb +59 -0
- data/lib/itms_automation/javascript_handling_steps.rb +10 -0
- data/lib/itms_automation/methods/assertion_methods.rb +333 -0
- data/lib/itms_automation/methods/click_elements_methods.rb +23 -0
- data/lib/itms_automation/methods/configuration_methods.rb +35 -0
- data/lib/itms_automation/methods/error_handling_methods.rb +93 -0
- data/lib/itms_automation/methods/input_methods.rb +69 -0
- data/lib/itms_automation/methods/javascript_handling_methods.rb +9 -0
- data/lib/itms_automation/methods/misc_methods.rb +63 -0
- data/lib/itms_automation/methods/navigate_methods.rb +123 -0
- data/lib/itms_automation/methods/progress_methods.rb +15 -0
- data/lib/itms_automation/methods/required_files.rb +9 -0
- data/lib/itms_automation/methods/screenshot_methods.rb +6 -0
- data/lib/itms_automation/navigation_steps.rb +79 -0
- data/lib/itms_automation/progress_steps.rb +17 -0
- data/lib/itms_automation/screenshot_steps.rb +6 -0
- data/lib/itms_automation/version.rb +5 -3
- metadata +93 -90
- data/bin/console +0 -14
- data/bin/documentation_generator.rb +0 -119
- data/bin/setup +0 -8
- data/lib/itms_automation/all_steps.rb +0 -8
- data/lib/itms_automation/assertion_helper.rb +0 -29
- data/lib/itms_automation/auto_util.rb +0 -702
- data/lib/itms_automation/database_steps_helper.rb +0 -125
- data/lib/itms_automation/web_steps_helper.rb +0 -844
- data/project/Gemfile +0 -3
- data/project/Gemfile.lock +0 -92
- data/project/README.md +0 -34
- data/project/Rakefile +0 -24
- data/project/config/chrome_headless_options.yaml +0 -1
- data/project/config/chrome_options.yaml +0 -6
- data/project/config/firefox_headless_options.yaml +0 -1
- data/project/config/firefox_options.yaml +0 -1
- data/project/config/ie_options.yaml +0 -1
- data/project/config/remote_options.yaml +0 -6
- data/project/config/safari_options.yaml +0 -1
- data/project/cucumber.yml +0 -4
- data/project/features/TestSuite/WebGUI.feature +0 -5
- data/project/features/step_definitions/lib_steps/steps_definition.rb +0 -46
- data/project/features/step_definitions/repositories/project_object.yml +0 -26
- data/project/features/support/env.rb +0 -9
- data/project/features/support/hooks.rb +0 -128
data/project/Gemfile
DELETED
data/project/Gemfile.lock
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.7.0)
|
5
|
-
public_suffix (>= 2.0.2, < 5.0)
|
6
|
-
backports (3.15.0)
|
7
|
-
builder (3.2.3)
|
8
|
-
capybara (3.29.0)
|
9
|
-
addressable
|
10
|
-
mini_mime (>= 0.1.3)
|
11
|
-
nokogiri (~> 1.8)
|
12
|
-
rack (>= 1.6.0)
|
13
|
-
rack-test (>= 0.6.3)
|
14
|
-
regexp_parser (~> 1.5)
|
15
|
-
xpath (~> 3.2)
|
16
|
-
childprocess (3.0.0)
|
17
|
-
colorize (0.8.1)
|
18
|
-
cucumber (3.1.2)
|
19
|
-
builder (>= 2.1.2)
|
20
|
-
cucumber-core (~> 3.2.0)
|
21
|
-
cucumber-expressions (~> 6.0.1)
|
22
|
-
cucumber-wire (~> 0.0.1)
|
23
|
-
diff-lcs (~> 1.3)
|
24
|
-
gherkin (~> 5.1.0)
|
25
|
-
multi_json (>= 1.7.5, < 2.0)
|
26
|
-
multi_test (>= 0.1.2)
|
27
|
-
cucumber-core (3.2.1)
|
28
|
-
backports (>= 3.8.0)
|
29
|
-
cucumber-tag_expressions (~> 1.1.0)
|
30
|
-
gherkin (~> 5.0)
|
31
|
-
cucumber-expressions (6.0.1)
|
32
|
-
cucumber-tag_expressions (1.1.1)
|
33
|
-
cucumber-wire (0.0.1)
|
34
|
-
cucumber_priority (0.3.2)
|
35
|
-
cucumber
|
36
|
-
diff-lcs (1.3)
|
37
|
-
gherkin (5.1.0)
|
38
|
-
itms_automation (1.5)
|
39
|
-
capybara (~> 3.29.0)
|
40
|
-
colorize (~> 0.8.1)
|
41
|
-
cucumber (~> 3.1)
|
42
|
-
cucumber_priority (~> 0.3.2)
|
43
|
-
parallel_tests (~> 2.7, >= 2.7.1)
|
44
|
-
report_builder (~> 1.8, >= 1.8)
|
45
|
-
rspec (~> 3.8, >= 3.8.0)
|
46
|
-
selenium-webdriver (~> 3.6, >= 3.6.0)
|
47
|
-
json (2.3.0)
|
48
|
-
mini_mime (1.0.2)
|
49
|
-
mini_portile2 (2.4.0)
|
50
|
-
multi_json (1.14.0)
|
51
|
-
multi_test (0.1.2)
|
52
|
-
nokogiri (1.10.7)
|
53
|
-
mini_portile2 (~> 2.4.0)
|
54
|
-
parallel (1.19.1)
|
55
|
-
parallel_tests (2.29.2)
|
56
|
-
parallel
|
57
|
-
public_suffix (4.0.3)
|
58
|
-
rack (2.0.7)
|
59
|
-
rack-test (1.1.0)
|
60
|
-
rack (>= 1.0, < 3)
|
61
|
-
regexp_parser (1.6.0)
|
62
|
-
report_builder (1.8)
|
63
|
-
json (>= 1.8.1)
|
64
|
-
rspec (3.9.0)
|
65
|
-
rspec-core (~> 3.9.0)
|
66
|
-
rspec-expectations (~> 3.9.0)
|
67
|
-
rspec-mocks (~> 3.9.0)
|
68
|
-
rspec-core (3.9.1)
|
69
|
-
rspec-support (~> 3.9.1)
|
70
|
-
rspec-expectations (3.9.0)
|
71
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
-
rspec-support (~> 3.9.0)
|
73
|
-
rspec-mocks (3.9.1)
|
74
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
-
rspec-support (~> 3.9.0)
|
76
|
-
rspec-support (3.9.2)
|
77
|
-
rubyzip (2.0.0)
|
78
|
-
selenium-webdriver (3.142.6)
|
79
|
-
childprocess (>= 0.5, < 4.0)
|
80
|
-
rubyzip (>= 1.2.2)
|
81
|
-
xpath (3.2.0)
|
82
|
-
nokogiri (~> 1.8)
|
83
|
-
|
84
|
-
PLATFORMS
|
85
|
-
ruby
|
86
|
-
|
87
|
-
DEPENDENCIES
|
88
|
-
itms_automation
|
89
|
-
report_builder
|
90
|
-
|
91
|
-
BUNDLED WITH
|
92
|
-
2.0.2
|
data/project/README.md
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
###itms_automation gem
|
2
|
-
itms_automation is an open-source tool for automating GUI, RESTful, SOAP, Database and eMail.
|
3
|
-
Importantly, itms_automation is cross-platform, it allows you to write tests against multiple platforms (Linux, Windows, MacOS) on multiple browsers (chrome, firefox ...) using the same API.
|
4
|
-
|
5
|
-
###Getting Started
|
6
|
-
These instructions will get you a copy of the project up and running on your local machine for testing purposes. See deployment for notes on how to install itms_automation gem
|
7
|
-
###Prerequisites
|
8
|
-
- Ruby: 2.3+
|
9
|
-
###Installing
|
10
|
-
`$ gem install itms_automation`
|
11
|
-
System automatically fetch all relate automation libraries after install itms_automation gem
|
12
|
-
###Setup
|
13
|
-
`$ itms_automation gen`
|
14
|
-
This command help to create a set folder structure which followed the format of BDD Cucumber and itms_automation.
|
15
|
-
###Structure folder format
|
16
|
-
- Screenshot folder
|
17
|
-
Once your scenario failed, the screen will be captured and saved to this folder
|
18
|
-
|
19
|
-
- TestSuite folder
|
20
|
-
Place to store user's feature files.
|
21
|
-
|
22
|
-
- Step_definitions folder
|
23
|
-
- lib_steps
|
24
|
-
- actionword.rb
|
25
|
-
- steps.rb
|
26
|
-
two file help to create user custom steps
|
27
|
-
- repositories
|
28
|
-
- project_object.yml (all web objects will store in this file)
|
29
|
-
- support
|
30
|
-
- env.rb
|
31
|
-
- hook.rb
|
32
|
-
|
33
|
-
- config folder
|
34
|
-
All browser capabilities configuration
|
data/project/Rakefile
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'cucumber'
|
5
|
-
require 'cucumber/rake/task'
|
6
|
-
testsuite_name = ENV['TESTSUITE']
|
7
|
-
testcase_report_name = ENV['TESTCASE_REPORT_NAME']
|
8
|
-
report_path = "Reports/#{testsuite_name}"
|
9
|
-
debug_opts = [ "--format usage", "--out"]
|
10
|
-
report_opts = ["REPORT=true","--color", "--format junit", "--out #{report_path}", "--format json --out #{report_path}/#{testcase_report_name}.json"]
|
11
|
-
namespace :execute do
|
12
|
-
Cucumber::Rake::Task.new(:report, "Execute automation test with report output.") do |t|
|
13
|
-
t.cucumber_opts = [*report_opts, "--format progress"]
|
14
|
-
end
|
15
|
-
Cucumber::Rake::Task.new(:debug, "Debug automation test without report output.") do |t|
|
16
|
-
t.cucumber_opts = [*debug_opts]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
desc 'Cucumber rake task not available'
|
21
|
-
task :features do
|
22
|
-
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
23
|
-
end
|
24
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
args: ["--headless","--disable-gpu",--no-sandbox]
|
@@ -1 +0,0 @@
|
|
1
|
-
browser.download.downloadDir: '/home/seluser'
|
@@ -1 +0,0 @@
|
|
1
|
-
browser.download.downloadDir: '/home/seluser'
|
@@ -1 +0,0 @@
|
|
1
|
-
mobileEmulation: {deviceName: "iPhone X"}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
args: ["--start-maximized","--disable-infobars","--incognito", "--user-agent='Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile /9A334 Safari/7534.48.3'"]
|
2
|
-
prefs: {
|
3
|
-
password_manager_enabled: false,
|
4
|
-
default_content_settings: {popups: 0},
|
5
|
-
content_settings: {pattern_pairs: {'*': {'multiple-automatic-downloads': 1}}}
|
6
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
mobileEmulation: {deviceName: "iPhone X"}
|
data/project/cucumber.yml
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
And /I open the page "(.*)"/ do |url_site|
|
2
|
-
execute_openbrowser(url_site)
|
3
|
-
end
|
4
|
-
|
5
|
-
Given /^test select execute$/ do
|
6
|
-
|
7
|
-
execute_openbrowser("https://infodation.atlassian.net/plugins/servlet/ac/Infodation-tms/test-summary?project.key=IFDTMS&project.id=17400")
|
8
|
-
# execute_settext("username", "cuong")
|
9
|
-
# execute_click("okbutton")
|
10
|
-
switch_to_iframe("iframe1")
|
11
|
-
|
12
|
-
execute_click("verify")
|
13
|
-
sleep(5)
|
14
|
-
end
|
15
|
-
|
16
|
-
When /^Go to Test Cycle Sumary of iTMS project$/ do
|
17
|
-
execute_openbrowser("https://infodation.atlassian.net/plugins/servlet/ac/Infodation-tms/test-summary?project.key=IFDTMS&project.id=17400")
|
18
|
-
sleep(5)
|
19
|
-
switch_to_iframe("iframe1")
|
20
|
-
execute_click("itms_cyclesumarylink")
|
21
|
-
sleep(3)
|
22
|
-
custom_action
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
def custom_action()
|
27
|
-
begin
|
28
|
-
browser = Capybara.current_session.driver.browser
|
29
|
-
if browser.respond_to?(:clear_cookies)
|
30
|
-
# Rack::MockSession
|
31
|
-
browser.clear_cookies
|
32
|
-
print_log("passed", start, _method_)
|
33
|
-
elsif browser.respond_to?(:manage) and browser.manage.respond_to?(:delete_all_cookies)
|
34
|
-
# Selenium::WebDriver
|
35
|
-
browser.manage.delete_all_cookies
|
36
|
-
print_log("passed", start, _method_)
|
37
|
-
else
|
38
|
-
print_log("failed", start, _method_)
|
39
|
-
raise "Error: Don't know how to clear cookies. Weird driver?"
|
40
|
-
end
|
41
|
-
rescue Exception => e
|
42
|
-
print_log("failed", start, _method_)
|
43
|
-
raise "Error: #{e.message}"
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
username: { xpath_selector: '//input[@id="login"]' }
|
2
|
-
okbutton: { xpath_selector: '//input[@value="Check Inbox"]' }
|
3
|
-
iframe: { xpath_selector: '//*[@class="ap-iframe-container iframe-init"]' }
|
4
|
-
iframe1: { xpath_selector: '//iframe[contains(@id,"Infodation-tms__test-summary_")]' }
|
5
|
-
verify: { xpath_selector: '//*[@id="aui-uid-1"]' }
|
6
|
-
firstname:
|
7
|
-
{
|
8
|
-
xpath_selector: '/html/body/div[2]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[5]/td/form/table/tbody/tr[2]/td[2]',
|
9
|
-
}
|
10
|
-
lastname:
|
11
|
-
{
|
12
|
-
xpath_selector: '/html/body/div[2]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[5]/td/form/table/tbody/tr[3]/td[2]/input',
|
13
|
-
}
|
14
|
-
selectcountry:
|
15
|
-
{
|
16
|
-
xpath_selector: '/html/body/div[2]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[5]/td/form/table/tbody/tr[11]/td[2]/select',
|
17
|
-
}
|
18
|
-
loginjira_continuebutton: {xpath_selector: "//button[@id=\"login-submit\"]/span/span/span"}
|
19
|
-
loginjira_password: {xpath_selector: "//input[@id=\"password\"]"}
|
20
|
-
loginjira_username: {xpath_selector: "//input[@id=\"username\"]"}
|
21
|
-
itms_cyclesumarylink: {xpath_selector: "//section[@id=\"content\"]//li[@class=\"menu-item\"]/a"}
|
22
|
-
itms_createnewtestcyclebutton: {xpath_selector: "//button[@id=\"itms-sidebar-addnew-button\"]"}
|
23
|
-
itms_createtestcycle_savebutton: {xpath_selector: "//button[@id=\"itms-dialog-confirm\"]"}
|
24
|
-
itms_createtestcyle_alertmessage: {xpath_selector: "//section[@id=\"ITMS-dialog-cycle\"]//strong"}
|
25
|
-
itms_clickheretocreatetestcycle: {xpath_selector: "//section[@class=\"aui-buttons\"]/button[3]/span"}
|
26
|
-
itms_iframe_testsumary: { xpath_selector: '//iframe[contains(@id,"Infodation-tms__test-summary_")]' }
|
@@ -1,128 +0,0 @@
|
|
1
|
-
Before do |scenario|
|
2
|
-
$driver = getDriver
|
3
|
-
$wait_time = ENV["WAIT_TIME"] || 30
|
4
|
-
$print_log = ENV["PRINT_LOG"] || false
|
5
|
-
$browser_data = page.driver.browser.capabilities
|
6
|
-
end
|
7
|
-
|
8
|
-
AfterConfiguration do
|
9
|
-
$OBJECT = loadYAMLfile("features/step_definitions/repositories/project_object.yml")
|
10
|
-
validate_params_exist
|
11
|
-
if ENV['DELETE_COOKIE']
|
12
|
-
browser = Capybara.current_session.driver.browser
|
13
|
-
browser.manage.delete_all_cookies
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def validate_params_exist
|
18
|
-
raise "❌ ERROR: Missing param SERVER_URL." if ENV['SERVER_URL'].nil?
|
19
|
-
raise "❌ ERROR: Missing param BROWSER." if ENV['BROWSER'].nil?
|
20
|
-
if ENV['REPORT']
|
21
|
-
raise "❌ ERROR: Missing param TESTSUITE." if ENV['TESTSUITE'].nil?
|
22
|
-
raise "❌ ERROR: Missing param TESTCASE_REPORT_NAME." if ENV['TESTCASE_REPORT_NAME'].nil?
|
23
|
-
$report_path = "Reports/#{ENV['TESTSUITE']}"
|
24
|
-
$testcase_report_name = ENV['TESTCASE_REPORT_NAME']
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def getDriver
|
29
|
-
case ENV['BROWSER']
|
30
|
-
when "chrome"
|
31
|
-
@chrome_options = loadYAMLfile('config/chrome_options.yaml')
|
32
|
-
Capybara.register_driver :selenium do |app|
|
33
|
-
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'],:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: @chrome_options))
|
34
|
-
end
|
35
|
-
Capybara.current_driver = :selenium
|
36
|
-
when "firefox"
|
37
|
-
@firefox_options = loadYAMLfile('config/firefox_options.yaml')
|
38
|
-
Capybara.register_driver :selenium do |app|
|
39
|
-
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox(firefoxOptions: @firefox_options))
|
40
|
-
end
|
41
|
-
Capybara.current_driver = :selenium
|
42
|
-
when "safari"
|
43
|
-
@safari_options = loadYAMLfile('config/safari_options.yaml')
|
44
|
-
Capybara.register_driver :selenium do |app|
|
45
|
-
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.safari(safariOptions: @safari_options))
|
46
|
-
end
|
47
|
-
Capybara.current_driver = :selenium
|
48
|
-
when "ie"
|
49
|
-
@ie_options = loadYAMLfile('config/ie_options.yaml')
|
50
|
-
Capybara.register_driver :selenium do |app|
|
51
|
-
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.internet_explorer(ieOptions: @ie_options))
|
52
|
-
end
|
53
|
-
Capybara.current_driver = :selenium
|
54
|
-
when "chrome_headless"
|
55
|
-
@chrome_headless_options = loadYAMLfile('config/chrome_headless_options.yaml')
|
56
|
-
Capybara.register_driver :selenium do |app|
|
57
|
-
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: @chrome_headless_options))
|
58
|
-
end
|
59
|
-
Capybara.current_driver = :selenium
|
60
|
-
when "remote"
|
61
|
-
@capabilities = loadYAMLfile('config/remote_options.yaml')
|
62
|
-
Capybara.register_driver :selenium do |app|
|
63
|
-
Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => @capabilities)
|
64
|
-
end
|
65
|
-
Capybara.current_driver = :selenium
|
66
|
-
else
|
67
|
-
raise "❌ ERROR: Unsupported browser: #{ENV['BROWSER']}. Available: chrome || chrome headless || firefox || safari || ie || remote"
|
68
|
-
end
|
69
|
-
unless ENV["SCREEN_RESOLUTION"].nil?
|
70
|
-
screen_resolution = ENV["SCREEN_RESOLUTION"].split("x")
|
71
|
-
Capybara.page.current_window.resize_to(screen_resolution[0], screen_resolution[1])
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def loadYAMLfile(filename)
|
76
|
-
begin
|
77
|
-
return YAML.load_file(filename)
|
78
|
-
rescue Psych::SyntaxError => ex
|
79
|
-
raise "❌ SyntaxError when reading file: #{ex}"
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
After do |scenario|
|
84
|
-
# save_screenshot = ENV['SCREENSHOT'] || false
|
85
|
-
# if save_screenshot == true
|
86
|
-
# file_name = 'failed_%s.png' % rand(1000).to_s
|
87
|
-
# page.save_screenshot($screenshot+file_name) if scenario.failed?
|
88
|
-
# begin
|
89
|
-
# Capybara.page.driver.quit
|
90
|
-
# Capybara.send(:session_pool).delete_if { |key, value| key =~ /selenium/i }
|
91
|
-
# rescue StandardError => myStandardError
|
92
|
-
# puts "❌ Error: #{myStandardError}"
|
93
|
-
# exit(1)
|
94
|
-
# end
|
95
|
-
# end
|
96
|
-
# $browser_data = page.driver.browser.capabilities
|
97
|
-
# p "$browser_data:#{$browser_data.inspect}"
|
98
|
-
FileUtils.rm_rf(Dir.glob('downloads/*'))
|
99
|
-
end
|
100
|
-
|
101
|
-
at_exit do
|
102
|
-
if ENV['REPORT']
|
103
|
-
begin
|
104
|
-
# validateReport
|
105
|
-
time = Time.now.getutc
|
106
|
-
if $browser_data
|
107
|
-
browser_name = $browser_data[:browser_name]
|
108
|
-
browser_version = $browser_data[:browser_version]
|
109
|
-
platform = $browser_data[:platform_name]
|
110
|
-
end
|
111
|
-
ReportBuilder.configure do |config|
|
112
|
-
config.report_path = "#{$report_path}/#{$testcase_report_name}"
|
113
|
-
config.input_path = "#{$report_path}/#{$testcase_report_name}.json"
|
114
|
-
config.report_types = [:json, :html]
|
115
|
-
config.color = 'blue'
|
116
|
-
config.additional_info = {
|
117
|
-
'Browser' => browser_name || nil,
|
118
|
-
'Platform' => platform || nil,
|
119
|
-
'Browser Version' => browser_version || nil,
|
120
|
-
'Report Generated' => time
|
121
|
-
}
|
122
|
-
end
|
123
|
-
options = { report_title: "iTMS - Test Management System" }
|
124
|
-
ReportBuilder.build_report options
|
125
|
-
rescue NoMethodError
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|