Giter VIP home page Giter VIP logo

Comments (7)

senid231 avatar senid231 commented on May 25, 2024
def within_sidebar(title)
    sidebar = page.find('#sidebar > .sidebar_section > h3', text: title).ancestor('.sidebar_section')
    within(sidebar) { yield }
  end

from capybara_active_admin.

senid231 avatar senid231 commented on May 25, 2024
def find_action_item(title, exact: true)
    opts = exact ? { exact_text: title } : { text: title }
    page.find(action_item_selector, opts)
  end

  def have_action_item_link(title, exact: true, href: nil, **options)
    opts = exact ? { exact_text: title } : { text: title }
    opts.merge!(options)
    selector = "#{action_item_selector} > a"
    selector += "[href=\"#{href}\"]" if href.present?
    have_selector(selector, opts)
  end

  def within_action_item_dropdown
    within("#{action_item_selector} .dropdown_menu_list_wrapper") { yield }
  end

from capybara_active_admin.

senid231 avatar senid231 commented on May 25, 2024
# override Capybara::ActiveAdmin::Selectors::Form#has_many_fields_selector
  # @param association_name [String]
  # @return [String] selector.
  def has_many_fields_selector(association_name)
    ".has_many_container.#{association_name} > fieldset.inputs.has_many_fields"
  end

from capybara_active_admin.

senid231 avatar senid231 commented on May 25, 2024
def within_attribute_row(label)
    selector = attributes_row_selector(label)
    within(selector) { yield }
  end

from capybara_active_admin.

senid231 avatar senid231 commented on May 25, 2024
  def have_status_tag(text, type:, **options)
    selector = ".status_tag.#{type}"
    opts = options.merge exact_text: text
    have_selector(selector, opts)
  end

from capybara_active_admin.

senid231 avatar senid231 commented on May 25, 2024
def have_table_scope(title, selected: false)
    selector = table_scope_selector(selected)
    have_selector(selector, exact_text: title.to_s)
  end

  def table_scope_selector(selected)
    if selected
      'div.scopes li.scope.selected'
    else
      'div.scopes li.scope'
    end
  end

from capybara_active_admin.

senid231 avatar senid231 commented on May 25, 2024
# @example usage
#   expect(page).to have_status_tag(:error, exact_text: 'DOWN')
def have_status_tag(type, **options)
  have_selector("span.status_tag.#{type}", **options)
end

from capybara_active_admin.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.