1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 require 'integration_helper'
7 # The tests in the "integration_performance" dir are not included in regular
8 # build pipeline since it is not one of the "standard" test directories.
10 # To run tests in this directory use the following command:
11 # ./run-tests.sh WORKSPACE=~/arvados --only apps/workbench apps/workbench_test="TEST=test/integration_performance/*.rb"
14 class CollectionsPerfTest < ActionDispatch::IntegrationTest
16 Capybara.current_driver = :rack_test
19 def create_large_collection size, file_name_prefix
20 manifest_text = ". d41d8cd98f00b204e9800998ecf8427e+0"
23 until manifest_text.length > size do
24 manifest_text << " 0:0:#{file_name_prefix}#{i.to_s}"
29 Rails.logger.info "Creating collection at #{Time.now.to_f}"
30 collection = Collection.create! ({manifest_text: manifest_text})
31 Rails.logger.info "Done creating collection at #{Time.now.to_f}"
41 test "Create and show large collection with manifest text of #{size}" do
43 new_collection = create_large_collection size, 'collection_file_name_with_prefix_'
45 Rails.logger.info "Visiting collection at #{Time.now.to_f}"
46 visit page_with_token('active', "/collections/#{new_collection.uuid}")
47 Rails.logger.info "Done visiting collection at #{Time.now.to_f}"
49 assert_selector "input[value=\"#{new_collection.uuid}\"]"
50 assert(page.has_link?('collection_file_name_with_prefix_0'), "Collection page did not include file link")
54 # This does not work with larger sizes because of need_javascript.
55 # Just use one test with 100,000 for now.
59 test "Create, show, and update description for large collection with manifest text of #{size}" do
63 new_collection = create_large_collection size, 'collection_file_name_with_prefix_'
65 Rails.logger.info "Visiting collection at #{Time.now.to_f}"
66 visit page_with_token('active', "/collections/#{new_collection.uuid}")
67 Rails.logger.info "Done visiting collection at #{Time.now.to_f}"
69 assert_selector "input[value=\"#{new_collection.uuid}\"]"
70 assert(page.has_link?('collection_file_name_with_prefix_0'), "Collection page did not include file link")
73 Rails.logger.info "Editing description at #{Time.now.to_f}"
74 within('.arv-description-as-subtitle') do
75 find('.fa-pencil').click
76 find('.editable-input textarea').set('description for this large collection')
77 find('.editable-submit').click
79 Rails.logger.info "Done editing description at #{Time.now.to_f}"
81 assert_text 'description for this large collection'
89 ].each do |size1, size2|
90 test "Create one large collection of #{size1} and one small collection of #{size2} and combine them" do
92 first_collection = create_large_collection size1, 'collection_file_name_with_prefix_1_'
93 second_collection = create_large_collection size2, 'collection_file_name_with_prefix_2_'
95 Rails.logger.info "Visiting collections page at #{Time.now.to_f}"
96 visit page_with_token('active', "/collections")
97 Rails.logger.info "Done visiting collections page at at #{Time.now.to_f}"
99 assert_text first_collection.uuid
100 assert_text second_collection.uuid
102 within('tr', text: first_collection['uuid']) do
103 find('input[type=checkbox]').click
106 within('tr', text: second_collection['uuid']) do
107 find('input[type=checkbox]').click
110 Rails.logger.info "Clicking on combine collections option at #{Time.now.to_f}"
111 click_button 'Selection...'
112 within('.selection-action-container') do
113 click_link 'Create new collection with selected collections'
115 Rails.logger.info "Done combining collections at #{Time.now.to_f}"
117 assert(page.has_link?('collection_file_name_with_prefix_1_0'), "Collection page did not include file link")