Sha256: 20381547fc33977d13875d465851e089803480a4fc69619e32e6b15024b76747

Contents?: true

Size: 1.86 KB

Versions: 28

Compression:

Stored size: 1.86 KB

Contents

require 'integration_puppet_helper'

module ForemanPuppet
  class PuppetclassJsTest < IntegrationTestWithJavascript
    include ForemanPuppet::Engine.routes.url_helpers
    # intermittent failures:
    #   PuppetclassIntegrationTest.test_0001_edit page

    let(:environment) { FactoryBot.create(:environment) }
    let(:puppetclass) { FactoryBot.create(:puppetclass, environments: [environment]) }

    test 'edit page' do
      FactoryBot.create(:puppetclass, name: 'vim', environments: [environment])
      visit puppetclasses_path
      click_link 'vim'
      assert page.has_no_link? 'Common'
      find(:xpath, "//a[@title='Select All']").hover
      find(:xpath, "//a[@data-original-title='Select All']").click
      assert_submit_button(puppetclasses_path)
      assert page.has_link? 'vim'
      assert page.has_link? 'Common'
    end

    test 'verify key label exists in case key is too long' do
      smart_class_parameter_long = FactoryBot.create(:puppetclass_lookup_key, puppetclass: puppetclass, variable: 'a' * 50)
      visit edit_puppetclass_path(puppetclass)
      click_link 'Smart Class Parameter'
      page.find("#pill_#{smart_class_parameter_long.id}-#{smart_class_parameter_long.key}").hover
      assert_equal smart_class_parameter_long.key, page.find("#pill_#{smart_class_parameter_long.id}-#{smart_class_parameter_long.key}")['data-original-title']
    end

    test 'verify key label is empty in case key is short' do
      smart_class_parameter_short = FactoryBot.create(:puppetclass_lookup_key, puppetclass: puppetclass, variable: 'a' * 40)
      visit edit_puppetclass_path(puppetclass)
      click_link 'Smart Class Parameter'
      page.find("#pill_#{smart_class_parameter_short.id}-#{smart_class_parameter_short.key}").hover
      assert_empty page.find("#pill_#{smart_class_parameter_short.id}-#{smart_class_parameter_short.key}")['data-original-title']
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
foreman_puppet-4.0.1 test/integration/foreman_puppet/puppetclass_js_test.rb
foreman_puppet-4.0.0 test/integration/foreman_puppet/puppetclass_js_test.rb
foreman_puppet-3.0.6 test/integration/foreman_puppet/puppetclass_js_test.rb
foreman_puppet-3.0.5 test/integration/foreman_puppet/puppetclass_js_test.rb
foreman_puppet-3.0.4 test/integration/foreman_puppet/puppetclass_js_test.rb
foreman_puppet-3.0.3 test/integration/foreman_puppet/puppetclass_js_test.rb
foreman_puppet-3.0.2 test/integration/foreman_puppet/puppetclass_js_test.rb
foreman_puppet-3.0.1 test/integration/foreman_puppet/puppetclass_js_test.rb