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#52605]: update feature tests to assert against final storage path

Kabiru Mwenjaa81be7774821
diff --git a/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb b/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb
index 4f29845114f..18e74a65695 100644
--- a/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb
+++ b/modules/storages/spec/features/storages/project_settings/oauth_access_grant_spec.rb
@@ -54,6 +54,16 @@ RSpec.describe 'OAuth Access Grant Nudge upon adding a storage to a project',
current_user { user }
+ let(:nonce) { '57a17c3f-b2ed-446e-9dd8-651ba3aec37d' }
+ let(:redirect_uri) do
+ "#{CGI.escape(OpenProject::Application.root_url)}/oauth_clients/#{storage.oauth_client.client_id}/callback"
+ end
+
+ before do
+ allow(SecureRandom).to receive(:uuid).and_call_original.ordered
+ allow(SecureRandom).to receive(:uuid).and_return(nonce).ordered
+ end
+
it 'adds a storage, nudges the project admin to grant OAuth access' do
visit project_settings_project_storages_path(project_id: project)
@@ -62,11 +72,9 @@ RSpec.describe 'OAuth Access Grant Nudge upon adding a storage to a project',
expect(page).to have_select('Storage', options: ["#{storage.name} (nextcloud)"])
click_on('Continue')
- # by default automatic have to be choosen if storage has automatic management enabled
expect(page).to have_checked_field("New folder with automatically managed permissions")
click_on('Add')
- # The list of enabled file storages should now contain Storage 1
expect(page).to have_text('File storages available in this project')
expect(page).to have_text(storage.name)
@@ -74,9 +82,8 @@ RSpec.describe 'OAuth Access Grant Nudge upon adding a storage to a project',
expect(page).to be_axe_clean
expect(page).to have_text('One more step...')
click_on('Login')
-
- expect(page).to have_text("Requesting access to #{storage.name}")
- expect(page).to be_axe_clean
+ wait_for(page).to have_current_path("/index.php/apps/oauth2/authorize?client_id=#{storage.oauth_client.client_id}&" \
+ "redirect_uri=#{redirect_uri}&response_type=code&state=#{nonce}")
end
end
end