Winter Is Coming

@san650 san650 released this Apr 24, 2016 · 179 commits to master since this release

Wow, this is just an awesome release full of cool new features and improvements, see the main changes section for more information.

Project Update

$ ember install ember-cli-page-object
$ npm install --save-dev ember-cli-page-object@v1.3.0

Main changes

New .property property

Query any property of a DOM element

var page = PageObject.create({
  carousel: {
    scope: '.carousel-images',

    left: property('scrollLeft', '.content')
  }
});

assert.equal(page.carousel.left, 200, 'Scrolled by 200px');

New .is property

Test if a DOM element matches a jQuery flavored selector

var page = PageObject.create({
  isChecked: is(':checked', 'input')
});

assert.ok(page.isChecked);

It uses jQuery's .is() function under the hood.

Thanks to @jeradg for implementing this!

New testContainer option

All properties gain a new testContainer option which allows you to specify the context in which elements will be searched.

Let's say you use ember-wormhole to render a component outside the ember application container, now you can use this option to find component's elements in the DOM.

var page = PageObject.create({
  tooltip: {
    title: text('h1', { testContainer: 'body' })
  }
});

assert.equal(page.tooltip.title, 'Hello world!');

In this example the h1 element is searched anywhere inside the body element not only on the application's container.

Improve "Element .foo .bar .baz not found" error message

One of the main features of testing helpers is their ability to help us debug our code fast and easy. In ember-cli-page-object we could (and should) be doing a whole lot better job at reporting errors and this change is a step forward on that direction.

Let's say you have a crazy page object like this one

let page = create({
  foo: {
    bar: {
      baz: {
        qux: text('h1')
      }
    }
  }
});

And you try to access the qux node to retrieve the text of the h1 element, if the element doesn't exist on the DOM, the addon raises an element not found error.

We improved the error message so it's easier to spot where the problem is.

Before

Element h1 not found

<Stacktrace>

Now

Element not found

PageObject: 'page.foo.bar.baz.qux'
  Selector: 'h1'

<Stacktrace>

Community contributions

Downloads