quintocumber 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +7 -0
- data/Gemfile +3 -1
- data/README.md +14 -6
- data/Rakefile +4 -2
- data/bin/console +4 -3
- data/bin/test +4 -0
- data/exe/quintocumber +3 -7
- data/lib/env.rb +5 -3
- data/lib/loader.rb +10 -8
- data/lib/plugins/browserstack_config.rb +56 -43
- data/lib/plugins/environment_variables.rb +10 -0
- data/lib/plugins/local_config.rb +10 -3
- data/lib/plugins/publish_reports.rb +67 -43
- data/lib/plugins/screeshot_hooks.rb +12 -5
- data/lib/quintocumber/version.rb +3 -1
- data/lib/quintocumber.rb +64 -2
- data/lib/quintocumber_config.rb +11 -7
- data/lib/runner.rb +4 -2
- data/lib/setup_tests/coverage.rb +10 -0
- data/lib/setup_tests/mocks.rb +91 -0
- data/quintocumber.gemspec +32 -35
- metadata +43 -11
- data/lib/plugins/envitonment_variables.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 380dd9838bd05ca966fc0e23ee8f76fc4211596a
|
4
|
+
data.tar.gz: 6ebd05e6b6ba66fe301358330c585fa5e0a466ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d116b54826a0144fcf8b9d491b09ab2e7d09903a89ee928429d6b01e3ea8a5a23938dea2fff03d293fc26bf3077cb6b1658b7e4929cc4dddc4bf28cfc74242fa
|
7
|
+
data.tar.gz: 25a4270942f7f6a98bdfcd459da73c7dc18472ec0785a4f58081789859ffa23c178bf2885f30d91b31a0c0af887f24e69361cf7f382dc31f3a7620e0fbbc96c7
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# Quintocumber
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/quintocumber`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
3
|
## Installation
|
8
4
|
|
9
5
|
Add this line to your application's Gemfile:
|
@@ -22,13 +18,25 @@ Or install it yourself as:
|
|
22
18
|
|
23
19
|
## Usage
|
24
20
|
|
25
|
-
|
21
|
+
$ quintocumber
|
22
|
+
|
26
23
|
|
27
24
|
## Development
|
28
25
|
|
29
26
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
27
|
|
31
|
-
|
28
|
+
Install development external dependencies:
|
29
|
+
|
30
|
+
* Allure CLI 2.2.1 (https://github.com/allure-framework/allure2/releases/tag/2.2.1)
|
31
|
+
* Firefox and geckodriver
|
32
|
+
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
34
|
+
|
35
|
+
To run all tests: `bin/test`
|
36
|
+
|
37
|
+
To release a new version run `gem bump --version (major|minor|patch)`, which will create a git tag and commit for the version. Push the new commit and tag with `git push`.
|
38
|
+
|
39
|
+
Push the `.gem` file to [rubygems.org](https://rubygems.org) using `gem push quintocumber-<NEW_VERSION_TAG>.gem`
|
32
40
|
|
33
41
|
## Contributing
|
34
42
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'quintocumber'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "quintocumber"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start(__FILE__)
|
data/bin/test
ADDED
data/exe/quintocumber
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
4
|
+
require 'quintocumber'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
args = "--format pretty --format AllureCucumber::Formatter --out reports --require #{loader_file} #{cmd_args}".split(/\s+/)
|
9
|
-
|
10
|
-
Cucumber::Cli::Main.new(args).execute!
|
6
|
+
Quintocumber::Cli::Main.new(ARGV.dup).execute!
|
data/lib/env.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
4
|
require 'selenium/webdriver'
|
3
5
|
require 'rspec'
|
@@ -8,10 +10,10 @@ require 'rspec/expectations'
|
|
8
10
|
require 'factory_girl'
|
9
11
|
|
10
12
|
Capybara.default_max_wait_time = 10
|
11
|
-
Capybara.save_path =
|
13
|
+
Capybara.save_path = 'screenshots/'
|
12
14
|
|
13
|
-
After do |
|
14
|
-
Capybara.current_session.driver.quit
|
15
|
+
After do |_scenario|
|
16
|
+
Capybara.current_session.driver.quit
|
15
17
|
end
|
16
18
|
|
17
19
|
Capybara.default_driver = :wip
|
data/lib/loader.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'env'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
require_relative 'quintocumber_config'
|
6
|
+
|
7
|
+
Dir[File.join(File.dirname(__FILE__), 'plugins/**/*.rb')].each do |file|
|
8
|
+
require file
|
7
9
|
end
|
8
10
|
|
9
|
-
Dir[File.join(Dir.pwd,
|
10
|
-
require file
|
11
|
+
Dir[File.join(Dir.pwd, 'features/support/**/*.rb')].each do |file|
|
12
|
+
require file
|
11
13
|
end
|
12
14
|
|
13
|
-
Dir[File.join(Dir.pwd,
|
14
|
-
require file
|
15
|
+
Dir[File.join(Dir.pwd, 'features/**/*.rb')].each do |file|
|
16
|
+
require file
|
15
17
|
end
|
@@ -1,75 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'capybara/cucumber'
|
2
4
|
|
3
|
-
#Get browserstack configuration from browserstack.yml
|
4
|
-
#and override credentials if credentials are set in env variables
|
5
|
-
browserstack_default_config = YAML.
|
5
|
+
# Get browserstack configuration from browserstack.yml
|
6
|
+
# and override credentials if credentials are set in env variables
|
7
|
+
browserstack_default_config = YAML.safe_load(
|
8
|
+
File.read(File.join(File.dirname(__FILE__), './browserstack.yml'))
|
9
|
+
)
|
6
10
|
|
7
|
-
browserstack_project_config_filename = File.join(Dir.pwd,
|
11
|
+
browserstack_project_config_filename = File.join(Dir.pwd, './browserstack.yml')
|
8
12
|
if File.file?(browserstack_project_config_filename)
|
9
|
-
browserstack_project_config = YAML.
|
13
|
+
browserstack_project_config = YAML.safe_load(
|
14
|
+
File.read(browserstack_project_config_filename)
|
15
|
+
) || {}
|
10
16
|
else
|
11
|
-
browserstack_project_config =
|
17
|
+
browserstack_project_config = {}
|
12
18
|
end
|
13
19
|
|
14
|
-
browserstack_config = browserstack_default_config.merge(
|
20
|
+
browserstack_config = browserstack_default_config.merge(
|
21
|
+
browserstack_project_config
|
22
|
+
)
|
15
23
|
|
16
|
-
browserstack_config['user'] = ENV['BROWSERSTACK_USERNAME'] ||
|
17
|
-
browserstack_config['
|
24
|
+
browserstack_config['user'] = ENV['BROWSERSTACK_USERNAME'] ||
|
25
|
+
browserstack_config['user']
|
26
|
+
browserstack_config['key'] = ENV['BROWSERSTACK_ACCESS_KEY'] ||
|
27
|
+
browserstack_config['key']
|
18
28
|
|
19
|
-
#Only user browserstack if credentials are set
|
29
|
+
# Only user browserstack if credentials are set
|
20
30
|
if browserstack_config['user'] && browserstack_config['key']
|
21
|
-
#Register browserstack remote driver into Capybara context
|
31
|
+
# Register browserstack remote driver into Capybara context
|
22
32
|
Capybara.register_driver :browserstack do |app|
|
23
|
-
|
24
|
-
#
|
25
|
-
|
26
|
-
|
33
|
+
# check if target browser is properly configured in browsertack.yaml
|
34
|
+
# if no target browser is defined, skip verification due to later override
|
35
|
+
if ENV['TEST_BROWSER'] &&
|
36
|
+
browserstack_config['browser_caps'][ENV['TEST_BROWSER']].nil?
|
27
37
|
raise 'Remote browser not configured in browsertack.yaml'
|
28
38
|
end
|
29
39
|
|
30
|
-
#merge common capabilities and browser capabilities
|
31
|
-
|
32
|
-
|
40
|
+
# merge common capabilities and browser capabilities
|
41
|
+
# (if not browser is set, deafults to chrome)
|
42
|
+
browserstack_config['common_caps'] = browserstack_config['common_caps'] ||
|
43
|
+
{}
|
44
|
+
|
45
|
+
@caps = browserstack_config['common_caps'].merge(
|
46
|
+
browserstack_config['browser_caps'][TEST_BROWSER]
|
47
|
+
)
|
33
48
|
|
34
|
-
#sets timestamp as build name along with target browser
|
49
|
+
# sets timestamp as build name along with target browser
|
35
50
|
@caps['build'] = BUILD
|
36
|
-
|
37
|
-
#sets project name
|
51
|
+
|
52
|
+
# sets project name
|
38
53
|
@caps['project'] = PROJECT_NAME
|
39
54
|
|
40
|
-
#all set, instanciate new remote broser
|
41
|
-
Capybara::Selenium::Driver.new(
|
42
|
-
|
43
|
-
:
|
44
|
-
:
|
55
|
+
# all set, instanciate new remote broser
|
56
|
+
Capybara::Selenium::Driver.new(
|
57
|
+
app,
|
58
|
+
browser: :remote,
|
59
|
+
url: "http://#{browserstack_config['user']}" \
|
60
|
+
":#{browserstack_config['key']}@" \
|
61
|
+
"#{browserstack_config['server']}/wd/hub",
|
62
|
+
desired_capabilities: @caps
|
45
63
|
)
|
46
64
|
end
|
47
|
-
|
48
|
-
#set browserstack as default browser
|
65
|
+
|
66
|
+
# set browserstack as default browser
|
49
67
|
Capybara.default_driver = :browserstack
|
50
68
|
end
|
51
69
|
|
52
|
-
|
53
|
-
#
|
54
|
-
#browserstack will receive scenario name as test name
|
70
|
+
# Re-register browserstack remote browser before each scenario run to ensure
|
71
|
+
# browserstack will receive scenario name as test name
|
55
72
|
Before do |scenario|
|
56
|
-
|
57
|
-
#Only re-register if browserstack is the current driver
|
73
|
+
# Only re-register if browserstack is the current driver
|
58
74
|
if Capybara.current_driver == :browserstack
|
59
75
|
|
60
|
-
#Get current options to override later
|
76
|
+
# Get current options to override later
|
61
77
|
opts = Capybara.current_session.driver.options
|
62
78
|
|
63
|
-
#Put scenario name on options
|
64
|
-
opts[:desired_capabilities] = opts[:desired_capabilities].merge(
|
65
|
-
|
66
|
-
|
67
|
-
Capybara.register_driver :browserstack do |app|
|
68
|
-
Capybara::Selenium::Driver.new(app, opts)
|
69
|
-
end
|
79
|
+
# Put scenario name on options
|
80
|
+
opts[:desired_capabilities] = opts[:desired_capabilities].merge(
|
81
|
+
'name' => scenario.name
|
82
|
+
)
|
70
83
|
|
71
|
-
#Ensure Capybara will get the most recent driver registered
|
84
|
+
# Ensure Capybara will get the most recent driver registered
|
85
|
+
# (Kinda MAGIC; don't touch)
|
72
86
|
Capybara.current_driver = :browserstack
|
73
87
|
end
|
74
88
|
end
|
75
|
-
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
environments_config_filename = File.join(Dir.pwd, './environments.yaml')
|
4
|
+
ENVIRONMENT = if File.file?(environments_config_filename)
|
5
|
+
YAML.safe_load(
|
6
|
+
File.read(environments_config_filename), [], [], true
|
7
|
+
).dig(ENV['WHERE'] || 'default').freeze || {}.freeze
|
8
|
+
else
|
9
|
+
{}.freeze
|
10
|
+
end
|
data/lib/plugins/local_config.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
Capybara.register_driver :wip do |app|
|
2
|
-
test_browser = ENV['TEST_BROWSER'] ||
|
3
|
-
|
4
|
-
|
4
|
+
test_browser = ENV['TEST_BROWSER'] || 'chrome'
|
5
|
+
selenium_server = ENV['SELENIUM_SERVER']
|
6
|
+
if ENV['SELENIUM_SERVER'].nil?
|
7
|
+
Capybara::Selenium::Driver.new(app, browser: test_browser.to_sym)
|
8
|
+
else
|
9
|
+
Capybara::Selenium::Driver.new(app, browser: :remote, url: selenium_server, desired_capabilities: test_browser.to_sym)
|
10
|
+
end
|
11
|
+
end
|
@@ -1,56 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'httparty'
|
2
4
|
require 'aws-sdk'
|
3
5
|
|
4
|
-
|
6
|
+
tests_failed = []
|
7
|
+
|
8
|
+
def pagerduty_payload(failed_length, reports_list_str)
|
9
|
+
{
|
10
|
+
payload: {
|
11
|
+
summary: failed_length.to_s + ' #{PROJECT_NAME} test(s) failed',
|
12
|
+
source: '#{PROJECT_NAME}',
|
13
|
+
severity: 'critical',
|
14
|
+
custom_details: "Failed test(s):\n- #{reports_list_str}"
|
15
|
+
},
|
16
|
+
event_action: 'trigger',
|
17
|
+
routing_key: ENV['PAGERDUTY_ROUTING_KEY']
|
18
|
+
}
|
19
|
+
end
|
5
20
|
|
6
21
|
AfterConfiguration do |config|
|
7
22
|
config.on_event :after_test_case do |event|
|
8
|
-
|
9
|
-
PUBLISH_REPORTS_TESTS_FAILED.push(event.test_case.name)
|
10
|
-
end
|
23
|
+
tests_failed.push(event.test_case.name) unless event.result.ok?
|
11
24
|
end
|
12
25
|
end
|
13
26
|
|
14
|
-
|
27
|
+
def generate_report_and_upload_to_s3
|
15
28
|
bucket = ENV['REPORT_BUCKET']
|
16
|
-
bucket_region = ENV['REPORT_BUCKET_REGION']
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
report_url = "http://#{bucket}.s3-website-#{bucket_region}.amazonaws.com/#{URI.escape(BUILD)}"
|
32
|
-
end
|
33
|
-
if ENV['PAGERDUTY_ROUTING_KEY'] && PUBLISH_REPORTS_TESTS_FAILED.length > 0
|
34
|
-
puts "Sending test failed alert to PagerDuty"
|
35
|
-
payload = {
|
36
|
-
:payload => {
|
37
|
-
:summary => "#{PUBLISH_REPORTS_TESTS_FAILED.length} #{PROJECT_NAME} test(s) failed",
|
38
|
-
:source => "#{PROJECT_NAME}",
|
39
|
-
:severity => "critical",
|
40
|
-
:custom_details => "Failed test(s):\n- #{PUBLISH_REPORTS_TESTS_FAILED.join("\n- ")}"
|
41
|
-
},
|
42
|
-
:event_action => "trigger",
|
43
|
-
:routing_key => ENV['PAGERDUTY_ROUTING_KEY'],
|
44
|
-
}
|
45
|
-
if report_url
|
46
|
-
payload[:links] = [{
|
47
|
-
:href => report_url,
|
48
|
-
:text => "Report for #{BUILD}"
|
49
|
-
}]
|
50
|
-
end
|
51
|
-
response = HTTParty.post "https://events.pagerduty.com/v2/enqueue",
|
52
|
-
headers:{ "Content-Type" => "application/json"},
|
53
|
-
body: payload.to_json
|
29
|
+
bucket_region = ENV['REPORT_BUCKET_REGION']
|
30
|
+
return unless bucket && system('allure --help >> /dev/null')
|
31
|
+
puts 'Generating allure report and uploading to s3'
|
32
|
+
system('allure generate --clean reports')
|
33
|
+
upload_report_files_to_s3
|
34
|
+
"http://#{bucket}.s3-website-#{bucket_region}.amazonaws.com/" +
|
35
|
+
URI.escape(BUILD)
|
36
|
+
end
|
37
|
+
|
38
|
+
def upload_report_files_to_s3
|
39
|
+
s3 = instanciate_s3_connector
|
40
|
+
Dir[File.join(Dir.pwd, 'allure-report/**/*')].each do |file|
|
41
|
+
next if File.directory?(file)
|
42
|
+
upload_to_s3(s3, ENV['REPORT_BUCKET'], file)
|
54
43
|
end
|
55
44
|
end
|
56
45
|
|
46
|
+
def instanciate_s3_connector
|
47
|
+
bucket_region = ENV['REPORT_BUCKET_REGION'] || 'us-east-1'
|
48
|
+
Aws::S3::Resource.new(region: bucket_region)
|
49
|
+
end
|
50
|
+
|
51
|
+
def upload_to_s3(s3, bucket, file)
|
52
|
+
file_name = file.clone
|
53
|
+
file_name.sub! File.join(Dir.pwd, 'allure-report/'), ''
|
54
|
+
obj = s3.bucket(bucket).object('#{BUILD}/#{file_name}')
|
55
|
+
obj.upload_file(file)
|
56
|
+
obj.acl.put(acl: 'public-read')
|
57
|
+
end
|
58
|
+
|
59
|
+
def insert_report_url_on_pagerduty_payload(report_url, payload)
|
60
|
+
payload[:links] = [{
|
61
|
+
href: report_url,
|
62
|
+
text: 'Report for #{BUILD}'
|
63
|
+
}]
|
64
|
+
puts 'Sending s3 report url to PagerDuty'
|
65
|
+
end
|
66
|
+
|
67
|
+
def report_to_pagerduty(report_url, tests_failed)
|
68
|
+
return unless ENV['PAGERDUTY_ROUTING_KEY'] && !tests_failed.empty?
|
69
|
+
puts 'Sending test failed alert to PagerDuty'
|
70
|
+
payload = pagerduty_payload(tests_failed.length, tests_failed.join('\n- '))
|
71
|
+
insert_report_url_on_pagerduty_payload(report_url, payload) if report_url
|
72
|
+
HTTParty.post 'https://events.pagerduty.com/v2/enqueue',
|
73
|
+
headers: { 'Content-Type' => 'application/json' },
|
74
|
+
body: payload.to_json
|
75
|
+
end
|
76
|
+
|
77
|
+
at_exit do
|
78
|
+
report_url = generate_report_and_upload_to_s3
|
79
|
+
report_to_pagerduty(report_url, tests_failed)
|
80
|
+
end
|
@@ -1,12 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Using temp class to avoid conflict with Capybara.attach_file
|
4
|
+
class AllureCucumberDSLTemp
|
5
|
+
extend AllureCucumber::DSL
|
6
|
+
end
|
7
|
+
|
1
8
|
AfterConfiguration do |config|
|
2
9
|
config.on_event :after_test_step do |event|
|
3
10
|
if !ENV['DISABLE_REPORTS_SCREENSHOT'] && !event.result.ok?
|
4
11
|
filename = "#{event.test_case.name}/#{event.test_step.name}.png"
|
5
12
|
Capybara.page.save_screenshot(filename)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
13
|
+
AllureCucumberDSLTemp.attach_file(
|
14
|
+
filename,
|
15
|
+
File.open(File.join(Dir.pwd, Capybara.save_path, filename.to_s))
|
16
|
+
)
|
10
17
|
end
|
11
18
|
end
|
12
|
-
end
|
19
|
+
end
|
data/lib/quintocumber/version.rb
CHANGED
data/lib/quintocumber.rb
CHANGED
@@ -1,5 +1,67 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'quintocumber/version'
|
4
|
+
require 'cucumber/cli/main'
|
2
5
|
|
3
6
|
module Quintocumber
|
4
|
-
|
7
|
+
module Cli
|
8
|
+
# CLI entrypoint class
|
9
|
+
class Main
|
10
|
+
def initialize(args, _ = nil, out = STDOUT, err = STDERR, kernel = Kernel)
|
11
|
+
@args = args
|
12
|
+
@out = out
|
13
|
+
@err = err
|
14
|
+
@kernel = kernel
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute!
|
18
|
+
if ENV['TESTS']
|
19
|
+
require 'setup_tests/coverage'
|
20
|
+
require 'setup_tests/mocks'
|
21
|
+
end
|
22
|
+
loader_file = File.join(File.dirname(__FILE__), '/loader.rb')
|
23
|
+
args = default_args(loader_file) + @args
|
24
|
+
args.push("--format", "rerun", "--out", "failed.txt")
|
25
|
+
|
26
|
+
# TODO: Extract and improve this block
|
27
|
+
retry_attempts = 0
|
28
|
+
retry_attempts_idx = args.index("--retry")
|
29
|
+
if retry_attempts_idx
|
30
|
+
args.slice(retry_attempts_idx)
|
31
|
+
retry_attempts = args.slice(retry_attempts_idx + 1)
|
32
|
+
puts retry_attempts
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
Cucumber::Cli::Main.new(args, nil, @out, @err, @kernel).execute!
|
37
|
+
rescue SystemExit
|
38
|
+
i = 0
|
39
|
+
while i < retry_attempts.to_i
|
40
|
+
# TODO: Extract and improve this block
|
41
|
+
puts "Retry ##{i+1}"
|
42
|
+
args_to_retry = args.clone
|
43
|
+
args_to_retry + File.readlines("failed.txt")
|
44
|
+
begin
|
45
|
+
Cucumber::Cli::Main.new(args_to_retry, nil, @out, @err, @kernel).execute!
|
46
|
+
rescue SystemExit
|
47
|
+
i = i + 1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def default_args(loader_file)
|
54
|
+
[
|
55
|
+
'--format',
|
56
|
+
'pretty',
|
57
|
+
'--format',
|
58
|
+
'AllureCucumber::Formatter',
|
59
|
+
'--out',
|
60
|
+
'reports',
|
61
|
+
'--require',
|
62
|
+
loader_file.to_s
|
63
|
+
]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
5
67
|
end
|
data/lib/quintocumber_config.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
TEST_BROWSER = ENV['TEST_BROWSER'] || 'chrome'
|
2
4
|
|
3
5
|
BUILD = "#{Time.now.utc.iso8601} - #{TEST_BROWSER}"
|
4
6
|
|
5
|
-
quintocumber_project_config_filename = File.join(Dir.pwd,
|
6
|
-
if File.file?(quintocumber_project_config_filename)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
quintocumber_project_config_filename = File.join(Dir.pwd, './quintocumber.yaml')
|
8
|
+
quintocumber_config = if File.file?(quintocumber_project_config_filename)
|
9
|
+
YAML.safe_load(
|
10
|
+
File.read(quintocumber_project_config_filename)
|
11
|
+
) || {}
|
12
|
+
else
|
13
|
+
{}
|
14
|
+
end
|
11
15
|
|
12
16
|
quintocumber_config['project'] = quintocumber_config['project'] || {}
|
13
17
|
|
14
|
-
PROJECT_NAME = quintocumber_config['project']['name'] ||
|
18
|
+
PROJECT_NAME = quintocumber_config['project']['name'] || 'UNNAMED PROJECT'
|
data/lib/runner.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cucumber/cli/main'
|
2
4
|
|
3
|
-
loader_file = File.join(File.dirname(__FILE__),
|
5
|
+
loader_file = File.join(File.dirname(__FILE__), 'loader.rb')
|
4
6
|
|
5
7
|
args = "--verbose --require #{loader_file}".split(/\s+/)
|
6
8
|
|
7
|
-
Cucumber::Cli::Main.new(args).execute!
|
9
|
+
Cucumber::Cli::Main.new(args).execute!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
|
5
|
+
SimpleCov.command_name "quintocumber #{Process.pid}"
|
6
|
+
SimpleCov.root(File.join(File.expand_path(File.dirname(__FILE__)), '../..'))
|
7
|
+
SimpleCov.start do
|
8
|
+
add_filter 'tests_setup'
|
9
|
+
add_filter 'tmp'
|
10
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'webmock'
|
4
|
+
include WebMock::API
|
5
|
+
|
6
|
+
WebMock.enable!
|
7
|
+
|
8
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|
9
|
+
|
10
|
+
stub_request(:any, /events.pagerduty.com/)
|
11
|
+
|
12
|
+
stub_request(:any, /dummy.s3.amazonaws.com/)
|
13
|
+
|
14
|
+
# stub_request(:any, /hub-cloud.browserstack.com/)
|
15
|
+
|
16
|
+
browserstack_mock_post1_reponse = '
|
17
|
+
{
|
18
|
+
"state": null,
|
19
|
+
"sessionId": "6b04a40d32157861f90f4b624bbf40090fdb9477",
|
20
|
+
"hCode": 21722156,
|
21
|
+
"value": {
|
22
|
+
"applicationCacheEnabled": false,
|
23
|
+
"rotatable": false,
|
24
|
+
"mobileEmulationEnabled": false,
|
25
|
+
"networkConnectionEnabled": false,
|
26
|
+
"chrome": {
|
27
|
+
"chromedriverVersion": "2.30.477700 ()",
|
28
|
+
"userDataDir": "C:\\Windows\\proxy\\scoped_dir6792_23550"
|
29
|
+
},
|
30
|
+
"takesHeapSnapshot": true,
|
31
|
+
"pageLoadStrategy": "normal",
|
32
|
+
"databaseEnabled": false,
|
33
|
+
"handlesAlerts": true,
|
34
|
+
"hasTouchScreen": false,
|
35
|
+
"version": "59.0.3071.86",
|
36
|
+
"platform": "XP",
|
37
|
+
"browserConnectionEnabled": false,
|
38
|
+
"nativeEvents": true,
|
39
|
+
"acceptSslCerts": true,
|
40
|
+
"webdriver.remote.sessionid": "6b04a40d32157861f90f4b624bbf40090fdb9477",
|
41
|
+
"locationContextEnabled": true,
|
42
|
+
"webStorageEnabled": true,
|
43
|
+
"browserName": "chrome",
|
44
|
+
"takesScreenshot": true,
|
45
|
+
"javascriptEnabled": true,
|
46
|
+
"cssSelectorsEnabled": true,
|
47
|
+
"unexpectedAlertBehaviour": ""
|
48
|
+
},
|
49
|
+
"class": "org.openqa.selenium.remote.Response",
|
50
|
+
"status": 0
|
51
|
+
}
|
52
|
+
'
|
53
|
+
|
54
|
+
browserstack_mock_post2_reponse = '
|
55
|
+
{
|
56
|
+
"state": "success",
|
57
|
+
"sessionId": "6b04a40d32157861f90f4b624bbf40090fdb9477",
|
58
|
+
"hCode": 6531147,
|
59
|
+
"value": null,
|
60
|
+
"class": "org.openqa.selenium.remote.Response",
|
61
|
+
"status": 0
|
62
|
+
}
|
63
|
+
'
|
64
|
+
|
65
|
+
browserstack_mock_delete_reponse = '
|
66
|
+
{"state":"success", "status": 0}
|
67
|
+
'
|
68
|
+
|
69
|
+
stub_request(
|
70
|
+
:post,
|
71
|
+
%r{hub-cloud.browserstack.com\/wd\/hub\/session$}
|
72
|
+
).to_return(
|
73
|
+
body: browserstack_mock_post1_reponse,
|
74
|
+
headers: { 'Content-Type' => 'application/json' }
|
75
|
+
)
|
76
|
+
|
77
|
+
stub_request(
|
78
|
+
:post,
|
79
|
+
%r{hub-cloud.browserstack.com\/wd\/hub\/session\/(.+)\/url$}
|
80
|
+
).to_return(
|
81
|
+
body: browserstack_mock_post2_reponse,
|
82
|
+
headers: { 'Content-Type' => 'application/json' }
|
83
|
+
)
|
84
|
+
|
85
|
+
stub_request(
|
86
|
+
:delete,
|
87
|
+
%r{hub-cloud.browserstack.com\/wd\/hub\/session\/(.+)$}
|
88
|
+
).to_return(
|
89
|
+
body: browserstack_mock_delete_reponse,
|
90
|
+
headers: { 'Content-Type' => 'application/json' }
|
91
|
+
)
|
data/quintocumber.gemspec
CHANGED
@@ -1,49 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# coding: utf-8
|
2
|
-
|
3
|
+
|
4
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
6
|
+
require 'quintocumber/version'
|
5
7
|
|
6
8
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
9
|
+
spec.name = 'quintocumber'
|
8
10
|
spec.version = Quintocumber::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
+
spec.authors = ['Diego Queiroz']
|
12
|
+
spec.email = ['dqueiroz@quintoandar.com.br']
|
11
13
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
|
15
|
-
spec.license = "MIT"
|
14
|
+
spec.summary = 'Cucumber on steroids'
|
15
|
+
spec.description = 'Cucumber with some additional support: Capybara,' \
|
16
|
+
'Browsertack, Allure reports, Rspec and SitePrism'
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
# if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
# else
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
-
# "public gem pushes."
|
24
|
-
# end
|
18
|
+
spec.homepage = 'https://github.com/quintoandar/quintocumber'
|
19
|
+
spec.license = 'MIT'
|
25
20
|
|
26
21
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
22
|
f.match(%r{^(test|spec|features)/})
|
28
23
|
end
|
29
|
-
spec.executables = [
|
30
|
-
spec.bindir =
|
24
|
+
spec.executables = ['quintocumber']
|
25
|
+
spec.bindir = 'exe'
|
31
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = [
|
27
|
+
spec.require_paths = ['lib']
|
28
|
+
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
30
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
31
|
+
spec.add_development_dependency 'aruba', '~> 0.7'
|
32
|
+
spec.add_development_dependency 'simplecov', '~> 0.14.1'
|
33
|
+
spec.add_development_dependency 'webmock', '~> 3.0.1'
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 0.49.1'
|
33
35
|
|
34
|
-
spec.
|
35
|
-
spec.
|
36
|
-
spec.
|
37
|
-
spec.
|
38
|
-
|
39
|
-
spec.add_dependency
|
40
|
-
spec.add_dependency
|
41
|
-
spec.add_dependency
|
42
|
-
spec.add_dependency
|
43
|
-
spec.add_dependency
|
44
|
-
spec.add_dependency "allure-cucumber", "~> 0.5"
|
45
|
-
spec.add_dependency "factory_girl", "~> 4.8"
|
46
|
-
spec.add_dependency "faker", "~> 1.8"
|
47
|
-
spec.add_dependency "httparty", "~> 0.15"
|
48
|
-
spec.add_dependency "aws-sdk", "~> 2.10"
|
36
|
+
spec.add_dependency 'cucumber', '~> 2.4'
|
37
|
+
spec.add_dependency 'rspec', '~> 3.6'
|
38
|
+
spec.add_dependency 'site_prism', '~> 2.9'
|
39
|
+
spec.add_dependency 'capybara', '~> 2.14'
|
40
|
+
spec.add_dependency 'selenium-webdriver', '~> 3.4'
|
41
|
+
spec.add_dependency 'allure-cucumber', '~> 0.5'
|
42
|
+
spec.add_dependency 'factory_girl', '~> 4.8'
|
43
|
+
spec.add_dependency 'faker', '~> 1.8'
|
44
|
+
spec.add_dependency 'httparty', '~> 0.15'
|
45
|
+
spec.add_dependency 'aws-sdk', '~> 2.10'
|
49
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quintocumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diego Queiroz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,33 +39,61 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: aruba
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.14.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.14.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.0.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.0.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: cucumber
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,7 +234,7 @@ dependencies:
|
|
206
234
|
- - "~>"
|
207
235
|
- !ruby/object:Gem::Version
|
208
236
|
version: '2.10'
|
209
|
-
description: 'Cucumber with some additional support: Capybara,
|
237
|
+
description: 'Cucumber with some additional support: Capybara,Browsertack, Allure
|
210
238
|
reports, Rspec and SitePrism'
|
211
239
|
email:
|
212
240
|
- dqueiroz@quintoandar.com.br
|
@@ -216,18 +244,20 @@ extensions: []
|
|
216
244
|
extra_rdoc_files: []
|
217
245
|
files:
|
218
246
|
- ".gitignore"
|
247
|
+
- ".rubocop.yml"
|
219
248
|
- Gemfile
|
220
249
|
- LICENSE.txt
|
221
250
|
- README.md
|
222
251
|
- Rakefile
|
223
252
|
- bin/console
|
224
253
|
- bin/setup
|
254
|
+
- bin/test
|
225
255
|
- exe/quintocumber
|
226
256
|
- lib/env.rb
|
227
257
|
- lib/loader.rb
|
228
258
|
- lib/plugins/browserstack.yml
|
229
259
|
- lib/plugins/browserstack_config.rb
|
230
|
-
- lib/plugins/
|
260
|
+
- lib/plugins/environment_variables.rb
|
231
261
|
- lib/plugins/local_config.rb
|
232
262
|
- lib/plugins/publish_reports.rb
|
233
263
|
- lib/plugins/screeshot_hooks.rb
|
@@ -235,6 +265,8 @@ files:
|
|
235
265
|
- lib/quintocumber/version.rb
|
236
266
|
- lib/quintocumber_config.rb
|
237
267
|
- lib/runner.rb
|
268
|
+
- lib/setup_tests/coverage.rb
|
269
|
+
- lib/setup_tests/mocks.rb
|
238
270
|
- quintocumber.gemspec
|
239
271
|
homepage: https://github.com/quintoandar/quintocumber
|
240
272
|
licenses:
|
@@ -256,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
288
|
version: '0'
|
257
289
|
requirements: []
|
258
290
|
rubyforge_project:
|
259
|
-
rubygems_version: 2.
|
291
|
+
rubygems_version: 2.5.1
|
260
292
|
signing_key:
|
261
293
|
specification_version: 4
|
262
294
|
summary: Cucumber on steroids
|