blob: d8368a94ad7d2cd07bd5ee87565053ba4d48c3ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# frozen_string_literal: true
module UserLoginHelper
def ensure_tab_pane_correctness(tab_names)
ensure_tab_pane_counts(tab_names.size)
ensure_tab_labels(tab_names)
ensure_one_active_tab
ensure_one_active_pane
end
def ensure_no_tabs
expect(page.all('[role="tab"]').size).to eq(0)
end
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)
expect(page).to have_selector('[role="tabpanel"]', visible: :all, count: tabs_count)
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
def ensure_remember_me_in_tab(tab_name)
find_link(tab_name).click
within '.tab-pane.active' do
expect(page).to have_content _('Remember me')
end
end
def ensure_remember_me_not_in_tab(tab_name)
find_link(tab_name).click
within '.tab-pane.active' do
expect(page).not_to have_content _('Remember me')
end
end
end
|