control 'node' do
  title 'Selenium node integration tests'

  describe command('yum repolist') do
    its('stdout') { should include 'google-chrome' }
  end

  # Required packages
  packages = %w(
    firefox
    gcc
    google-chrome-stable
    unzip
  )

  packages.each do |package|
    describe package(package) do
      it { should be_installed }
    end
  end

  describe firewalld do
    it { should be_running }
    its('default_zone') { should eq 'public' }
    it { should have_port_enabled_in_zone('22/tcp', 'public') }
    it { should have_port_enabled_in_zone('5555/tcp', 'public') }
  end

  describe file('/usr/bin/chromedriver') do
    its('type') { should cmp 'link' }
  end

  # This package is installed from remote file, so check separately
  package('xdg-utils') do
    it { should be_installed }
  end

  describe file('/usr/local/bin/kill_chrome.py') do
    its('owner') { should eq 'root' }
    its('group') { should eq 'root' }
    its('mode') { should cmp '0744' }
    it { should exist }
  end

  describe crontab('root').commands('/usr/bin/python /usr/local/bin/kill_chrome.py') do
    its('minutes') { should cmp '*/5' }
  end
end
