Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

tests[Op#56922]: update feature context with login modal

Kabiru Mwenjaa61726421923
diff --git a/modules/storages/spec/features/storages/admin/project_storages_spec.rb b/modules/storages/spec/features/storages/admin/project_storages_spec.rb
index d41c7941ad3..c51aab3263f 100644
--- a/modules/storages/spec/features/storages/admin/project_storages_spec.rb
+++ b/modules/storages/spec/features/storages/admin/project_storages_spec.rb
@@ -46,6 +46,11 @@ RSpec.describe "Admin lists project mappings for a storage",
shared_let(:archived_project) { create(:project, active: false, name: "My archived Project") }
shared_let(:storage) { create(:nextcloud_storage_with_complete_configuration, name: "My Nextcloud Storage") }
shared_let(:project_storage) { create(:project_storage, project:, storage:, project_folder_mode: "automatic") }
+ shared_let(:oauth_client_token) { create(:oauth_client_token, oauth_client: storage.oauth_client, user: admin) }
+
+ shared_let(:remote_identity) do
+ create(:remote_identity, oauth_client: storage.oauth_client, user: admin, origin_user_id: "admin")
+ end
shared_let(:archived_project_project_storage) do
create(:project_storage, project: archived_project, storage:, project_folder_mode: "inactive")
@@ -55,7 +60,6 @@ RSpec.describe "Admin lists project mappings for a storage",
current_user { admin }
-
context "with insufficient permissions" do
it "is not accessible" do
login_as(non_admin)
@@ -86,7 +90,7 @@ RSpec.describe "Admin lists project mappings for a storage",
end
end
- context "with sufficient permissions and an completely configured storage" do
+ context "with sufficient permissions and a completely configured storage" do
before do
login_as(admin)
storage.update!(host: "https://example.com")
@@ -180,10 +184,6 @@ RSpec.describe "Admin lists project mappings for a storage",
describe "Linking a project to a storage with a manually managed folder" do
context "when the user has granted OAuth access" do
- let(:oauth_client_token) { create(:oauth_client_token, oauth_client: storage.oauth_client, user: admin) }
- let(:remote_identity) do
- create(:remote_identity, oauth_client: storage.oauth_client, user: admin, origin_user_id: "admin")
- end
let(:location_picker) { Components::FilePickerDialog.new }
let(:root_xml_response) { build(:webdav_data) }
@@ -205,9 +205,6 @@ RSpec.describe "Admin lists project mappings for a storage",
end
before do
- oauth_client_token
- remote_identity
-
stub_request(:propfind, "#{storage.host}/remote.php/dav/files/#{remote_identity.origin_user_id}")
.to_return(status: 207, body: root_xml_response, headers: {})
stub_request(:propfind, "#{storage.host}/remote.php/dav/files/#{remote_identity.origin_user_id}/Folder1")
@@ -296,17 +293,15 @@ RSpec.describe "Admin lists project mappings for a storage",
end
context "when the user has not granted oauth access" do
- before do
+ it "show a storage login button" do
OAuthClientToken.where(user: admin, oauth_client: storage.oauth_client).destroy_all
- end
- it "show a storage login button" do
click_on "Add projects"
within("dialog") do
- choose "Existing folder with manually managed permissions"
- wait_for(page).to have_button("Nextcloud login")
- click_on("Nextcloud login")
+ wait_for(page).to have_button("Login")
+ click_on("Login")
+
wait_for(page).to have_current_path(
%r{/index.php/apps/oauth2/authorize\?client_id=.*&redirect_uri=.*&response_type=code&state=.*}
)