From 2d3f18a71b6ed111fa33589fe83ff20a65386af4 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 3 Jul 2025 16:32:07 +1000 Subject: [PATCH] Load DFC Permissions module in system spec But we can't access the inside of the component yet. --- .../admin/enterprises/dfc_permissions_spec.rb | 32 +++++++++++++++++++ spec/system/support/cuprite_setup.rb | 7 ++++ 2 files changed, 39 insertions(+) create mode 100644 spec/system/admin/enterprises/dfc_permissions_spec.rb diff --git a/spec/system/admin/enterprises/dfc_permissions_spec.rb b/spec/system/admin/enterprises/dfc_permissions_spec.rb new file mode 100644 index 0000000000..8f84d072da --- /dev/null +++ b/spec/system/admin/enterprises/dfc_permissions_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require "system_helper" + +RSpec.describe "DFC Permissions", feature: "cqcm-dev", vcr: true do + let(:enterprise) { create(:enterprise) } + + before do + login_as enterprise.owner + end + + it "is not visible when no platform is enabled" do + Flipper.disable("cqcm-dev") + visit edit_admin_enterprise_path(enterprise) + expect(page).not_to have_content "CONNECTED APPS" + end + + it "can share data with another platform" do + visit edit_admin_enterprise_path(enterprise) + + scroll_to :bottom + click_link "Connected apps" + + # TODO: interact with shadow root of web component + # + # expect(page).to have_content "Proxy Dev Portal" + # expect(page).to have_selector "svg.unchecked" # permission not granted + + # click_on "Agree and share" + # expect(page).to have_selector "svg.checked" # permission granted + end +end diff --git a/spec/system/support/cuprite_setup.rb b/spec/system/support/cuprite_setup.rb index 6d44e72ba3..1d5c195b0c 100644 --- a/spec/system/support/cuprite_setup.rb +++ b/spec/system/support/cuprite_setup.rb @@ -20,6 +20,12 @@ Capybara.register_driver(:cuprite_ofn) do |app| url_whitelist: [ %r{^http://localhost}, %r{^http://0.0.0.0}, %r{http://127.0.0.1}, + # Testing the DFC Permissions component by Startin'Blox: + %r{^https://cdn.jsdelivr.net/npm/@startinblox/}, + %r{^https://cdn.startinblox.com/}, + %r{^https://data-server.cqcm.startinblox.com/scopes$}, + %r{^https://api.proxy-dev.cqcm.startinblox.com/profile$}, + # Just for testing external connections: spec/system/billy_spec.rb %r{^https?://deb.debian.org}, ], @@ -44,6 +50,7 @@ RSpec.configure do |config| original_host = Rails.application.default_url_options[:host] Rails.application.default_url_options[:host] = "#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}" + DfcProvider::Engine.routes.default_url_options = Rails.application.default_url_options example.run Rails.application.default_url_options[:host] = original_host remove_downloaded_files