Last active
November 27, 2020 05:09
-
-
Save migbar/3d961ddb7aaad1588949 to your computer and use it in GitHub Desktop.
ember-cli-page-object extension for ember-power-select
This file contains 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
// 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') | |
} |
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
Hi, I created this file in the tests/helpers folder and imported it into a page object like
import {
selectableChoose
} from '../helpers/ember-cli-page-object-extensions';
When I now try to use it then I get the following error:
undefined is not a constructor