Sha256: ff1fdad3b0372ce3e7afffc5b66d795a355c4ea4e10f227a97e51bd9977bae5f

Contents?: true

Size: 913 Bytes

Versions: 6

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

# Helpers that get automatically included in feature specs.
module Decidim::FeatureTestHelpers
  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.callout" 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

6 entries across 6 versions & 2 rubygems

Version Path
decidim-dev-0.0.6 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.0.6 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.0.5 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.0.4 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.0.3 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.0.2 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb