VRFS-2478 : Fix JS timing error causing intermittent test failure.
This commit is contained in:
parent
c068619d4d
commit
be2bb30425
|
|
@ -35,6 +35,7 @@
|
|||
}
|
||||
|
||||
function clearResults() {
|
||||
//logger.debug("CLEARING CONTENT")
|
||||
currentPage = 0;
|
||||
$content.empty();
|
||||
$noMoreJamtracks.hide();
|
||||
|
|
@ -42,14 +43,15 @@
|
|||
}
|
||||
|
||||
function refresh() {
|
||||
clearResults();
|
||||
|
||||
currentQuery = buildQuery();
|
||||
rest.getJamtracks(currentQuery)
|
||||
.done(function(response) {
|
||||
clearResults();
|
||||
handleJamtrackResponse(response);
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
clearResults();
|
||||
$noMoreJamtracks.show();
|
||||
app.notifyServerError(jqXHR, 'Jamtrack Unavailable')
|
||||
})
|
||||
}
|
||||
|
|
@ -95,6 +97,7 @@
|
|||
}
|
||||
|
||||
function handleJamtrackResponse(response) {
|
||||
//logger.debug("Handling response", JSON.stringify(response))
|
||||
next = response.next;
|
||||
|
||||
renderJamtracks(response);
|
||||
|
|
|
|||
|
|
@ -1,94 +0,0 @@
|
|||
<!-- @begin web_filter -->
|
||||
<% case search_type
|
||||
when Search::PARAM_BAND
|
||||
filter_label = :band
|
||||
when Search::PARAM_MUSICIAN
|
||||
filter_label = :musician
|
||||
when Search::PARAM_FEED
|
||||
filter_label = :feed
|
||||
when Search::PARAM_JAMTRACK
|
||||
filter_label = :jamtrack
|
||||
end %>
|
||||
<%= content_tag(:div, :id => defined?(id) ? id : 'session-controls', :class => "#{filter_label}-filter filter-head") do %>
|
||||
<%= content_tag(:div, :class => "filter-element wrapper") do -%>
|
||||
<% if :feed == filter_label %>
|
||||
<!-- @begin sort filter -->
|
||||
<%= content_tag(:div, 'Sort Feed by:', :class => 'filter-element desc') %>
|
||||
<%= select_tag("#{filter_label}_order_by", options_for_select(Search::F_SORT_OPTS), {:class => "#{filter_label}-order-by easydropdown" } ) %>
|
||||
<!-- @end sort filter -->
|
||||
<% elsif :jamtrack != filter_label %>
|
||||
<!-- @begin order by filter -->
|
||||
<%= content_tag(:div, 'Order By:', :class => 'filter-element desc') %>
|
||||
<%= select_tag("#{filter_label}_order_by", options_for_select(Search::M_ORDERINGS), {:class => "#{filter_label}-order-by easydropdown"} ) %>
|
||||
<!-- @end order by filter -->
|
||||
<% end %>
|
||||
<% end -%>
|
||||
<%= content_tag(:div, :class => 'filter-element wrapper') do -%>
|
||||
<% if :band == filter_label || :jamtrack == filter_label %>
|
||||
<!-- @begin genre filter -->
|
||||
<%= content_tag(:div, 'Genre:', :class => 'filter-element desc') %>
|
||||
<%= select_tag("#{filter_label}_genre",
|
||||
options_for_select([['Any', '']].concat(JamRuby::Genre.all.collect { |ii| [ii.description, ii.id] })), {:class => 'easydropdown'}) %>
|
||||
<!-- @end genre filter -->
|
||||
<% end %>
|
||||
<% if :musician == filter_label || :jamtrack == filter_label %>
|
||||
<!-- @begin instrument filter -->
|
||||
<%= content_tag(:div, 'Instrument:', :class => 'filter-element desc instrument-selector') %>
|
||||
<%= select_tag("#{filter_label}_instrument",
|
||||
options_for_select([['Any', '']].concat(JamRuby::Instrument.all.collect { |ii| [ii.description, ii.id] })), {:class=> "easydropdown"}) %>
|
||||
<!-- @end instrument filter -->
|
||||
<% end %>
|
||||
<% if :feed == filter_label %>
|
||||
<!-- @begin date filter -->
|
||||
<%= content_tag(:div, 'Include Dates:', :class => 'filter-element desc') %>
|
||||
<%= select_tag("#{filter_label}_date", options_for_select(Search::DATE_OPTS), {:class => "easydropdown"}) %>
|
||||
<!-- @end date filter -->
|
||||
<% end %>
|
||||
<% end -%>
|
||||
<%= content_tag(:div, :class => 'filter-element wrapper') do -%>
|
||||
<% if :feed == filter_label %>
|
||||
<!-- @begin show filter -->
|
||||
<%= content_tag(:div, 'Show:', :class => 'filter-element desc') %>
|
||||
<%= select_tag("#{filter_label}_show", options_for_select(Search::SHOW_OPTS), {:class => "easydropdown"}) %>
|
||||
<!-- @end show filter -->
|
||||
<% elsif :musician == filter_label %>
|
||||
<!-- @begin score filter -->
|
||||
<%= content_tag(:div, 'Latency:', :class => 'filter-element desc latency-or-distance') %>
|
||||
<%= content_tag(:div, :class => 'query-distance-params') do -%>
|
||||
<%= select_tag("musician_query_score", options_for_select(Search::M_SCORE_OPTS, Search::M_SCORE_DEFAULT), {:class => 'easydropdown'}) %>
|
||||
<%= select_tag("musician_distance", options_for_select(Search::M_DISTANCE_OPTS, Search::M_DISTANCE_DEFAULT), {:class => 'easydropdown'}) %>
|
||||
<% end -%>
|
||||
<div class="filter-element desc" id="musician-search-city">
|
||||
to <a href="#" id="musician-change-filter-city"><span id="musician-filter-city"></span></a>
|
||||
</div>
|
||||
<!-- @end score filter -->
|
||||
<% elsif :jamtrack == filter_label %>
|
||||
<!-- @begin availability filter -->
|
||||
<%= content_tag(:div, 'Availability:', :class => 'filter-element desc') %>
|
||||
<%= select_tag("#{filter_label}_availability", options_for_select([['Any', '']].concat(JamRuby::JamTrack::SALES_REGION), 'United States'), {:class => "easydropdown"}) %>
|
||||
<!-- @end availability filter -->
|
||||
<% else %>
|
||||
<!-- @begin distance filter -->
|
||||
<%= content_tag(:div, 'Within', :class => 'filter-element desc') %>
|
||||
<%= content_tag(:div, :class => 'query-distance-params') do -%>
|
||||
<% default_distance = :musician == filter_label ? Search::M_MILES_DEFAULT : Search::B_MILES_DEFAULT %>
|
||||
<%= select_tag("#{filter_label}_query_distance", options_for_select(Search::DISTANCE_OPTS, default_distance), {:class => 'easydropdown'}) %>
|
||||
<% end -%>
|
||||
<%= content_tag(:div, :class => 'filter-element desc') do -%>
|
||||
miles of <%= content_tag(:span, current_user ? current_user.current_city(request.remote_ip) : '', :id => "#{filter_label}-filter-city") %>
|
||||
<% end -%>
|
||||
<!-- @end distance filter -->
|
||||
<% end %>
|
||||
<% end -%>
|
||||
|
||||
<% if :feed == filter_label %>
|
||||
<div class="btn-refresh-holder">
|
||||
<a class="button-grey btn-refresh-entries" href="/client#/feed">REFRESH</a>
|
||||
</div>
|
||||
<% elsif :musician == filter_label %>
|
||||
<div class="btn-refresh-holder">
|
||||
<a class="button-grey btn-refresh-entries" href="/client#/musicians">REFRESH</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end -%>
|
||||
<!-- @end web_filter -->
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/ @begin web_filter
|
||||
-case search_type
|
||||
-when Search::PARAM_BAND
|
||||
-filter_label =:band
|
||||
-when Search::PARAM_MUSICIAN
|
||||
-filter_label =:musician
|
||||
-when Search::PARAM_FEED
|
||||
-filter_label =:feed
|
||||
-when Search::PARAM_JAMTRACK
|
||||
-filter_label =:jamtrack
|
||||
=content_tag(:div, :id => defined?(id) ? id : 'session-controls', :class => "#{filter_label}-filter filter-head") do
|
||||
=content_tag(:div, :class => "filter-element wrapper") do
|
||||
-if :feed==filter_label
|
||||
/ @begin sort filter
|
||||
=content_tag(:div, 'Sort Feed by:', :class => 'filter-element desc')
|
||||
=select_tag("#{filter_label}_order_by", options_for_select(Search::F_SORT_OPTS), {:class => "#{filter_label}-order-by easydropdown" } )
|
||||
/ @end sort filter
|
||||
-elsif :jamtrack !=filter_label
|
||||
/ @begin order by filter
|
||||
=content_tag(:div, 'Order By:', :class => 'filter-element desc')
|
||||
=select_tag("#{filter_label}_order_by", options_for_select(Search::M_ORDERINGS), {:class => "#{filter_label}-order-by easydropdown"} )
|
||||
/ @end order by filter
|
||||
=content_tag(:div, :class => 'filter-element wrapper') do
|
||||
-if :band==filter_label || :jamtrack==filter_label
|
||||
/ @begin genre filter
|
||||
=content_tag(:div, 'Genre:', :class => 'filter-element desc')
|
||||
=select_tag("#{filter_label}_genre", |
|
||||
options_for_select([['Any', '']].concat(JamRuby::Genre.all.collect { |ii| [ii.description, ii.id] })), {:class => 'easydropdown'}) |
|
||||
/ @end genre filter
|
||||
-if :musician==filter_label || :jamtrack==filter_label
|
||||
/ @begin instrument filter
|
||||
=content_tag(:div, 'Instrument:', :class => 'filter-element desc instrument-selector')
|
||||
=select_tag("#{filter_label}_instrument", |
|
||||
options_for_select([['Any', '']].concat(JamRuby::Instrument.all.collect { |ii| [ii.description, ii.id] })), {:class=> "easydropdown"}) |
|
||||
/ @end instrument filter
|
||||
-if :feed==filter_label
|
||||
/ @begin date filter
|
||||
=content_tag(:div, 'Include Dates:', :class => 'filter-element desc')
|
||||
=select_tag("#{filter_label}_date", options_for_select(Search::DATE_OPTS), {:class => "easydropdown"})
|
||||
/ @end date filter
|
||||
=content_tag(:div, :class => 'filter-element wrapper') do
|
||||
-if :feed==filter_label
|
||||
/ @begin show filter
|
||||
=content_tag(:div, 'Show:', :class => 'filter-element desc')
|
||||
=select_tag("#{filter_label}_show", options_for_select(Search::SHOW_OPTS), {:class => "easydropdown"})
|
||||
/ @end show filter
|
||||
-elsif :musician==filter_label
|
||||
/ @begin score filter
|
||||
=content_tag(:div, 'Latency:', :class => 'filter-element desc latency-or-distance')
|
||||
=content_tag(:div, :class => 'query-distance-params') do
|
||||
=select_tag("musician_query_score", options_for_select(Search::M_SCORE_OPTS, Search::M_SCORE_DEFAULT), {:class => 'easydropdown'})
|
||||
=select_tag("musician_distance", options_for_select(Search::M_DISTANCE_OPTS, Search::M_DISTANCE_DEFAULT), {:class => 'easydropdown'})
|
||||
#musician-search-city.filter-element.desc
|
||||
to
|
||||
%a#musician-change-filter-city{:href => "#"}
|
||||
%span#musician-filter-city
|
||||
/ @end score filter
|
||||
-elsif :jamtrack==filter_label
|
||||
/ @begin availability filter
|
||||
%h3 hey
|
||||
=content_tag(:div, 'Availability:', :class => 'filter-element desc')
|
||||
=select_tag("#{filter_label}_availability", options_for_select([['Any', '']].concat(JamRuby::JamTrack::SALES_REGION), 'United States'), {:class => "easydropdown"})
|
||||
/ @end availability filter
|
||||
-else
|
||||
/ @begin distance filter
|
||||
=content_tag(:div, 'Within', :class => 'filter-element desc')
|
||||
=content_tag(:div, :class => 'query-distance-params') do
|
||||
-default_distance =:musician==filter_label ? Search::M_MILES_DEFAULT : Search::B_MILES_DEFAULT
|
||||
=select_tag("#{filter_label}_query_distance", options_for_select(Search::DISTANCE_OPTS, default_distance), {:class => 'easydropdown'})
|
||||
=content_tag(:div, :class => 'filter-element desc') do
|
||||
miles of #{content_tag(:span, current_user ? current_user.current_city(request.remote_ip) : '', :id => "#{filter_label}-filter-city")}
|
||||
/ @end distance filter
|
||||
-if :feed==filter_label
|
||||
.btn-refresh-holder
|
||||
%a.button-grey.btn-refresh-entries{:href => "/client#/feed"} REFRESH
|
||||
-elsif :musician==filter_label
|
||||
.btn-refresh-holder
|
||||
%a.button-grey.btn-refresh-entries{:href => "/client#/musicians"} REFRESH
|
||||
/ @end web_filter
|
||||
|
|
@ -26,7 +26,7 @@ describe "JamTrack Shopping", :js => true, :type => :feature, :capybara_feature
|
|||
end
|
||||
|
||||
def find_jamtrack jamtrack, options = {}
|
||||
jamtrack_record = find(".jamtrack-record[jamtrack-id=\"#{jamtrack.id}\"]")
|
||||
jamtrack_record = find(".jamtrack-record[jamtrack-id=\"#{jamtrack.id}\"]")
|
||||
jamtrack_record.find('.detail-value', text: jamtrack.name)
|
||||
jamtrack_record.find('.detail-value', text: jamtrack.recording_type)
|
||||
jamtrack_record.find('.detail-value', text: jamtrack.original_artist)
|
||||
|
|
|
|||
|
|
@ -292,11 +292,10 @@ end
|
|||
|
||||
# will select the value from a easydropdown'ed select element
|
||||
def jk_select(text, select)
|
||||
|
||||
# the approach here is to find the hidden select element, and work way back up to the elements that need to be interacted with
|
||||
find(select, :visible => false).find(:xpath, 'ancestor::div[contains(@class, "dropdown easydropdown")]').trigger(:click)
|
||||
find(select, :visible => false).find(:xpath, 'ancestor::div[contains(@class, "dropdown-wrapper") and contains(@class, "easydropdown-wrapper") and contains(@class, "open")]').find('li', text: text).trigger(:click)
|
||||
|
||||
|
||||
# works, but is 'cheating' because of visible = false
|
||||
#select(genre, :from => 'genres', :visible => false)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue