Locution::Sdk

Find out how reliable your existing Selenium tests are by automatically grading your locators against a battle-tested and curated set of heuristics.

Installation

Add this line to your application's Gemfile:

gem 'locution-sdk'

And then execute:

$ bundle

Or install it yourself as:

$ gem install locution-sdk

Usage

Locution works by using Selenium's Abstract Event Listener. You just need to create a new instance of our listener and pass it as an argument to Selenium when creating a browser instance.

You just need to provide your API Access Token (which is listed on your Account page) and the test name (which should be available dynamically through your test runner).

A Simple Example

require 'locution-sdk'

listener = Locution::Sdk::Listener.new('your-access-token', 'your-test-name')
@driver = Selenium::WebDriver.for :firefox, listener: listener)

An RSpec Example

require 'locution-sdk'

RSpec.configure do |config|

  config.before(:each) do |example|
    listener = Locution::Sdk::Listener.new('your-access-token', example.[:full_description])
    @driver = Selenium::WebDriver.for :firefox, listener: listener)
  end
end

A Cucumber Example

require 'locution-sdk'

Before do |scenario|
  test_name = "#{scenario.feature.name} - #{scenario.name}"
  listener = Locution::Sdk::Listener.new('your-access-token', test_name)
  @driver = Selenium::WebDriver.for :firefox, listener: listener)
end

License

The gem is available as open source under the terms of the MIT License.