Sha256: a41ce842c4a78b29c101ed270f09d5dcb6498414738149eb7e468a1045dabadf

Contents?: true

Size: 905 Bytes

Versions: 21

Compression:

Stored size: 905 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" 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

21 entries across 21 versions & 2 rubygems

Version Path
decidim-dev-0.4.1 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.4.2 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.4.2 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.4.1 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.4.0 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.4.0 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.3.2 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.3.2 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.3.1 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.3.1 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.3.0 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.3.0 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.2.0 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.2.0 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.1.0 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.1.0 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.0.8.1 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-0.0.8.1 decidim-dev/lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.0.8 lib/decidim/dev/test/rspec_support/helpers.rb
decidim-dev-0.0.7 lib/decidim/dev/test/rspec_support/helpers.rb