19177: Adds test to wb1 for sharing link button hideability.
[arvados.git] / apps / workbench / test / integration / collections_test.rb
index e7b27fff86377c4013a216bc897bf1cc7016b7f4..1edfc10505e0b1d321adaf9859a6847c59c95ad3 100644 (file)
@@ -41,11 +41,19 @@ class CollectionsTest < ActionDispatch::IntegrationTest
     send(link_assertion, all("a").select { |a| a[:href] =~ link_regexp })
   end
 
+  test "Hides sharing link button when configured to do so" do
+    Rails.configuration.Workbench.DisableSharingURLsUI = true
+    coll_uuid = api_fixture("collections", "collection_owned_by_active", "uuid")
+    visit page_with_token("active_trustedclient", "/collections/#{coll_uuid}")
+    assert_no_selector 'input', text: 'Create sharing link'
+  end
+
   test "creating and uncreating a sharing link" do
     coll_uuid = api_fixture("collections", "collection_owned_by_active", "uuid")
     download_link_re =
       Regexp.new(Regexp.escape("/c=#{coll_uuid}/"))
     visit page_with_token("active_trustedclient", "/collections/#{coll_uuid}")
+    assert_selector 'input', text: 'Create sharing link'
     within "#sharing-button" do
       check_sharing(:on, download_link_re)
       check_sharing(:off, download_link_re)