Skip to content

Instantly share code, notes, and snippets.

@dfreeman
Last active June 29, 2016 17:26
Show Gist options
  • Save dfreeman/6f7689d10ec6877e484f9f0a0ab2b842 to your computer and use it in GitHub Desktop.
Save dfreeman/6f7689d10ec6877e484f9f0a0ab2b842 to your computer and use it in GitHub Desktop.
Page Object Failure
<div class="left">
<div class="items-list">
<div class="item">one</div>
<div class="item">two</div>
<div class="item">three</div>
</div>
</div>
<div class="right">
<div class="items-list">
<div class="item">one</div>
<div class="item">two</div>
<div class="item">three</div>
</div>
</div>
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { create, collection, text } from 'ember-cli-page-object';
moduleForComponent('my-component', { integration: true });
const itemCollection = {
itemScope: '.item',
item: {
label: text()
}
};
test('it renders', function(assert) {
// This assertion passes on 1.4.0 and 1.4.1
assert.equal(itemCollection.itemScope, '.item');
// This object works correctly
const left = create({
scope: '.left',
items: collection(itemCollection)
}).setContext(this);
// This object doesn't work, because `item` and `itemScope` are missing
const right = create({
scope: '.right',
items: collection(itemCollection)
}).setContext(this);
this.render(hbs`{{my-component}}`);
assert.deepEqual(left.items().mapBy('text'), ['one', 'two', 'three']);
assert.deepEqual(right.items().mapBy('text'), ['one', 'two', 'three']);
// This assertion (same as the first) passes on 1.4.0 and fails on 1.4.1
assert.equal(itemCollection.itemScope, '.item');
});
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
setResolver(resolver);
{
"version": "0.10.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": true
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {
"ember-cli-page-object": "1.4.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment