question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'selectChoose' integration test is not working

See original GitHub issue

When i use ‘selectChoose(’.t-select-user’, ‘.ember-power-select-option’, 3); // Third option’ on my integration test i received this message:

Uncaught (in promise) Error: You called "selectChoose('.test-role-selector', '.ember-power-select-option')" but ".ember-power-select-option" didn't match any option at selectChoose$ (http://localhost:4200/assets/tests.js:1631:17) at tryCatch (http://localhost:4200/assets/vendor.js:8619:40) at GeneratorFunctionPrototype.invoke [as _invoke] (http://localhost:4200/assets/vendor.js:8886:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (http://localhost:4200/assets/vendor.js:8652:21) at GeneratorFunctionPrototype.invoke (http://localhost:4200/assets/vendor.js:8694:37) at <anonymous>

I managed to resolve this problem just calling clickTrigger('.test-role-selector'); before call ‘selectChoose’, but accordly to the documentation the ‘selectChoose’ was suposed to care of the entire process of opening a select and choosing. My test looks like this:

clickTrigger('.test-role-selector');
selectChoose('.test-role-selector', '.ember-power-select-option', 0);

I’m doing something wrong? Why i have to call ‘clickTrigger’?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cibernoxcommented, Aug 8, 2017

Ok, that is clear now. Your misconception is that the helper is asynchronous and you need to await for it to finish before asserting the result.

diff --git a/tests/integration/components/my-component-test.js b/tests/integration/components/my-component-test.js
index 14a31e7..2f8196e 100644
--- a/tests/integration/components/my-component-test.js
+++ b/tests/integration/components/my-component-test.js
@@ -6,11 +6,11 @@ moduleForComponent('my-component', 'Integration | Component | my component', {
   integration: true
 });

-test('it renders', function(assert) {
+test('it renders', async function(assert) {

   this.render(hbs`{{my-component}}`);

-  selectChoose('.test-trigger', '.ember-power-select-option', 0);
+  await selectChoose('.test-trigger', '.ember-power-select-option', 0);

   assert.equal(this.$('.selected-role').text().trim(), 'role1');
 });
diff --git a/typings/ember/ember.d.ts b/typings/ember/ember.d.ts
old mode 100755
new mode 100644
0reactions
BryanCrotazcommented, Oct 13, 2022

@cibernox I just got stuck on this one too. The docs are misleading:

selectChoose(cssPath, optionTextOrOptionSelector, index?)
This async helper allows you to select an option of a select by it's text, without worrying about if the select is single or multiple or if it is opened or closed.

fillIn('.username', 'Tomster');
selectChoose('.city-selector', 'Rome');
// ...
click('.submit-btn');

should be

await fillIn('.username', 'Tomster');
await selectChoose('.city-selector', 'Rome');
// ...
click('.submit-btn');
Read more comments on GitHub >

github_iconTop Results From Across the Web

Test helpers - Ember Power Select
Ember Power Select bundles some handy test helpers ( selectChoose , selectSearch , removeMultipleOption and clearSelected ) that make it nicer to interact ......
Read more >
Where is my test helper for ember-power-select?
It does not matter whether you see the tests/helpers/ember-power-select.js under your project. You can access it like this.
Read more >
Integration tests in ASP.NET Core | Microsoft Learn
Integration tests confirm that two or more app components work together ... If the SUT's environment isn't set, the environment defaults to ...
Read more >
Eksigent MicroLC 200 Plus System Integration Test and Data Log
Use this test as a measure of the MicroLC 200/200 Plus system performance in isolation of the performance of the other components. Results...
Read more >
Hi I have an integration test with QuestDB running in a test | Users ...
Hi I have an integration test with QuestDB running in a testcontainer I see from ... ILP But when I do a select...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found