Skip to content

Commit

Permalink
simply selection test
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHuynh333 committed Dec 20, 2024
1 parent f550779 commit 7de13c0
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions test/system/projects/samples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ class SamplesTest < ApplicationSystemTestCase
click_on I18n.t('projects.samples.new.submit_button')
### ACTIONS END ###

### results start ###
Sample.search_index.refresh
### VERIFY START ###
# flash msg
assert_text I18n.t('projects.samples.create.success')
# verify redirect to sample show page after successful sample creation
Expand All @@ -232,7 +231,7 @@ class SamplesTest < ApplicationSystemTestCase
within('#samples-table table tbody') do
assert_text 'New Name'
end
### results end ###
### VERIFY END ###
end

test 'edit sample' do
Expand Down Expand Up @@ -422,7 +421,6 @@ class SamplesTest < ApplicationSystemTestCase
assert_text I18n.t('projects.samples.index.no_samples')

# destination project received transferred samples
Sample.search_index.refresh
visit namespace_project_samples_url(@namespace, @project2)
within '#samples-table table tbody' do
samples.each do |sample|
Expand Down Expand Up @@ -500,7 +498,6 @@ class SamplesTest < ApplicationSystemTestCase
### ACTIONS END ###

### VERIFY START ###
Sample.search_index.refresh
within('#dialog') do
# error messages in dialog
assert_text I18n.t('projects.samples.transfers.create.error')
Expand Down Expand Up @@ -592,19 +589,12 @@ class SamplesTest < ApplicationSystemTestCase
end

# verify destination project still has no selected samples and one additional sample
Sample.search_index.refresh
visit namespace_project_samples_url(@namespace, @project2)
assert_selector 'input[name="sample_ids[]"]:checked', count: 0
within 'tfoot' do
assert_text "#{I18n.t('samples.table_component.counts.samples')}: 21"
assert_selector 'strong[data-selection-target="selected"]', text: '0'
end

click_button I18n.t(:'projects.samples.index.select_all_button')

within 'tfoot' do
assert_text "#{I18n.t('samples.table_component.counts.samples')}: 21"
assert_selector 'strong[data-selection-target="selected"]', text: '21'
end
### VERIFY END
end

Expand Down Expand Up @@ -1465,7 +1455,6 @@ class SamplesTest < ApplicationSystemTestCase
end

# samples now exist in project2 samples table
# Sample.search_index.refresh
visit namespace_project_samples_url(@namespace, @project2)
within('#samples-table table tbody') do
assert_text @sample1.name
Expand Down Expand Up @@ -1540,7 +1529,6 @@ class SamplesTest < ApplicationSystemTestCase
click_on I18n.t('projects.samples.shared.errors.ok_button')
end

Sample.search_index.refresh
visit namespace_project_samples_url(namespace, project25)
# samples 1 and 2 still successfully clone
within('#samples-table table tbody') do
Expand Down Expand Up @@ -1633,20 +1621,13 @@ class SamplesTest < ApplicationSystemTestCase
end

# verify destination project still has no selected samples and one additional sample
Sample.search_index.refresh
visit namespace_project_samples_url(@namespace, @project2)

assert_selector 'input[name="sample_ids[]"]:checked', count: 0
within 'tfoot' do
assert_text "#{I18n.t('samples.table_component.counts.samples')}: 21"
assert_selector 'strong[data-selection-target="selected"]', text: '0'
end

click_button I18n.t(:'projects.samples.index.select_all_button')

within 'tfoot' do
assert_text "#{I18n.t('samples.table_component.counts.samples')}: 21"
assert_selector 'strong[data-selection-target="selected"]', text: '21'
end
### VERIFY END
end

Expand Down

0 comments on commit 7de13c0

Please sign in to comment.