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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
implemented review feedback from @ulferts
Jonas Jabari114c38131c06
diff --git a/app/views/my/access_token_partials/_api_tokens_section.html.erb b/app/views/my/access_token_partials/_api_tokens_section.html.erbindex 9175fc794fe..490cfb90b46 100644--- a/app/views/my/access_token_partials/_api_tokens_section.html.erb+++ b/app/views/my/access_token_partials/_api_tokens_section.html.erb@@ -40,7 +40,7 @@ See COPYRIGHT and LICENSE files for more details.<% if api_token %><div class="generic-table--container"><div class="generic-table--results-container">- <table id="access-token-table" class="generic-table">+ <table class="generic-table"><%= render partial: "my/access_token_partials/token_table_header",locals: {column_headers: [@@ -52,7 +52,7 @@ See COPYRIGHT and LICENSE files for more details.%><tbody><tr>- <td style="width: 60%;"><%= t("my_account.access_tokens.api.static_token_name") %></td>+ <td style="width: 60%;" data-qa-selector="api-token-row-name"><%= t("my_account.access_tokens.api.static_token_name") %></td><td><span title="<%= format_time(api_token.created_at) %>"><%= format_time(api_token.created_at.to_s) %>@@ -63,7 +63,7 @@ See COPYRIGHT and LICENSE files for more details.<%= link_to "",{ action: 'revoke_api_key' },method: :delete,- data: { confirm: t('my_account.access_tokens.simple_revoke_confirmation') },+ data: { confirm: t('my_account.access_tokens.simple_revoke_confirmation'), qa_selector: 'api-token-revoke' },class: 'icon icon-delete' %></td></tr>@@ -72,7 +72,7 @@ See COPYRIGHT and LICENSE files for more details.</div></div><% else %>- <%= link_to({ action: 'generate_api_key' }, method: :post, class: 'spot-link') do %>+ <%= link_to({ action: 'generate_api_key' }, method: :post, class: 'spot-link', data: { qa_selector: 'api-token-add' }) do %><span class="spot-icon spot-icon_add"></span><span><%= t('my_account.access_tokens.api.static_token_name') %></span><% end %>diff --git a/app/views/my/access_token_partials/_icalendar_tokens_section.html.erb b/app/views/my/access_token_partials/_icalendar_tokens_section.html.erbindex 6cf9c3ad6c6..ecaf7b9bf75 100644--- a/app/views/my/access_token_partials/_icalendar_tokens_section.html.erb+++ b/app/views/my/access_token_partials/_icalendar_tokens_section.html.erb@@ -40,7 +40,7 @@ See COPYRIGHT and LICENSE files for more details.<% if ical_tokens_grouped_by_query.any? %><div class="generic-table--container"><div class="generic-table--results-container">- <table id="access-token-table" class="generic-table">+ <table class="generic-table"><%= render partial: "my/access_token_partials/token_table_header",locals: {column_headers: [@@ -56,8 +56,8 @@ See COPYRIGHT and LICENSE files for more details.<% ical_tokens_grouped_by_query.each do |query_id, tokens| %><% tokens.sort_by(&:created_at).each do |token| %><tr>- <td style="width: 20%;"><%= token.ical_token_query_assignment.name %></td>- <td style="width: 20%;">+ <td style="width: 20%;" data-qa-selector="ical-token-row-<%= token.id %>-name"><%= token.ical_token_query_assignment.name %></td>+ <td style="width: 20%;" data-qa-selector="ical-token-row-<%= token.id %>-query-name"><%= link_to token.query.name,project_calendar_url(id: query_id,@@ -65,7 +65,7 @@ See COPYRIGHT and LICENSE files for more details.)%></td>- <td style="width: 20%;">+ <td style="width: 20%;" data-qa-selector="ical-token-row-<%= token.id %>-project-name"><%= token.query.project.name %></td><td>@@ -77,7 +77,7 @@ See COPYRIGHT and LICENSE files for more details.<td style="text-align: right;"><%= link_to "",{ action: 'revoke_ical_token', id: token.id },- data: { confirm: t('my_account.access_tokens.simple_revoke_confirmation') },+ data: { confirm: t('my_account.access_tokens.simple_revoke_confirmation'), qa_selector: "ical-token-row-#{token.id}-revoke" },method: :delete,class: 'icon icon-delete' %></td>diff --git a/app/views/my/access_token_partials/_oauth_tokens_section.html.erb b/app/views/my/access_token_partials/_oauth_tokens_section.html.erbindex 50eca4d2f6b..23b6f04ae4f 100644--- a/app/views/my/access_token_partials/_oauth_tokens_section.html.erb+++ b/app/views/my/access_token_partials/_oauth_tokens_section.html.erb@@ -39,7 +39,7 @@ See COPYRIGHT and LICENSE files for more details.<% if granted_applications.any? %><div class="generic-table--container"><div class="generic-table--results-container">- <table id="access-token-table" class="generic-table">+ <table class="generic-table"><%= render partial: "my/access_token_partials/token_table_header",locals: {column_headers: [@@ -53,7 +53,7 @@ See COPYRIGHT and LICENSE files for more details.<% granted_applications.each do |application, tokens| %><% latest = tokens.sort_by(&:created_at).last %><tr id="oauth-application-grant-<%= application.id %>">- <td style="width: 60%;">+ <td style="width: 60%;" data-qa-selector="oauth-token-row-<%= application.id %>-name"><%= t('oauth.application.named', name: application.name) %> (<%= t('oauth.x_active_tokens', count: tokens.count) %>)@@ -68,7 +68,8 @@ See COPYRIGHT and LICENSE files for more details.<%= link_to "",revoke_my_oauth_application_path(application_id: application.id),data: { confirm: t('oauth.revoke_my_application_confirmation',- token_count: t('oauth.x_active_tokens', count: tokens.count)) },+ token_count: t('oauth.x_active_tokens', count: tokens.count)),+ qa_selector: "oauth-token-row-#{application.id}-revoke" },method: :post,class: 'icon icon-delete' %></td>diff --git a/app/views/my/access_token_partials/_rss_tokens_section.html.erb b/app/views/my/access_token_partials/_rss_tokens_section.html.erbindex ca9b61d927e..f3f1393dc53 100644--- a/app/views/my/access_token_partials/_rss_tokens_section.html.erb+++ b/app/views/my/access_token_partials/_rss_tokens_section.html.erb@@ -40,7 +40,7 @@ See COPYRIGHT and LICENSE files for more details.<% if rss_token %><div class="generic-table--container"><div class="generic-table--results-container">- <table id="access-token-table" class="generic-table">+ <table class="generic-table"><%= render partial: "my/access_token_partials/token_table_header",locals: {column_headers: [@@ -52,7 +52,7 @@ See COPYRIGHT and LICENSE files for more details.%><tbody><tr>- <td style="width: 60%;"><%= t("my_account.access_tokens.rss.static_token_name") %></td>+ <td style="width: 60%;" data-qa-selector="rss-token-row-name"><%= t("my_account.access_tokens.rss.static_token_name") %></td><td><span title="<%= format_time(rss_token.created_at) %>"><%= format_time(rss_token.created_at.to_s) %>@@ -63,7 +63,7 @@ See COPYRIGHT and LICENSE files for more details.<%= link_to "",{ action: 'revoke_rss_key' },method: :delete,- data: { confirm: t('my_account.access_tokens.simple_revoke_confirmation') },+ data: { confirm: t('my_account.access_tokens.simple_revoke_confirmation'), qa_selector: 'rss-token-revoke' },class: 'icon icon-delete' %></td></tr>@@ -72,7 +72,7 @@ See COPYRIGHT and LICENSE files for more details.</div></div><% else %>- <%= link_to({ action: 'generate_rss_key' }, method: :post, class: 'spot-link') do %>+ <%= link_to({ action: 'generate_rss_key' }, method: :post, class: 'spot-link', data: { qa_selector: 'rss-token-add' }) do %><span class="spot-icon spot-icon_add"></span><span><%= t('my_account.access_tokens.rss.static_token_name') %></span><% end %>diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 39a5a1e5983..e52f4ba963d 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1537,7 +1537,7 @@ en:oauth:title: "OAuth"text_hint: "OAuth tokens allow third-party applications to connect with this OpenProject instance."- empty_text_hint: "There is no third-party application access configured and active for you. Please contact your administrator."+ empty_text_hint: "There is no third-party application access configured and active for you. Please contact your administrator to activate this feature."rss:title: "RSS"text_hint: "RSS tokens allow users to keep up with the latest changes in this OpenProject instance via an external RSS reader."diff --git a/spec/features/users/my_spec.rb b/spec/features/users/my_spec.rbindex 702e424a16b..115d4e79053 100644--- a/spec/features/users/my_spec.rb+++ b/spec/features/users/my_spec.rb@@ -131,7 +131,7 @@ RSpec.describe 'my', js: true, with_cuprite: true dowithin '#api-token-section' doexpect(page).to have_content('API tokens are not enabled by the administrator.')- expect(page).not_to have_xpath("//a//span[text()='API token']")+ expect(page).not_to have_selector("[data-qa-selector='api-token-add']", text: 'API token')endendend@@ -143,8 +143,8 @@ RSpec.describe 'my', js: true, with_cuprite: true doexpect(page).not_to have_content('API tokens are not enabled by the administrator.')within '#api-token-section' do- expect(page).to have_xpath("//a//span[text()='API token']")- find(:xpath, "//a//span[text()='API token']").click+ expect(page).to have_selector("[data-qa-selector='api-token-add']", text: 'API token')+ find("[data-qa-selector='api-token-add']").clickendexpect(page).to have_content 'A new API token has been generated. Your access token is'@@ -154,14 +154,13 @@ RSpec.describe 'my', js: true, with_cuprite: true do# only one API token can be createdwithin '#api-token-section' do- expect(page).not_to have_xpath("//a//span[text()='API token']")+ expect(page).not_to have_selector("[data-qa-selector='api-token-add']", text: 'API token')end# revoke API tokenwithin '#api-token-section' do- expect(page).to have_css("a.icon-delete")accept_confirm do- find("a.icon-delete").click+ find("[data-qa-selector='api-token-revoke']").clickendend@@ -172,7 +171,7 @@ RSpec.describe 'my', js: true, with_cuprite: true do# API token can be created againwithin '#api-token-section' do- expect(page).to have_xpath("//a//span[text()='API token']")+ expect(page).to have_selector("[data-qa-selector='api-token-add']", text: 'API token')endendend@@ -185,7 +184,7 @@ RSpec.describe 'my', js: true, with_cuprite: true dowithin '#rss-token-section' doexpect(page).to have_content('RSS tokens are not enabled by the administrator.')- expect(page).not_to have_xpath("//a//span[text()='RSS token']")+ expect(page).not_to have_selector("[data-qa-selector='rss-token-add']", text: 'RSS token')endendend@@ -197,8 +196,8 @@ RSpec.describe 'my', js: true, with_cuprite: true doexpect(page).not_to have_content('RSS tokens are not enabled by the administrator.')within '#rss-token-section' do- expect(page).to have_xpath("//a//span[text()='RSS token']")- find(:xpath, "//a//span[text()='RSS token']").click+ expect(page).to have_selector("[data-qa-selector='rss-token-add']", text: 'RSS token')+ find("[data-qa-selector='rss-token-add']").clickendexpect(page).to have_content 'A new RSS token has been generated. Your access token is'@@ -208,14 +207,13 @@ RSpec.describe 'my', js: true, with_cuprite: true do# only one RSS token can be createdwithin '#rss-token-section' do- expect(page).not_to have_xpath("//a//span[text()='RSS token']")+ expect(page).not_to have_selector("[data-qa-selector='rss-token-add']", text: 'RSS token')end# revoke RSS tokenwithin '#rss-token-section' do- expect(page).to have_css("a.icon-delete")accept_confirm do- find("a.icon-delete").click+ find("[data-qa-selector='rss-token-revoke']").clickendend@@ -226,7 +224,7 @@ RSpec.describe 'my', js: true, with_cuprite: true do# RSS token can be created againwithin '#rss-token-section' do- expect(page).to have_xpath("//a//span[text()='RSS token']")+ expect(page).to have_selector("[data-qa-selector='rss-token-add']", text: 'RSS token')endendend@@ -275,23 +273,20 @@ RSpec.describe 'my', js: true, with_cuprite: true do].each do |ical_token|token_name = ical_token.ical_token_query_assignment.namequery = ical_token.ical_token_query_assignment.query- row_xpath = "//tr[td[1][contains(text(), '#{token_name}')]]"- expect(page).to have_xpath("#{row_xpath}/td[1]", text: token_name)- expect(page).to have_xpath("#{row_xpath}/td[2]/a", text: query.name)- expect(page).to have_xpath("#{row_xpath}/td[3]", text: query.project.name)+ expect(page).to have_selector("[data-qa-selector='ical-token-row-#{ical_token.id}-name']", text: token_name)+ expect(page).to have_selector("[data-qa-selector='ical-token-row-#{ical_token.id}-query-name']", text: query.name)+ expect(page).to have_selector("[data-qa-selector='ical-token-row-#{ical_token.id}-project-name']", text: query.project.name)endendendit 'single iCalendar tokens can be deleted' dovisit my_access_token_path- token_name = ical_token_for_query.ical_token_query_assignment.name- row_xpath = "//tr[td[1][contains(text(), '#{token_name}')]]"within '#icalendar-token-section' doaccept_confirm do- find(:xpath, "#{row_xpath}/td//a[@class='icon icon-delete']").click+ find("[data-qa-selector='ical-token-row-#{ical_token_for_query.id}-revoke']").clickendend@@ -301,7 +296,7 @@ RSpec.describe 'my', js: true, with_cuprite: true dovisit my_access_token_pathwithin '#icalendar-token-section' do- expect(page).not_to have_xpath("#{row_xpath}/td//a[@class='icon icon-delete']")+ expect(page).not_to have_selector("[data-qa-selector='ical-token-row-#{ical_token_for_query.id}-revoke']")endendend@@ -348,8 +343,8 @@ RSpec.describe 'my', js: true, with_cuprite: true do[app, second_app].each do |app|within '#oauth-token-section' do- expect(page).to have_xpath("//tr[td[1][contains(text(), '#{app.name}')]]")- expect(page).to have_xpath("//tr[td[1][contains(text(), '(one active token)')]]")+ expect(page).to have_selector("[data-qa-selector='oauth-token-row-#{app.id}-name']", text: app.name)+ expect(page).to have_selector("[data-qa-selector='oauth-token-row-#{app.id}-name']", text: '(one active token)')endendend@@ -358,11 +353,9 @@ RSpec.describe 'my', js: true, with_cuprite: true dovisit my_access_token_path[app, second_app].each do |app|- row_xpath = "//tr[td[1][contains(text(), '#{app.name}')]]"-within '#oauth-token-section' doaccept_confirm do- find(:xpath, "#{row_xpath}/td//a[@class='icon icon-delete']").click+ find("[data-qa-selector='oauth-token-row-#{app.id}-revoke']").clickendendend@@ -371,9 +364,8 @@ RSpec.describe 'my', js: true, with_cuprite: true dovisit my_access_token_path[app, second_app].each do |app|- row_xpath = "//tr[td[1][contains(text(), '#{app.name}')]]"within '#oauth-token-section' do- expect(page).not_to have_xpath("#{row_xpath}/td//a[@class='icon icon-delete']")+ expect(page).not_to have_selector("[data-qa-selector='oauth-token-row-#{app.id}-revoke']")endendend@@ -396,8 +388,8 @@ RSpec.describe 'my', js: true, with_cuprite: true do[app, second_app].each do |app|within '#oauth-token-section' do- expect(page).to have_xpath("//tr[td[1][contains(text(), '#{app.name}')]]")- expect(page).to have_xpath("//tr[td[1][contains(text(), '(2 active token)')]]")+ expect(page).to have_selector("[data-qa-selector='oauth-token-row-#{app.id}-name']", text: app.name)+ expect(page).to have_selector("[data-qa-selector='oauth-token-row-#{app.id}-name']", text: '(2 active token)')endendend@@ -405,11 +397,9 @@ RSpec.describe 'my', js: true, with_cuprite: true doit 'can revoke mutliple tokens per app' dovisit my_access_token_path- row_xpath = "//tr[td[1][contains(text(), '#{app.name}')]]"-within '#oauth-token-section' doaccept_confirm do- find(:xpath, "#{row_xpath}/td//a[@class='icon icon-delete']").click+ find("[data-qa-selector='oauth-token-row-#{app.id}-revoke']").clickendend@@ -417,7 +407,7 @@ RSpec.describe 'my', js: true, with_cuprite: true dovisit my_access_token_pathwithin '#oauth-token-section' do- expect(page).not_to have_xpath("#{row_xpath}/td//a[@class='icon icon-delete']")+ expect(page).not_to have_selector("[data-qa-selector='oauth-token-row-#{app.id}-revoke']")endendend