/capybara-angular-material

Capybara Selectors for Angular Material

Primary LanguageRubyMIT LicenseMIT

Capybara Selectors for Angular Material

Build Status Gem Version

This includes a number of selectors for testing Angular Material components.

This is tested using the capybara/poltergeist driver.

If you want to test how this works locally, check out this repo, install then run rackup -p8000. You'll see the paths in the app.js file. eg: localhost:8000/#/radio. I'll get around to documenting more later.

Installation

Add this line to your application's Gemfile:

gem 'capybara-angular-material'

You'll also need to install Capybara.

Usage

In your spec helper, include the DSL:

require 'capybara/angular/material'

RSpec.configure do |config|
  include Capybara::Angular::Material
end

Checkboxes

This tag: <md-checkbox>Some text</md-checkbox>

have_md_checkbox('Some text')

Checked is ignored unless set in options:

have_md_checkbox('Other thing', :checked => true)

Checked boolean is matched against the aria-checked attribute.

Buttons

have_md_button('Some text')

Radio Button

have_md_radio_button('Banana', :checked => true)
have_md_radio_button('Banana')

Select

have_md_radio_button('Some place holder text')