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

Merge remote-tracking branch 'origin/release/13.0' into dev

ulferts31b52f52497e
diff --cc docs/release-notes/README.md
index 78523647d26,20ed43d5c0d..fd29f7cf7e8
--- a/docs/release-notes/README.md
+++ b/docs/release-notes/README.md
@@@ -76,4 -83,4 +83,3 @@@ Release date: 2023-08-2
| [5.x](5/) | 2015 / 2016 |
| [4.x](4/) | 2014 / 2015 |
| [3.x](3/) | 2014 / 2015 |
--
diff --cc modules/storages/spec/factories/storage_factory.rb
index 06d534de83c,95e8b92a945..7f10d56c559
--- a/modules/storages/spec/factories/storage_factory.rb
+++ b/modules/storages/spec/factories/storage_factory.rb
@@@ -29,110 -27,28 +29,114 @@@
#++
FactoryBot.define do
- factory :storage, class: '::Storages::Storage' do
- provider_type { Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }
+ factory :storage, class: 'Storages::Storage' do
sequence(:name) { |n| "Storage #{n}" }
- sequence(:host) { |n| "https://host#{n}.example.com" }
creator factory: :user
+ # rubocop:disable FactoryBot/FactoryAssociationWithStrategy
+ # For some reason the order of saving breaks STI
+ trait :with_oauth_client do
+ oauth_client { build(:oauth_client) }
+ end
+
+ trait :as_generic do
+ provider_type { 'Storages::Storage' }
+ end
++
+ trait :as_generic do
+ provider_type { 'Storages::Storage' }
+ end
+ end
+
+ factory :nextcloud_storage,
+ parent: :storage,
+ class: '::Storages::NextcloudStorage' do
+ provider_type { Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }
+ sequence(:host) { |n| "https://host#{n}.example.com" }
+
+ trait :as_automatically_managed do
+ automatically_managed { true }
+ username { 'OpenProject' }
+ password { 'Password123' }
+ end
+
+ trait :as_not_automatically_managed do
+ automatically_managed { false }
+ end
+ end
+
+ factory :nextcloud_storage_with_local_connection,
+ parent: :nextcloud_storage,
+ traits: [:as_not_automatically_managed] do
+ transient do
+ oauth_client_token_user { association :user }
+ end
+
+ name { 'Nextcloud Local' }
+ host { 'https://nextcloud.local' }
+
+ initialize_with do
+ Storages::NextcloudStorage.create_or_find_by(attributes.except(:oauth_client, :oauth_application))
+ end
+
+ after(:create) do |storage, evaluator|
+ create(:oauth_client,
+ client_id: ENV.fetch('NEXTCLOUD_LOCAL_OAUTH_CLIENT_ID', 'MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_ID'),
+ client_secret: ENV.fetch('NEXTCLOUD_LOCAL_OAUTH_CLIENT_SECRET', 'MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_SECRET'),
+ integration: storage)
+
+ create(:oauth_application,
+ uid: ENV.fetch('NEXTCLOUD_LOCAL_OPENPROJECT_UID', 'MISSING_NEXTCLOUD_LOCAL_OPENPROJECT_UID'),
+ secret: ENV.fetch('NEXTCLOUD_LOCAL_OPENPROJECT_SECRET', 'MISSING_NEXTCLOUD_LOCAL_OPENPROJECT_SECRET'),
+ redirect_uri: ENV.fetch('NEXTCLOUD_LOCAL_OPENPROJECT_REDIRECT_URI',
+ "https://nextcloud.local/index.php/apps/integration_openproject/oauth-redirect"),
+ scopes: 'api_v3',
+ integration: storage)
+
+ create(:oauth_client_token,
+ oauth_client: storage.oauth_client,
+ user: evaluator.oauth_client_token_user,
+ access_token: ENV.fetch('NEXTCLOUD_LOCAL_OAUTH_CLIENT_ACCESS_TOKEN',
+ 'MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_ACCESS_TOKEN'),
+ refresh_token: ENV.fetch('NEXTCLOUD_LOCAL_OAUTH_CLIENT_REFRESH_TOKEN',
+ 'MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_REFRESH_TOKEN'),
+ token_type: 'bearer',
+ origin_user_id: 'admin')
+ end
+ end
+
+ factory :one_drive_storage,
+ parent: :storage,
+ class: '::Storages::OneDriveStorage' do
+ host { nil }
+ end
+
+ factory :sharepoint_dev_drive_storage,
+ parent: :one_drive_storage do
+ transient do
+ oauth_client_token_user { association :user }
+ end
- factory :nextcloud_storage, class: '::Storages::NextcloudStorage' do
- provider_type { Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }
+ name { 'Sharepoint VCR drive' }
+ tenant_id { ENV.fetch('ONE_DRIVE_TEST_TENANT_ID', '4d44bf36-9b56-45c0-8807-bbf386dd047f') }
+ drive_id { ENV.fetch('ONE_DRIVE_TEST_DRIVE_ID', 'b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs') }
- trait :as_automatically_managed do
- automatically_managed { true }
- username { 'OpenProject' }
- password { 'Password123' }
- end
+ after(:create) do |storage, evaluator|
+ create(:oauth_client,
+ client_id: ENV.fetch('ONE_DRIVE_TEST_OAUTH_CLIENT_ID', 'MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_ID'),
+ client_secret: ENV.fetch('ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET',
+ 'MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET'),
+ integration: storage)
- trait :as_not_automatically_managed do
- automatically_managed { false }
- end
+ create(:oauth_client_token,
+ oauth_client: storage.oauth_client,
+ user: evaluator.oauth_client_token_user,
+ access_token: ENV.fetch('ONE_DRIVE_TEST_OAUTH_CLIENT_ACCESS_TOKEN',
+ 'MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_ACCESS_TOKEN'),
+ refresh_token: ENV.fetch('ONE_DRIVE_TEST_OAUTH_CLIENT_REFRESH_TOKEN',
+ 'MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_REFRESH_TOKEN'),
+ token_type: 'bearer',
+ origin_user_id: 'admin')
end
end
end
diff --cc spec/features/work_packages/attachments/attachment_upload_spec.rb
index 04aee2abc67,2745c41e031..cdd96f1cccc
--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb
+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb
@@@ -313,15 -278,12 +313,18 @@@ RSpec.describe 'Upload attachment to wo
##
# Attach file manually
- expect(page).not_to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]')
+ expect(page).not_to have_test_selector('op-files-tab--file-list-item-title')
attachments.attach_file_on_input(image_fixture.path)
editor.wait_until_upload_progress_toaster_cleared
- expect(page).to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'image.png', wait: 5)
+ expect(page)
+ .to have_test_selector('op-files-tab--file-list-item-title',
+ text: 'image.png',
+ wait: 5)
+
+ # Drop zone should become hidden again
++ expect(container).not_to be_visible
+
+ # Drop zone should become hidden again
expect(container).not_to be_visible
##