Skip to content

Commit

Permalink
chore: fix some flaky group samples tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ericenns committed Jun 5, 2024
1 parent db9ee41 commit 6e42bda
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/system/groups/samples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def retrieve_puids
test 'can search the list of samples by name' do
visit group_samples_url(@group)

assert_text 'Displaying 1-20 items of 26 total'
within '#group_samples_list' do
assert_selector 'table tbody tr', count: 20
assert_text @sample1.name
Expand All @@ -119,6 +120,7 @@ def retrieve_puids
test 'can sort the list of samples' do
visit group_samples_url(@group)

assert_text 'Displaying 1-20 items of 26 total'
# Because PUIDs are not always generated the same, issues regarding order have occurred when hard testing
# the expected ordering of samples based on PUID. To resolve this, we will gather the first 4 PUIDs and ensure
# they are ordered as expected against one another.
Expand Down Expand Up @@ -169,6 +171,7 @@ def retrieve_puids
test 'can filter by name and then sort the list of samples' do
visit group_samples_url(@group)

assert_text 'Displaying 1-20 items of 26 total'
within '#group_samples_list' do
assert_selector 'table tbody tr', count: 20
within first('table tbody tr td') do
Expand Down Expand Up @@ -207,6 +210,7 @@ def retrieve_puids
test 'can filter by puid and then sort the list of samples' do
visit group_samples_url(@group)

assert_text 'Displaying 1-20 items of 26 total'
within '#group_samples_list' do
assert_selector 'table tbody tr', count: 20
within first('table tbody tr td') do
Expand Down Expand Up @@ -328,6 +332,7 @@ def retrieve_puids

test 'can sort samples by metadata column' do
visit group_samples_url(@group)
assert_text 'Displaying 1-20 items of 26 total'
assert_selector 'label', text: I18n.t('groups.samples.index.search.metadata'), count: 1
assert_selector 'table thead tr th', count: 6
find('label', text: I18n.t('groups.samples.index.search.metadata')).click
Expand Down Expand Up @@ -368,6 +373,7 @@ def retrieve_puids

test 'filtering samples by list of sample puids' do
visit group_samples_url(@group)
assert_text 'Displaying 1-20 items of 26 total'
within 'tbody#group-samples-table-body' do
assert_selector 'tr', count: 20
assert_selector 'tr td', text: @sample1.puid
Expand Down Expand Up @@ -405,6 +411,7 @@ def retrieve_puids

test 'selecting / deselecting all samples' do
visit group_samples_url(@group)
assert_text 'Displaying 1-20 items of 26 total'
within 'tbody' do
assert_selector 'input[name="sample_ids[]"]', count: 20
assert_selector 'input[name="sample_ids[]"]:checked', count: 0
Expand Down

0 comments on commit 6e42bda

Please sign in to comment.