-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
executable file
·191 lines (141 loc) · 4.47 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
require 'rubygems'
require 'cucumber'
require 'cucumber/rake/task'
require 'docker/compose'
require 'parallel_tests'
require 'rake'
require 'rspec/core/rake_task'
require 'simplecov'
require 'yard'
require 'testcentricity_web/version'
desc 'Run WIP specs'
RSpec::Core::RakeTask.new(:wip_specs) do |t|
t.rspec_opts = '--tag wip'
end
desc 'Run required specs'
RSpec::Core::RakeTask.new(:required_specs) do |t|
t.rspec_opts = '--tag required'
end
desc 'Run grid WebDriver specs'
RSpec::Core::RakeTask.new(:grid_specs) do |t|
t.rspec_opts = '--tag grid'
end
desc 'Run mobile WebDriver specs'
RSpec::Core::RakeTask.new(:mobile_specs) do |t|
t.rspec_opts = '--tag mobile'
end
desc 'Run BrowserStack specs'
RSpec::Core::RakeTask.new(:browserstack_specs) do |t|
t.rspec_opts = '--tag browserstack'
end
desc 'Run TestingBot specs'
RSpec::Core::RakeTask.new(:testingbot_specs) do |t|
t.rspec_opts = '--tag testingbot'
end
desc 'Run Sauce Labs specs'
RSpec::Core::RakeTask.new(:saucelabs_specs) do |t|
t.rspec_opts = '--tag saucelabs'
end
desc 'Run LambdaTest specs'
RSpec::Core::RakeTask.new(:lambdatest_specs) do |t|
t.rspec_opts = '--tag lambdatest'
end
desc 'Run Custom User-defined WebDriver specs'
RSpec::Core::RakeTask.new(:custom_webdriver_specs) do |t|
t.rspec_opts = '--tag custom'
end
desc 'Run Multiple Driver specs'
RSpec::Core::RakeTask.new(:multi_driver_spec) do |t|
t.rspec_opts = '--tag multi_driver_spec'
end
desc 'Run Cucumber features on local Safari browser'
Cucumber::Rake::Task.new(:safari_local) do |t|
t.profile = 'safari_local'
end
desc 'Run Cucumber features on iOS simulator'
Cucumber::Rake::Task.new(:ios_remote) do |t|
t.profile = 'ios_caps_remote'
end
desc 'Run Cucumber features on Android simulator'
Cucumber::Rake::Task.new(:android_remote) do |t|
t.profile = 'android_caps_remote'
end
desc 'Run required Cucumber features on local web browsers'
task :required_cukes do
%w[chrome_local chrome_headless firefox_local firefox_headless edge_local edge_headless ipad_pro_12_local].each do |profile|
system "parallel_cucumber features/ -o '-p #{profile} -p parallel' -n 6 --group-by scenarios"
end
end
desc 'Run grid Cucumber features on Dockerized Selenium 4 Grid'
task :grid_cukes do
# start up Selenium 4 Grid
compose = Docker::Compose.new
compose.version
compose.up(detached: true)
# run grid features
begin
%w[chrome_grid firefox_grid edge_grid].each do |profile|
system "parallel_cucumber features/ -o '-p #{profile} -p parallel' -n 4 --group-by scenarios"
end
ensure
# shut down Selenium Grid
compose.down(remove_volumes: true)
end
end
desc 'Run grid specs on Dockerized Selenium 4 Grid'
task :docker_grid_specs do
# start up Selenium 4 Grid
compose = Docker::Compose.new
compose.version
compose.up(detached: true)
# run grid specs
begin
Rake::Task[:grid_specs].invoke
ensure
# shut down Selenium Grid
compose.down(remove_volumes: true)
end
end
desc 'Run mobile web specs and Cucumber features'
task mobile: [:mobile_specs, :android_remote]
desc 'Run required specs and Cucumber features'
task required: [:required_specs, :required_cukes]
desc 'Run grid specs and Cucumber features on Dockerized Selenium 4 Grid'
task grid: [:docker_grid_specs, :grid_cukes]
desc 'Run cloud service specs'
task cloud_specs: [:browserstack_specs,
:saucelabs_specs,
:testingbot_specs,
:lambdatest_specs]
desc 'Run all specs'
task all_specs: [:required_specs,
:multi_driver_spec,
:docker_grid_specs,
:mobile_specs,
:browserstack_specs,
:saucelabs_specs,
:testingbot_specs]
desc 'Run all specs and Cucumber features'
task all: [:required,
:docker_grid_specs,
:browserstack_specs,
:custom_webdriver_specs,
:multi_driver_spec,
:safari_local,
:mobile]
desc 'Update HTML docs'
YARD::Rake::YardocTask.new(:docs) do |t|
ENV['COVERAGE'] = 'false'
t.files = ['lib/**/*.rb']
end
desc 'Build and release new version of gem'
task :release do
ENV['COVERAGE'] = 'false'
version = TestCentricityWeb::VERSION
puts "Release version #{version} of TestCentricity Web gem, y/n?"
exit(1) unless $stdin.gets.chomp == 'y'
sh 'gem build testcentricity_web.gemspec && ' \
"gem push testcentricity_web-#{version}.gem"
end
desc 'Update docs, build gem, and push to RubyGems'
task ship_it: [:docs, :release]