Commit e0883014 authored by Clement Ho's avatar Clement Ho

Merge branch...

Merge branch '34245-flaky-test-spec-features-search-user_uses_header_search_field_spec-rb' into 'master'

Resolve "Flaky test: spec/features/search/user_uses_header_search_field_spec.rb"

Closes #34245

See merge request gitlab-org/gitlab!18742
parents ec847cfd 598ccd17
...@@ -95,10 +95,10 @@ export class SearchAutocomplete { ...@@ -95,10 +95,10 @@ export class SearchAutocomplete {
this.createAutocomplete(); this.createAutocomplete();
} }
this.searchInput.addClass('disabled');
this.saveTextLength(); this.saveTextLength();
this.bindEvents(); this.bindEvents();
this.dropdownToggle.dropdown(); this.dropdownToggle.dropdown();
this.searchInput.addClass('js-autocomplete-disabled');
} }
// Finds an element inside wrapper element // Finds an element inside wrapper element
...@@ -338,7 +338,7 @@ export class SearchAutocomplete { ...@@ -338,7 +338,7 @@ export class SearchAutocomplete {
if (!this.dropdown.hasClass('show')) { if (!this.dropdown.hasClass('show')) {
this.loadingSuggestions = false; this.loadingSuggestions = false;
this.dropdownToggle.dropdown('toggle'); this.dropdownToggle.dropdown('toggle');
return this.searchInput.removeClass('disabled'); return this.searchInput.removeClass('js-autocomplete-disabled');
} }
} }
...@@ -432,8 +432,8 @@ export class SearchAutocomplete { ...@@ -432,8 +432,8 @@ export class SearchAutocomplete {
} }
disableAutocomplete() { disableAutocomplete() {
if (!this.searchInput.hasClass('disabled') && this.dropdown.hasClass('show')) { if (!this.searchInput.hasClass('js-autocomplete-disabled') && this.dropdown.hasClass('show')) {
this.searchInput.addClass('disabled'); this.searchInput.addClass('js-autocomplete-disabled');
this.dropdown.removeClass('show').trigger('hidden.bs.dropdown'); this.dropdown.removeClass('show').trigger('hidden.bs.dropdown');
this.restoreMenu(); this.restoreMenu();
} }
......
...@@ -83,6 +83,7 @@ This was originally implemented in: <https://gitlab.com/gitlab-org/gitlab-foss/m ...@@ -83,6 +83,7 @@ This was originally implemented in: <https://gitlab.com/gitlab-org/gitlab-foss/m
- In JS tests, shifting elements can cause Capybara to misclick when the element moves at the exact time Capybara sends the click - In JS tests, shifting elements can cause Capybara to misclick when the element moves at the exact time Capybara sends the click
- [Dropdowns rendering upward or downward due to window size and scroll position](https://gitlab.com/gitlab-org/gitlab/merge_requests/17660) - [Dropdowns rendering upward or downward due to window size and scroll position](https://gitlab.com/gitlab-org/gitlab/merge_requests/17660)
- [Lazy loaded images can cause Capybara to misclick](https://gitlab.com/gitlab-org/gitlab/merge_requests/18713) - [Lazy loaded images can cause Capybara to misclick](https://gitlab.com/gitlab-org/gitlab/merge_requests/18713)
- [Triggering JS events before the event handlers are set up](https://gitlab.com/gitlab-org/gitlab/merge_requests/18742)
#### Capybara viewport size related issues #### Capybara viewport size related issues
......
...@@ -28,8 +28,7 @@ describe 'User uses header search field', :js do ...@@ -28,8 +28,7 @@ describe 'User uses header search field', :js do
context 'when clicking the search field' do context 'when clicking the search field' do
before do before do
page.find('#search').click page.find('#search.js-autocomplete-disabled').click
wait_for_all_requests
end end
it 'shows category search dropdown' do it 'shows category search dropdown' 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