2018-11-12 16:40:42 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module UserLoginHelper
|
2020-10-28 08:08:40 -04:00
|
|
|
def ensure_tab_pane_correctness(tab_names)
|
|
|
|
ensure_tab_pane_counts(tab_names.size)
|
|
|
|
ensure_tab_labels(tab_names)
|
2018-11-12 16:40:42 -05:00
|
|
|
ensure_one_active_tab
|
|
|
|
ensure_one_active_pane
|
|
|
|
end
|
|
|
|
|
2020-11-02 22:08:56 -05:00
|
|
|
def ensure_no_tabs
|
|
|
|
expect(page.all('[role="tab"]').size).to eq(0)
|
|
|
|
end
|
|
|
|
|
2020-10-28 08:08:40 -04:00
|
|
|
def ensure_tab_labels(tab_names)
|
|
|
|
tab_labels = page.all('[role="tab"]').map(&:text)
|
|
|
|
|
|
|
|
expect(tab_names).to match_array(tab_labels)
|
|
|
|
end
|
|
|
|
|
|
|
|
def ensure_tab_pane_counts(tabs_count)
|
|
|
|
expect(page.all('[role="tab"]').size).to eq(tabs_count)
|
2020-01-23 10:08:46 -05:00
|
|
|
expect(page).to have_selector('[role="tabpanel"]', visible: :all, count: tabs_count)
|
2018-11-12 16:40:42 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def ensure_one_active_tab
|
|
|
|
expect(page).to have_selector('ul.new-session-tabs > li > a.active', count: 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
def ensure_one_active_pane
|
|
|
|
expect(page).to have_selector('.tab-pane.active', count: 1)
|
|
|
|
end
|
|
|
|
end
|