Last active
November 29, 2018 13:19
-
-
Save san650/17174e4b7b1fd80b049a47eb456a7cdc to your computer and use it in GitHub Desktop.
ember-cli-page-object deprecations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ID:ember-cli-page-object.comma-separated-selectors | |
// Comma separated selectors are not supported in ember-cli-page-object. These selectors are going to throw an error in ember-cli-page-object v2.0. | |
// BAD | |
// <h1>A big title</h1> | |
// <h2>A smaller title</h2> | |
import { create, text } from "ember-cli-page-object"; | |
var page = create({ | |
title: text("h1, h2") | |
}); | |
// GOOD | |
// <h1 data-test-title>A big title</h1> | |
// <h2 data-test-title>A smaller title</h2> | |
import { create, text } from "ember-cli-page-object"; | |
var page = create({ | |
title: text("[data-test-title]") | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ID:ember-cli-page-object.import-from-test-support | |
// Importing page object helpers from `tests/` folder is deprecated. This behavior is going to be removed in ember-cli-page-object v2.0. | |
// BAD | |
import PageObject from "my-app/tests/page-object"; | |
var page = PageObject.create({ | |
title: PageObject.text("h1") | |
}); | |
// GOOD | |
import { create, text } from "ember-cli-page-object"; | |
var page = create({ | |
title: text("h1") | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ID:ember-cli-page-object.old-collection-api | |
// Simplified collections. Old collection API is going to be removed in ember-cli-page-object v2.0. | |
// Collection definition | |
// <table> | |
// <caption>List of users</caption> | |
// <tbody> | |
// <tr> | |
// <td>Mary<td> | |
// <td>Watson</td> | |
// </tr> | |
// <tr> | |
// <td>John<td> | |
// <td>Doe</td> | |
// </tr> | |
// </tbody> | |
// </table> | |
// BAD | |
const page = PageObject.create({ | |
users: collection({ | |
itemScope: 'table tr', | |
item: { | |
firstName: text('td', { at: 0 }), | |
lastName: text('td', { at: 1 }) | |
}, | |
caption: text('caption') | |
}); | |
}); | |
assert.equal(page.users().count, 2); | |
assert.equal(page.users(1).firstName, 'John'); | |
// GOOD | |
const page = PageObject.create({ | |
users: collection('table tr', { | |
firstName: text('td', { at: 0 }), | |
lastName: text('td', { at: 1 }) | |
}), | |
usersCaption: text('caption') | |
}); | |
assert.equal(page.users.length, 2); | |
assert.equal(page.users.objectAt(1).firstName, 'John'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ID: ember-cli-page-object.page-render | |
// Using page.render('{{foo}}') to render a component is deprecated. This behavior is going to be removed in ember-cli-page-object v2.0. | |
import { moduleForComponent, test } from 'ember-qunit'; | |
import hbs from 'htmlbars-inline-precompile'; | |
import { create } from 'ember-cli-page-object'; | |
moduleForComponent('calculating-device', 'Deprecation | page.render()', { | |
integration: true, | |
beforeEach() { | |
this.page = create({context: this}); | |
} | |
}); | |
test('renders component', function(assert) { | |
// BAD | |
this.page.render(hbs`{{foo}}`); | |
// GOOD | |
this.render(hbs`{{foo}}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment