Module: OntraCommonReactCapybaraHelpers
- Defined in:
- lib/ontra_common_react_capybara_helpers.rb,
lib/ontra_common_react_capybara_helpers/version.rb
Overview
Helpers for capybara tests to intereact and assert ontra-common-react components.
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
- .clear_table_filter(filter_id, drawer: false) ⇒ Object
- .open_table_filter(filter_id, drawer: false) ⇒ Object
- .select_option_in_table_filter(filter_id, option, drawer: false) ⇒ Object
- .sort_table_by(header) ⇒ Object
- .table_filter_have_selected_value(filter_id, option, drawer: false) ⇒ Object
- .table_next_page ⇒ Object
Class Method Details
.clear_table_filter(filter_id, drawer: false) ⇒ Object
15 16 17 18 19 |
# File 'lib/ontra_common_react_capybara_helpers.rb', line 15 def clear_table_filter(filter_id, drawer: false) open_table_filter(filter_id, drawer: drawer) page.find("[data-testid=#{filter_id}-options] li", exact_text: "Any").click ("View Results") if drawer end |
.open_table_filter(filter_id, drawer: false) ⇒ Object
10 11 12 13 |
# File 'lib/ontra_common_react_capybara_helpers.rb', line 10 def open_table_filter(filter_id, drawer: false) ("More Filter") if drawer page.find("[data-testid=#{filter_id}] > button").click end |
.select_option_in_table_filter(filter_id, option, drawer: false) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/ontra_common_react_capybara_helpers.rb', line 29 def select_option_in_table_filter(filter_id, option, drawer: false) open_table_filter(filter_id, drawer: drawer) expect(option).not_to be == "Any" page.find("[data-testid=#{filter_id}-options] li p", exact_text: option).click ("View Results") if drawer end |
.sort_table_by(header) ⇒ Object
40 41 42 |
# File 'lib/ontra_common_react_capybara_helpers.rb', line 40 def sort_table_by(header) within("table thead") { (header) } end |
.table_filter_have_selected_value(filter_id, option, drawer: false) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/ontra_common_react_capybara_helpers.rb', line 21 def table_filter_have_selected_value(filter_id, option, drawer: false) ("More Filter") if drawer within(page.find("[data-testid=#{filter_id}]")) do expect(page).to have_content(option) end ("View Results") if drawer end |
.table_next_page ⇒ Object
36 37 38 |
# File 'lib/ontra_common_react_capybara_helpers.rb', line 36 def table_next_page page.all("[data-testid=filters-pagination] [data-testid=chevronRight-icon]")[0].click end |