Commit 54eb0fb3949e809c735a9c1f7923979242d5f916
Committed by
Rafael Reggiani Manzo
1 parent
ca803bae
Exists in
colab
and in
2 other branches
Add acceptance test helper to find values in HTML tables
It will be used to verify the correctness of the Compound Metric Configuration creation metrics list. Signed-off-by: Eduardo Araújo <duduktamg@hotmail.com>
Showing
2 changed files
with
17 additions
and
2 deletions
Show diff stats
features/support/env.rb
... | ... | @@ -24,6 +24,7 @@ require 'warden' |
24 | 24 | require 'cucumber/rails' |
25 | 25 | require 'capybara/poltergeist' |
26 | 26 | require_relative 'header' |
27 | +require_relative 'tables' | |
27 | 28 | |
28 | 29 | #Capybara.default_driver = :poltergeist |
29 | 30 | Capybara.javascript_driver = :poltergeist |
... | ... | @@ -85,5 +86,4 @@ Cucumber::Rails::Database.javascript_strategy = :truncation |
85 | 86 | require 'kalibro_client/kalibro_cucumber_helpers/hooks.rb' |
86 | 87 | |
87 | 88 | Warden.test_mode! |
88 | -World(Warden::Test::Helpers, HeaderUtils) | |
89 | - | |
89 | +World(Warden::Test::Helpers, HeaderUtils, TableUtils) | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | +module TableUtils | |
2 | + def get_table_column_values(selector, column) | |
3 | + column = column.strip | |
4 | + | |
5 | + within(selector) do | |
6 | + table_columns = all('th').map { |table_column| table_column.text.strip } | |
7 | + column_index = table_columns.index(column) | |
8 | + expect(column_index).not_to be_nil | |
9 | + | |
10 | + all("tr > td:nth-child(#{column_index + 1})").each do |element| | |
11 | + yield element.text.strip | |
12 | + end | |
13 | + end | |
14 | + end | |
15 | +end | ... | ... |