Sha256: 51da70fe11ac5e0a5d819b8202b9036a78658fbfcfabaacf7def752ba8cf7601

Contents?: true

Size: 1.26 KB

Versions: 34

Compression:

Stored size: 1.26 KB

Contents

require_relative '../test_plugin_helper'
require 'integration_test_helper'

class HostgroupJsTest < IntegrationTestWithJavascript
  let(:hostgroup) { FactoryBot.create(:hostgroup, :name => 'HostgroupWithoutRoles') }
  let(:hostgroup_with_roles) { FactoryBot.create(:hostgroup, :with_ansible_roles, :name => 'HostgroupWithRoles') }

  setup do
    FactoryBot.create(:host, :hostgroup_id => hostgroup.id)
    FactoryBot.create(:host, :hostgroup_id => hostgroup_with_roles.id)
  end

  test 'hostgroup without roles should have disabled links' do
    visit hostgroups_path(search: hostgroup.name)

    first_row = page.find('table > tbody > tr:nth-child(1)')
    first_row.find('td:nth-child(4) > div > a').click

    assert_includes first(:link, 'Run all Ansible roles')[:class], 'disabled'
    assert_includes first(:link, 'Configure Ansible Job')[:class], 'disabled'
  end

  test 'hostgroup with roles should have clickable links' do
    visit hostgroups_path(search: hostgroup_with_roles.name)

    first_row = page.find('table > tbody > tr:nth-child(1)')
    first_row.find('td:nth-child(4) > div > a').click

    assert_not first(:link, 'Run all Ansible roles')[:class].include?('disabled')
    assert_not first(:link, 'Configure Ansible Job')[:class].include?('disabled')
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
foreman_ansible-14.2.3 test/integration/hostgroup_js_test.rb
foreman_ansible-15.0.5 test/integration/hostgroup_js_test.rb
foreman_ansible-15.0.4 test/integration/hostgroup_js_test.rb
foreman_ansible-15.0.3 test/integration/hostgroup_js_test.rb
foreman_ansible-15.0.2 test/integration/hostgroup_js_test.rb
foreman_ansible-15.0.1 test/integration/hostgroup_js_test.rb
foreman_ansible-15.0.0 test/integration/hostgroup_js_test.rb
foreman_ansible-14.2.2 test/integration/hostgroup_js_test.rb
foreman_ansible-14.2.1 test/integration/hostgroup_js_test.rb
foreman_ansible-13.0.7 test/integration/hostgroup_js_test.rb
foreman_ansible-14.2.0 test/integration/hostgroup_js_test.rb
foreman_ansible-14.1.1 test/integration/hostgroup_js_test.rb
foreman_ansible-14.1.0 test/integration/hostgroup_js_test.rb
foreman_ansible-13.0.5 test/integration/hostgroup_js_test.rb
foreman_ansible-14.0.0 test/integration/hostgroup_js_test.rb
foreman_ansible-13.0.4 test/integration/hostgroup_js_test.rb
foreman_ansible-13.0.3 test/integration/hostgroup_js_test.rb
foreman_ansible-13.0.2 test/integration/hostgroup_js_test.rb
foreman_ansible-13.0.1 test/integration/hostgroup_js_test.rb
foreman_ansible-13.0.0 test/integration/hostgroup_js_test.rb