-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Robert Waffen <rw@betadots.de>
- Loading branch information
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
require "test_helper" | ||
|
||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase | ||
driven_by :selenium, using: :chrome, screen_size: [1400, 1400] | ||
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400] | ||
|
||
private | ||
|
||
def slim_select(value, from:) | ||
select = find("select[name=\"#{from}\"]", visible: false) | ||
slim_select_main = select.sibling("div[class=ss-main]") | ||
slim_select_main.click | ||
option = find("div[class=ss-option]", text: value) | ||
option.click | ||
page.has_css?("div[class=ss-single]", text: value) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require "application_system_test_case" | ||
|
||
class AccessNodesKeysTest < ApplicationSystemTestCase | ||
setup do | ||
Rails.configuration.hdm[:authentication_disabled] = true | ||
end | ||
|
||
teardown do | ||
Rails.configuration.hdm[:authentication_disabled] = false | ||
end | ||
|
||
test "accessing a key of a node" do | ||
visit root_url | ||
|
||
click_on "Show Environments" | ||
|
||
slim_select "development", from: "environment" | ||
|
||
slim_select "testhost (development)", from: "node" | ||
|
||
click_on "hdm::integer" | ||
|
||
click_on "common.yaml" | ||
|
||
assert has_css?("textarea[name=value]", text: "1") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require "application_system_test_case" | ||
|
||
class SearchKeyTest < ApplicationSystemTestCase | ||
setup do | ||
Rails.configuration.hdm[:authentication_disabled] = true | ||
end | ||
|
||
teardown do | ||
Rails.configuration.hdm[:authentication_disabled] = false | ||
end | ||
|
||
test "searching for a key" do | ||
visit root_url | ||
|
||
click_on "Show Environments" | ||
|
||
slim_select "development", from: "environment" | ||
|
||
fill_in "key", with: "hdm::integer\n" | ||
|
||
assert has_css?("h2", text: "Search Results") | ||
|
||
click_on "Eyaml hierarchy" | ||
|
||
click_on Rails.root.join("test/fixtures/files/puppet/environments/development/data/common.yaml").to_s | ||
|
||
assert has_css?(".accordion-body pre", text: "1") | ||
end | ||
end |