Skip to content

Instantly share code, notes, and snippets.

@migbar
Last active November 27, 2020 05:09
Show Gist options
  • Save migbar/3d961ddb7aaad1588949 to your computer and use it in GitHub Desktop.
Save migbar/3d961ddb7aaad1588949 to your computer and use it in GitHub Desktop.
ember-cli-page-object extension for ember-power-select
// helpers/ember-cli-page-object-extensions.js
import { buildSelector } from '../page-object';
let selectableChoose = function(selector, options = {}) {
return {
isDescriptor: true,
value(textToSelect) {
wait().then(function() {
selectChoose(buildSelector(this, selector, options), textToSelect);
});
return this;
}
};
}
let selectableSearch = function(selector, options = {}) {
return {
isDescriptor: true,
value(textToSearch) {
wait().then(function() {
selectSearch(buildSelector(this, selector, options), textToSearch);
});
return this;
}
};
}
export default {
selectableChoose,
selectableSearch
}
//use it from a page object scope:
customer: {
scope: '.customer',
selectTitle: selectableChoose('.title')
}
@sukima
Copy link

sukima commented Jan 19, 2017

This only works for acceptance tests, correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment