Commit 2aa0c849 authored by Stan Hu's avatar Stan Hu

Attempt to make signed_commits_spec.rb less flaky

The examples in this spec often attempt to click a popover before the
JavaScript handler is initialized. Since we don't have a good way to
detect when initialization has completed, we wait for all requests to
finish in an attempt to give the page more time to load before
attempting to click.

This won't guarantee that it solves the problem--we'd have to have some
indicator like a newly-added class--but hopefully this will work around
the problem for now.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/216530
parent 141c6ecd
......@@ -72,6 +72,7 @@ RSpec.describe 'GPG signed commits' do
it 'unverified signature' do
visit project_commit_path(project, GpgHelpers::SIGNED_COMMIT_SHA)
wait_for_all_requests
page.find('.gpg-status-box', text: 'Unverified').click
......@@ -85,6 +86,7 @@ RSpec.describe 'GPG signed commits' do
user_2_key
visit project_commit_path(project, GpgHelpers::DIFFERING_EMAIL_SHA)
wait_for_all_requests
page.find('.gpg-status-box', text: 'Unverified').click
......@@ -100,6 +102,7 @@ RSpec.describe 'GPG signed commits' do
user_2_key
visit project_commit_path(project, GpgHelpers::SIGNED_COMMIT_SHA)
wait_for_all_requests
page.find('.gpg-status-box', text: 'Unverified').click
......@@ -115,6 +118,7 @@ RSpec.describe 'GPG signed commits' do
user_1_key
visit project_commit_path(project, GpgHelpers::SIGNED_AND_AUTHORED_SHA)
wait_for_all_requests
page.find('.gpg-status-box', text: 'Verified').click
......@@ -130,6 +134,7 @@ RSpec.describe 'GPG signed commits' do
user_1_key
visit project_commit_path(project, GpgHelpers::SIGNED_AND_AUTHORED_SHA)
wait_for_all_requests
# wait for the signature to get generated
expect(page).to have_selector('.gpg-status-box', text: 'Verified')
......@@ -137,6 +142,7 @@ RSpec.describe 'GPG signed commits' do
user_1.destroy!
refresh
wait_for_all_requests
page.find('.gpg-status-box', text: 'Verified').click
......@@ -153,6 +159,7 @@ RSpec.describe 'GPG signed commits' do
shared_examples 'a commit with a signature' do
before do
visit project_tree_path(project, 'signed-commits')
wait_for_all_requests
end
it 'displays commit signature' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment