Adds QUnit asserts for ember-cli-page-object to make test errors more user-friendly and make code shorter.
User-friendly messages and simpler syntax:
const page = create({
link: {
scope: 'a',
href: attribute('href'),
isHighlighted: hasClass('highlighted'),
},
});
assert.po(page.element).hasText("test"); //message 'page.element: has text "text"'
assert.po(page.link).href('google.com'); //message 'page.link: has href "google.com"'
assert.po(page.link).isHighlighted(); //message 'page.link: isHighlighted
assert.po(page.input).isPresent(); //message 'page.input: is present'
- Ember.js v2.18 or above
- Ember CLI v2.13 or above
- Node.js v8 or above
ember install ember-page-object-asserts
Import new assert in your tests/test-helper.js
file:
import { addPoAssert } from 'ember-page-object-asserts';
addPoAssert();
setApplication(Application.create(config.APP));
assert.po(page.element).hasText("test");
assert.po(page.element).hasText(/test/);
assert.po(page.element).hasNoText("test");
assert.po(page.element).hasNoText(/test/);
const page = create({
link: {
scope: 'a',
href: attribute('href'),
isHighlighted: hasClass('highlighted'),
},
});
assert.po(page.link).has('href', 'google.com');
assert.po(page.link).has('isHighlighted');
// Or even like this:
assert.po(page.link).isHighlighted();
assert.po(page.link).href('google.com');
isPresent/isHidden
assert.po(page.input).isPresent();
assert.po(page.input).isHidden();
assert.po(page.input).hasValue('test');
const page = create({
list: collection('li')
});
assert.po(page.list).hasItems(3);
See the Contributing guide for details.
This project is licensed under the MIT License.