Skip to content

DavyJonesLocker/ember-cli-test-interactions

ember-cli-test-interactions

ember-cli-test-interactions is built and maintained by DockYard, contact us for expert Ember.js consulting.

Ember-cli Test Interactions is a library providing some convenience test helper functions. It allows for more expressive acceptance tests and cuts out alot of the boiler plate functions required to find elements before acting upon them.

For example, compare filling in an HTML input with and without the library:

// with ember-cli-test-interactions
fillInByLabel('Name', 'Jane Doe');

// without
const label = find("label:contains('Jane Doe')");
const input = find(`#${label.attr('for')}`);
fillIn(input, 'Jane Doe');

Install

For ember-cli >= 0.2.3:

ember install ember-cli-test-interactions

For ember-cli < 0.2.3:

ember install:addon ember-cli-test-interactions

Use

Once the addon is installed, the helper functions will be available for import via '../tests/helpers/interactions'.

Import the functions you need in each of your acceptance test files:

import { module, test } from 'qunit';
import { clickLink } from '../tests/helpers/interactions';

test('clicking name transitions to route of the user', function(assert) {
  visit('/');
  andThen(clickLink('Jane Doe'));
  andThen(() => {
    assert.equal(url, '/users/jane-doe', "expected current path to be
Jane Doe's");
  });
});

Legal

DockYard, Inc. © 2015

@dockyard

About

Ember acceptance test helpers.

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Packages

No packages published