Sha256: bb4d156a62243b1e495cb62d1411dda40484955601d92904eb1a780d32f6718f

Contents?: true

Size: 1012 Bytes

Versions: 4

Compression:

Stored size: 1012 Bytes

Contents

# frozen_string_literal: true

# Helpers that get automatically included in feature specs.
module Decidim::FeatureTestHelpers
  def click_submenu_link(text)
    within ".secondary-nav--subnav" do
      click_link text
    end
  end

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

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

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

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

  def within_flash_messages
    within ".flash" do
      yield
    end
  end

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

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

RSpec.configure do |config|
  config.include Decidim::FeatureTestHelpers, type: :feature
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
decidim-dev-0.4.4 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.4.4 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.4.3 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.4.3 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb