Module: Decidim::FeatureTestHelpers

Defined in:
lib/decidim/dev/test/rspec_support/helpers.rb

Overview

Helpers that get automatically included in feature specs.

Instance Method Summary collapse

Instance Method Details

#click_icon(name = nil) ⇒ Object



25
26
27
28
29
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 25

def click_icon(name = nil)
  classes = ["icon"]
  classes << ["icon--#{name}"] if name
  find(".#{classes.join(".")}").click
end


5
6
7
8
9
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 5

def click_submenu_link(text)
  within ".secondary-nav--subnav" do
    click_link text
  end
end

#expect_user_loggedObject



41
42
43
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 41

def expect_user_logged
  expect(page).to have_css(".topbar__user__logged")
end

#stripped(text) ⇒ Object



31
32
33
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 31

def stripped(text)
  Nokogiri::HTML(text).text
end

#within_flash_messagesObject



35
36
37
38
39
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 35

def within_flash_messages
  within ".flash" do
    yield
  end
end

#within_language_menuObject



18
19
20
21
22
23
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 18

def within_language_menu
  within ".topbar__dropmenu.language-choose" do
    find("ul.dropdown.menu").hover
    yield
  end
end

#within_user_menuObject



11
12
13
14
15
16
# File 'lib/decidim/dev/test/rspec_support/helpers.rb', line 11

def within_user_menu
  within ".topbar__user__logged" do
    find("a", text: user.name).hover
    yield
  end
end