Commit 7629b929 authored by Stan Hu's avatar Stan Hu

Fix flaky create_snippet_spec.rb

This spec was failing intermittently because the empty state SVG would
be lazily loaded, causing the "New snippet" button to shift
momentarily. Capybara would attempt to click on the coordinates of the
original button, but nothing would happen.

To make this test more robust, wait for the image to load before
attempting to click on the button.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/209892
parent a25a023f
......@@ -32,6 +32,8 @@ shared_examples_for 'snippet editor' do
visit project_snippets_path(project)
# Wait for the SVG to ensure the button location doesn't shift
within('.empty-state') { find('img.js-lazy-loaded') }
click_on('New snippet')
wait_for_requests
end
......
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