Skip to content

Commit

Permalink
Add basic smoke tests to verify cms admin pages are being rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
murny committed Jun 18, 2024
1 parent 447961a commit 2eccca8
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions test/integration/cms_admin_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# frozen_string_literal: true

require "test_helper"

class CmsAdminTest < ActionDispatch::IntegrationTest
test "/admin url" do
get comfy_admin_cms_path,
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)}

assert_response :redirect
assert_redirected_to comfy_admin_cms_site_pages_path(site_id: Comfy::Cms::Site.first)
end

test "admin site" do
get comfy_admin_cms_sites_path,
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)}

assert_response :success
assert_select "h2", "Sites"
end

test "admin site pages" do
get comfy_admin_cms_site_pages_path(site_id: Comfy::Cms::Site.first),
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)}

assert_response :success
assert_select "h2", "Pages"
end

test "admin site layouts" do
get comfy_admin_cms_site_layouts_path(site_id: Comfy::Cms::Site.first),
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)}

assert_response :success
assert_select "h2", "Layouts"
end

test "admin site snippets" do
get comfy_admin_cms_site_snippets_path(site_id: Comfy::Cms::Site.first),
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)}

assert_response :success
assert_select "h2", "Snippets"
end

test "admin site files" do
get comfy_admin_cms_site_files_path(site_id: Comfy::Cms::Site.first),
headers: {Authorization: ActionController::HttpAuthentication::Basic.encode_credentials(Rails.application.secrets.cms_user, Rails.application.secrets.cms_password)}

assert_response :success
assert_select "h2", "Files"
end
end

0 comments on commit 2eccca8

Please sign in to comment.