Project

General

Profile

Download (2.31 KB) Statistics
| Branch: | Tag: | Revision:
26dade0f Daniel Lobato
require 'integration_test_helper'
c0005dcd Joseph Mitchell Magen
caffb7e8 Marek Hulán
class PuppetclassIntegrationTest < IntegrationTestWithJavascript
0132933a Daniel Lobato Garcia
# intermittent failures:
# PuppetclassIntegrationTest.test_0001_edit page

c0005dcd Joseph Mitchell Magen
test "edit page" do
visit puppetclasses_path
click_link "vim"
caffb7e8 Marek Hulán
assert page.has_no_link? 'Common'
find(:xpath, "//a[@data-original-title='Select All']").click
c0005dcd Joseph Mitchell Magen
assert_submit_button(puppetclasses_path)
de19f5b9 Ohad Levy
assert page.has_link? 'vim'
assert page.has_link? 'Common'
c0005dcd Joseph Mitchell Magen
end

dbf496e7 Shira Maximov
test 'verify key label exists in case key is too long' do
env_long = FactoryBot.create(:environment)
puppet_class_long = FactoryBot.create(:puppetclass, :environments => [env_long])
9d43fc71 Michael Moll
smart_class_parameter_long = FactoryBot.create(:puppetclass_lookup_key, :as_smart_class_param, :puppetclass => puppet_class_long, :variable => "a" * 50)
smart_variable_long = FactoryBot.create(:variable_lookup_key, :key_type => '', :puppetclass => puppet_class_long, :key => "c" * 50)
dbf496e7 Shira Maximov
visit edit_puppetclass_path(puppet_class_long)
click_link 'Smart Class Parameter'
assert_equal smart_class_parameter_long.key, page.find("#pill_#{smart_class_parameter_long.id}-#{smart_class_parameter_long.key}")['data-original-title']
click_link 'Smart Variables'
assert_equal smart_variable_long.key, page.find("#pill_#{smart_variable_long.id}-#{smart_variable_long.key}")['data-original-title']
end

test 'verify key label is empty in case key is short' do
env_short = FactoryBot.create(:environment)
puppet_class_short = FactoryBot.create(:puppetclass, :environments => [env_short])
9d43fc71 Michael Moll
smart_class_parameter_short = FactoryBot.create(:puppetclass_lookup_key, :as_smart_class_param, :puppetclass => puppet_class_short, :variable => "a" * 40)
smart_variable_short = FactoryBot.create(:variable_lookup_key, :key_type => '', :puppetclass => puppet_class_short, :key => "c" * 40)
dbf496e7 Shira Maximov
visit edit_puppetclass_path(puppet_class_short)
click_link 'Smart Class Parameter'
assert_empty page.find("#pill_#{smart_class_parameter_short.id}-#{smart_class_parameter_short.key}")['data-original-title']
click_link 'Smart Variables'
assert_empty page.find("#pill_#{smart_variable_short.id}-#{smart_variable_short.key}")['data-original-title']
end

c0005dcd Joseph Mitchell Magen
# PENDING
# test "smart variables" do
# end

# PENDING
# test "smart class parameters" do
# end
end