Class: MediawikiSelenium::RakeTask

Inherits:
Cucumber::Rake::Task
  • Object
show all
Defined in:
lib/mediawiki_selenium/rake_task.rb

Instance Method Summary collapse

Constructor Details

#initialize(name: :selenium, test_dir: Environment.default_test_directory, site_tag: true) ⇒ RakeTask

Returns a new instance of RakeTask



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/mediawiki_selenium/rake_task.rb', line 7

def initialize(name: :selenium, test_dir: Environment.default_test_directory, site_tag: true)
  target = File.expand_path(test_dir, Rake.original_dir)
  env = Environment.load_default(target)

  workspace = env.lookup(:workspace, default: nil)
  site = URI.parse(env.lookup(:mediawiki_url)).host
  browser_tags = env.browser_tags.map { |tag| "@#{tag}" }.join(',')

  require 'shellwords'
  options = Shellwords.escape(test_dir)

  if workspace
    options +=
      ' --backtrace --verbose --color --format pretty'\
      " --format Cucumber::Formatter::Sauce --out '#{workspace}/log/junit'"\
      ' --tags ~@skip'
    options +=
      " --tags @#{site}" if site_tag
  end

  super(name) do |t|
    t.cucumber_opts = "#{options} --tags #{browser_tags}"
  end
end