1 require 'integration_helper'
3 class CollectionsPerfTest < ActionDispatch::IntegrationTest
5 Capybara.current_driver = :rack_test
7 skip "ENV variable RUN_INTG_PERF_TESTS with value 'y' is not found" if !ENV["RUN_INTG_PERF_TESTS"].andand.start_with? 'y'
10 def create_large_collection size, file_name_prefix
11 manifest_text = ". d41d8cd98f00b204e9800998ecf8427e+0"
14 until manifest_text.length > size do
15 manifest_text << " 0:0:#{file_name_prefix}#{i.to_s}"
20 Collection.create! ({manifest_text: manifest_text})
28 test "Create and show large collection with manifest text of #{size}" do
30 new_collection = create_large_collection size, 'collection_file_name_with_prefix_'
32 visit page_with_token('active', "/collections/#{new_collection.uuid}")
34 assert_text new_collection.uuid
35 assert(page.has_link?('collection_file_name_with_prefix_0'), "Collection page did not include file link")
39 # This does not work with larger sizes because of need_javascript.
40 # Just use one test with 100,000 for now.
44 test "Create, show, and update description for large collection with manifest text of #{size}" do
48 new_collection = create_large_collection size, 'collection_file_name_with_prefix_'
50 visit page_with_token('active', "/collections/#{new_collection.uuid}")
52 assert_text new_collection.uuid
53 assert(page.has_link?('collection_file_name_with_prefix_0'), "Collection page did not include file link")
56 within('.arv-description-as-subtitle') do
57 find('.fa-pencil').click
58 find('.editable-input textarea').set('description for this large collection')
59 find('.editable-submit').click
62 assert_text 'description for this large collection'
70 ].each do |size1, size2|
71 test "Create one large collection of #{size1} and one small collection of #{size2} and combine them" do
73 first_collection = create_large_collection size1, 'collection_file_name_with_prefix_1_'
74 second_collection = create_large_collection size2, 'collection_file_name_with_prefix_2_'
76 visit page_with_token('active', "/collections")
78 assert_text first_collection.uuid
79 assert_text second_collection.uuid
81 within('tr', text: first_collection['uuid']) do
82 find('input[type=checkbox]').click
85 within('tr', text: second_collection['uuid']) do
86 find('input[type=checkbox]').click
89 click_button 'Selection...'
90 within('.selection-action-container') do
91 click_link 'Create new collection with selected collections'
94 assert(page.has_link?('collection_file_name_with_prefix_1_0'), "Collection page did not include file link")