Cada uno es artífice de su propia ventura
Pre-releaseThis is the first release towards v1.0.0, our first major version 🎉
After working on the project for ~1 year we have settled for a new and more well thought API that includes several breaking changes.
import { create, fillable, visitable } from 'app/tests/page-object';
export default create({
visit: visitable('/login'),
userName: fillable('#username'),
password: fillable('#password'),
message: { scope: '.msg-box' }
});
import page from 'app/tests/pages/login';
test('fails to log in', function(assert) {
page
.visit()
.userName('Santiago')
.password('wrong pass')
.clickOn('Login');
andThen(function() {
assert.ok(page.message.isVisible);
assert.equal(page.message.text, 'Log in is invalid');
});
});
Note that the website documentation is still outdated and documentation for 1.0 is being written at this moment.
Project Update
$ ember install ember-cli-page-object
Or you can install the npm package and run the installation script
$ npm install --save-dev [email protected]
$ ember generate ember-cli-page-object
Main changes
- Can import properties directly
import { create } from 'path/to/page-object';
- Support for custom descriptors and expose findElementWithAssert and findElement helpers
.text
,.attribute
and.value
return an array of values when{ multiple: true }
is used.contains
,.hasClass
,.isHidden
,.isVisible
and.notHasClass
return an aggregated result when{ multiple: true }
is used.isVisble
does not throw an exception when element doesn't exist in DOM- Renamed
index
option toat
and it is 0-based index - Removed
customHelper
- Removed
component
property - Removed
build
property - Removed the need of
()
(parens) for accessing query attributes, components or predicates. - Collections are 0-based index now
- Scopes are inherited by default, you can reset the scope using
resetScope: true
- Properties that match more than one element throw an exception by default
Community contributions
#92 Migrate to Ceibo (@san650)
#111 Use locally installed ember-cli for Travis CI tests (@jeradg)
#108 .isVisible
returns false if element doesn't exist (@san650)
#110 Assert predicates and queries only match one element (@juanazam)
#91 One point zero (@san650 & @juanazam)
#116 Update README.md (@san650)
#117 Fix Ember.A(jqArray) returns jQuery array instead of Ember.Array (@san650)
#119 Remove unused code (@san650)