1 require 'integration_helper'
3 # The tests in the "integration_performance" dir are not included in regular
4 # build pipeline since it is not one of the "standard" test directories.
6 # To run tests in this directory use the following command:
7 # ./run-tests.sh WORKSPACE=~/arvados --only apps/workbench apps/workbench_test="TEST=test/integration_performance/*.rb"
10 class CollectionsPerfTest < ActionDispatch::IntegrationTest
12 Capybara.current_driver = :rack_test
15 def create_large_collection size, file_name_prefix
16 manifest_text = ". d41d8cd98f00b204e9800998ecf8427e+0"
19 until manifest_text.length > size do
20 manifest_text << " 0:0:#{file_name_prefix}#{i.to_s}"
25 Rails.logger.info "Creating collection at #{Time.now.to_f}"
26 collection = Collection.create! ({manifest_text: manifest_text})
27 Rails.logger.info "Done creating collection at #{Time.now.to_f}"
37 test "Create and show large collection with manifest text of #{size}" do
39 new_collection = create_large_collection size, 'collection_file_name_with_prefix_'
41 Rails.logger.info "Visiting collection at #{Time.now.to_f}"
42 visit page_with_token('active', "/collections/#{new_collection.uuid}")
43 Rails.logger.info "Done visiting collection at #{Time.now.to_f}"
45 assert_text new_collection.uuid
46 assert(page.has_link?('collection_file_name_with_prefix_0'), "Collection page did not include file link")
50 # This does not work with larger sizes because of need_javascript.
51 # Just use one test with 100,000 for now.
55 test "Create, show, and update description for large collection with manifest text of #{size}" do
59 new_collection = create_large_collection size, 'collection_file_name_with_prefix_'
61 Rails.logger.info "Visiting collection at #{Time.now.to_f}"
62 visit page_with_token('active', "/collections/#{new_collection.uuid}")
63 Rails.logger.info "Done visiting collection at #{Time.now.to_f}"
65 assert_text new_collection.uuid
66 assert(page.has_link?('collection_file_name_with_prefix_0'), "Collection page did not include file link")
69 Rails.logger.info "Editing description at #{Time.now.to_f}"
70 within('.arv-description-as-subtitle') do
71 find('.fa-pencil').click
72 find('.editable-input textarea').set('description for this large collection')
73 find('.editable-submit').click
75 Rails.logger.info "Done editing description at #{Time.now.to_f}"
77 assert_text 'description for this large collection'
85 ].each do |size1, size2|
86 test "Create one large collection of #{size1} and one small collection of #{size2} and combine them" do
88 first_collection = create_large_collection size1, 'collection_file_name_with_prefix_1_'
89 second_collection = create_large_collection size2, 'collection_file_name_with_prefix_2_'
91 Rails.logger.info "Visiting collections page at #{Time.now.to_f}"
92 visit page_with_token('active', "/collections")
93 Rails.logger.info "Done visiting collections page at at #{Time.now.to_f}"
95 assert_text first_collection.uuid
96 assert_text second_collection.uuid
98 within('tr', text: first_collection['uuid']) do
99 find('input[type=checkbox]').click
102 within('tr', text: second_collection['uuid']) do
103 find('input[type=checkbox]').click
106 Rails.logger.info "Clicking on combine collections option at #{Time.now.to_f}"
107 click_button 'Selection...'
108 within('.selection-action-container') do
109 click_link 'Create new collection with selected collections'
111 Rails.logger.info "Done combining collections at #{Time.now.to_f}"
113 assert(page.has_link?('collection_file_name_with_prefix_1_0'), "Collection page did not include file link")