Skip to content

Commit

Permalink
Merge pull request #3040 from projectblacklight/3039-flappy-tests
Browse files Browse the repository at this point in the history
Wait for data to load in flappy test
  • Loading branch information
corylown authored Jul 2, 2024
2 parents 08950cb + a32e68f commit 87c47de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
32 changes: 18 additions & 14 deletions spec/features/javascript/blocks/solr_documents_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,26 @@
end

it 'allows you to toggle visibility of solr documents', js: true do
skip('Passes locally, but soooo flakey in CI.') if ENV['CI']
fill_in_solr_document_block_typeahead_field with: 'dq287tq6352'

# Flappy guard. Wait for the thumbnail src to be populated.
expect(page).to have_selector('li[data-resource-id="dq287tq6352"] .img-thumbnail[src^="http"]')

within(:css, '.card') do
uncheck 'Display?'
end

fill_in_solr_document_block_typeahead_field with: 'gk446cj2442'

# Flappy guard. Wait for the thumbnail src to be populated.
expect(page).to have_selector('li[data-resource-id="gk446cj2442"] .img-thumbnail[src^="http"]')

# display the title as the primary caption
within('.primary-caption') do
check('Primary caption')
select('Title', from: 'primary-caption-field')
end

# this seems silly, but also seems to help with the flappy-ness of this spec
expect(find_field('Primary caption', checked: true)).to be_checked

save_page

expect(page).to have_selector '.items-block .box', count: 1, visible: true
Expand All @@ -114,9 +116,6 @@
uncheck('Primary caption')
end

# this seems silly, but also seems to help with the flappy-ness of this spec
expect(find_field('Primary caption', checked: false)).not_to be_checked

save_page

expect(page).to have_selector '.items-block .box', count: 1, visible: true
Expand Down Expand Up @@ -148,13 +147,12 @@
end

it 'allows you to optionally display a ZPR link with the image', js: true do
skip('Passes locally, but soooo flakey on Travis.') if ENV['CI']

fill_in_solr_document_block_typeahead_field with: 'gk446cj2442'

# Flappy guard. Wait for the thumbnail src to be populated.
expect(page).to have_selector('li[data-resource-id="gk446cj2442"] .img-thumbnail[src^="http"]')

check 'Offer "View larger" option'
# this seems silly, but also seems to help with the flappy-ness of this spec
expect(find_field('Offer "View larger" option', checked: true)).to be_checked

save_page

Expand Down Expand Up @@ -182,13 +180,13 @@
end

it 'allows you to choose which side the text will be on', js: true do
skip('Passes locally, but soooo flakey on Travis.') if ENV['CI']
fill_in_solr_document_block_typeahead_field with: 'dq287tq6352'

# Flappy guard. Wait for the thumbnail src to be populated.
expect(page).to have_selector('li[data-resource-id="dq287tq6352"] .img-thumbnail[src^="http"]')

# Select to align the text right
choose 'Left'
# this seems silly, but also seems to help with the flappy-ness of this spec
expect(find_field('Left', checked: true)).to be_checked

# fill in the content editable div
content_editable = find('.st-text-block')
Expand All @@ -209,12 +207,18 @@
it 'round-trip data', js: true do
fill_in_solr_document_block_typeahead_field with: 'dq287tq6352'

# Flappy guard. Wait for the thumbnail src to be populated.
expect(page).to have_selector('li[data-resource-id="dq287tq6352"] .img-thumbnail[src^="http"]')

within(:css, '.card') do
uncheck 'Display?'
end

fill_in_solr_document_block_typeahead_field with: 'gk446cj2442'

# Flappy guard. Wait for the thumbnail src to be populated.
expect(page).to have_selector('li[data-resource-id="gk446cj2442"] .img-thumbnail[src^="http"]')

# display the title as the primary caption
within('.primary-caption') do
check('Primary caption')
Expand Down
6 changes: 4 additions & 2 deletions spec/features/javascript/blocks/uploaded_items_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@
attach_file('uploaded_item_url', fixture_file2)

check 'Offer "View larger" option'
# this seems silly, but also seems to help with the flappy-ness of this spec
expect(find_field('Offer "View larger" option', checked: true)).to be_checked

# Flappy guards. Wait for the thumbnail src to be populated.
expect(page).to have_selector('li[data-id="file_0"] .img-thumbnail[src^="/"]')
expect(page).to have_selector('li[data-id="file_1"] .img-thumbnail[src^="/"]')

save_page

Expand Down

0 comments on commit 87c47de

Please sign in to comment.