Skip to content

Commit

Permalink
Rename test helper save_page to save_page_changes
Browse files Browse the repository at this point in the history
This fixes a rubocop error
  • Loading branch information
marlo-longley committed Sep 16, 2024
1 parent 1519764 commit dc3ad3b
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
expect(page).to have_css '.title', text: 'Pets'
end

save_page
save_page_changes

expect(page).to have_css 'h2', text: 'Pets'
end
Expand All @@ -39,7 +39,7 @@
expect(page).to have_css '.title', text: 'Pets'
end

save_page
save_page_changes

expect(page).to have_css 'h2', text: 'Pets'

Expand All @@ -56,7 +56,7 @@
expect(page).to have_css '.title', text: 'Pets'
end

save_page
save_page_changes

expect(page).to have_css 'h2', text: 'Pets'
expect(page).to have_css '.box.category-1', count: 6, visible: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

fill_in_typeahead_field with: 'Title2'

save_page
save_page_changes

# Documents should exist
expect(page).to have_no_css('.category-title', text: search1.title)
Expand All @@ -39,7 +39,7 @@
pending('Prefetched autocomplete does not work the same way as solr-backed autocompletes')
uncheck 'Include item counts?'
fill_in_typeahead_field with: 'Title1'
save_page
save_page_changes

expect(page).to have_no_css('.item-count', text: /\d+ items/i)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/features/javascript/blocks/featured_pages_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

fill_in_typeahead_field with: feature_page2.title

save_page
save_page_changes

expect(page).to have_content feature_page2.title
end
Expand All @@ -51,7 +51,7 @@
fill_in_typeahead_field with: feature_page1.title
fill_in_typeahead_field with: feature_page2.title

save_page
save_page_changes

feature_page1_position = page.body =~ /<p class="category-title">\s+#{feature_page1.title}/
feature_page2_position = page.body =~ /<p class="category-title">\s+#{feature_page2.title}/
Expand Down
4 changes: 2 additions & 2 deletions spec/features/javascript/blocks/link_to_search_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

fill_in_typeahead_field with: 'Title2'

save_page
save_page_changes

# Documents should exist
expect(page).to have_no_css('.category-title', text: search1.title)
Expand All @@ -39,7 +39,7 @@
pending('Prefetched autocomplete does not work the same way as solr-backed autocompletes')
uncheck 'Include item counts?'
fill_in_typeahead_field with: 'Title1'
save_page
save_page_changes

expect(page).to have_no_css('.item-count', text: /\d+ items/i)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/javascript/blocks/rule_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

add_widget 'rule'

save_page
save_page_changes

expect(page).to have_css('hr')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
check 'Gallery'
check 'Slideshow'

save_page
save_page_changes

expect(page).to have_no_content 'per page'
expect(page).to have_no_content 'Sort by'
Expand Down
22 changes: 11 additions & 11 deletions spec/features/javascript/blocks/solr_documents_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
expect(page).to have_content "L'AMERIQUE"
end

save_page
save_page_changes

# verify that the item + image widget is displaying an image from the document.
within(:css, '.items-block', visible: true) do
Expand All @@ -47,7 +47,7 @@
fill_in_solr_document_block_typeahead_field with: 'gk446cj2442'
expect(page).to have_selector '.panels li', count: 2, visible: true

save_page
save_page_changes

expect(page).to have_selector '.items-block .box', count: 2, visible: true
end
Expand All @@ -62,7 +62,7 @@
find('.thumbs-list li[data-index="1"]').click
expect(page).to have_css('[data-panel-image-pagination]', text: /Image 2 of 2/, visible: true)

save_page
save_page_changes

# The thumbnail on the rendered block should be correct
thumb = find('.img-thumbnail')
Expand All @@ -76,7 +76,7 @@
thumb = find('.pic .img-thumbnail')
expect(thumb['src']).to match(%r{xd327cm9378_05_0002/full})

save_page
save_page_changes

# Expect that the original image selection was retained
thumb = find('.img-thumbnail')
Expand Down Expand Up @@ -104,7 +104,7 @@
select('Title', from: 'primary-caption-field')
end

save_page
save_page_changes

expect(page).to have_selector '.items-block .box', count: 1, visible: true
expect(page).to have_content '[World map]'
Expand All @@ -116,7 +116,7 @@
uncheck('Primary caption')
end

save_page
save_page_changes

expect(page).to have_selector '.items-block .box', count: 1, visible: true
expect(page).to have_no_content '[World map]'
Expand All @@ -136,7 +136,7 @@
select('Language', from: 'secondary-caption-field')
end
# create the page
save_page
save_page_changes

# verify that the item + image widget is displaying image and title from the requested document.
within(:css, '.items-block', visible: true) do
Expand All @@ -154,7 +154,7 @@

check 'Offer "View larger" option'

save_page
save_page_changes

within '.contents' do
click_button 'View [World map] larger'
Expand All @@ -170,7 +170,7 @@
content_editable = find('.st-text-block')
content_editable.set('zzz')
# create the page
save_page
save_page_changes

# visit the show page for the document we just saved
# verify that the item + image widget is displaying image and title from the requested document.
Expand All @@ -193,7 +193,7 @@
content_editable.set('zzz')

# create the page
save_page
save_page_changes

# verify that the item + image widget is displaying image and title from the requested document.
within(:css, '.items-block') do
Expand Down Expand Up @@ -231,7 +231,7 @@
# Select to align the text right
choose 'Right'

save_page
save_page_changes

click_on 'Edit'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
check 'Primary caption'
select 'Title', from: 'primary-caption-field'

save_page
save_page_changes

within '.carousel-block' do
expect(page).to have_css('.carousel-item', count: 1)
Expand Down
6 changes: 3 additions & 3 deletions spec/features/javascript/blocks/uploaded_items_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
expect(page).to have_css('.card-title', text: 'avatar.png')
end

save_page
save_page_changes

expect(page).to have_css('h3', text: heading)
expect(page).to have_css('p', text: text)
Expand All @@ -59,7 +59,7 @@
# Uncheck the first checkbox
all('input[type="checkbox"]').first.click

save_page
save_page_changes

within('.uploaded-items-block') do
expect(page).to have_css('img[alt=""]', count: 1)
Expand All @@ -76,7 +76,7 @@
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
save_page_changes

within('.uploaded-items-block') do
expect(page).to have_button('View larger', count: 2)
Expand Down
4 changes: 2 additions & 2 deletions spec/features/javascript/multi_image_select_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
expect(page).to have_link 'Change'
end

save_page
save_page_changes

visit spotlight.exhibit_feature_page_path(exhibit, feature_page)
expect(page).to have_css("[data-id='xd327cm9378']")
Expand All @@ -41,7 +41,7 @@
all('li')[1].click
end

save_page
save_page_changes

expect(page).to have_css("[data-id='xd327cm9378']")
expect(page).to have_no_css("img[src='https://stacks.stanford.edu/image/iiif/xd327cm9378/xd327cm9378_05_0001/full/!400,400/0/default.jpg']")
Expand Down
2 changes: 1 addition & 1 deletion spec/support/features/test_features_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def click_add_widget
first('.st-block-replacer').click
end

def save_page
def save_page_changes
page.execute_script <<-EOF
SirTrevor.getInstance().onFormSubmit();
EOF
Expand Down

0 comments on commit dc3ad3b

Please sign in to comment.