-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
57 lines (50 loc) · 1.5 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'webdrivers'
namespace :localhost do
%w(all bank costs_sales expense_reports regression smoke subscriptions).each do |suite|
desc "Executes on localhost #{suite.gsub '_', ' '} tests"
task suite do
execute_tests environment: :localhost, suite: suite
end
end
end
namespace :production do
%w(all bank costs_sales expense_reports regression smoke test).each do |suite|
desc "Executes on production #{suite.gsub '_', ' '} tests"
task suite do
execute_tests environment: :production, suite: suite
end
end
end
namespace :staging do
%w(all bank costs_sales expense_reports integrations regression smoke subscriptions test).each do |suite|
desc "Executes on staging #{suite.gsub '_', ' '} tests"
task suite do
execute_tests environment: :staging, suite: suite
end
end
end
def execute_tests(environment:, suite:)
browser = (ENV.fetch 'BROWSER', 'chrome').downcase
case environment
when :production
environment_url = 'ENV_URL=...'
config = 'CONFIG=production'
environment_tag = 'prod'
when :staging
environment_url = 'ENV_URL=...'
config = 'CONFIG=staging'
environment_tag = 'stage'
else
environment_url = 'ENV_URL=http://localhost:3000'
config = 'CONFIG=default'
environment_tag = 'local'
end
command =
"#{environment_url} #{config} bundle exec rspec spec/. --tag ~#{environment_tag}:false --tag ~#{browser}:false"
case suite
when 'all'
exec command
else
exec "#{command} --tag #{suite}"
end
end