Skip to content

Commit 2eb7b85

Browse files
committed
Remove flakyness from see source files step
As we're first querying the visible files and then comparing the expected counts we're not making use of capybaras waiting in case they're not loaded yet. This change embeds the expectation in the query making use of the patient waiting and functioning as an expectation at the same time.
1 parent 0569dcd commit 2eb7b85

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

features/skipping_code_blocks_manually.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ Feature:
5757

5858
When I open the coverage report generated with `bundle exec rake test`
5959

60-
Then I should see the source files:
60+
Then the report should be based upon:
61+
| Unit Tests |
62+
63+
And there should be 7 skipped lines in the source files
64+
65+
And I should see the source files:
6166
| name | coverage |
6267
| lib/faked_project.rb | 100.00 % |
6368
| lib/faked_project/some_class.rb | 80.00 % |
6469
| lib/faked_project/framework_specific.rb | 75.00 % |
6570
| lib/faked_project/meta_magic.rb | 100.00 % |
6671
| lib/faked_project/nocov.rb | 100.00 % |
67-
68-
And there should be 7 skipped lines in the source files
69-
70-
And the report should be based upon:
71-
| Unit Tests |

features/step_definitions/html_steps.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
Then /^I should see the groups:$/ do |table|
44
expected_groups = table.hashes
5-
available_groups = all("#content .file_list_container")
65
# Given group names should be the same number than those rendered in report
7-
expect(expected_groups.count).to eq(available_groups.count)
6+
expect(page).to have_css("#content .file_list_container", count: expected_groups.count)
87

98
# Verify each of the expected groups has a file list container and corresponding title and coverage number
109
# as well as the correct number of links to files.
@@ -23,9 +22,8 @@
2322

2423
Then /^I should see the source files:$/ do |table|
2524
expected_files = table.hashes
26-
available_source_files = all(".t-file", visible: true)
25+
available_source_files = all(".t-file", visible: true, count: expected_files.count)
2726

28-
expect(expected_files.length).to eq(available_source_files.count)
2927
include_branch_coverage = table.column_names.include?("branch coverage")
3028

3129
# Find all filenames and their coverage present in coverage report

0 commit comments

Comments
 (0)