vendredi 12 juin 2020

Test fails find(selector).count

I would like to test the filter functionality of items in list-table. On the list, there are 5 elements. After typing stringing eg. "a" into input "Search", there are 2 elements. And this case the DOM looks following (there are visible only 2 'li' not 5):

<ul _ngcontent-nin-c20="" class="list-group">
<!---->
<!---->
<!---->
<li _ngcontent-nin-c20="" class="ng-star-inserted">...</li>
<!---->
<!---->
<!---->
<li _ngcontent-nin-c20="" class="ng-star-inserted">...</li>
<!---->
<!---->
<!---->
<!---->
</ul>

I defined selectors following way in editPage.js:

 this.chosenListGroup = Selector('[class="list-group"]');
 this.listGroup = Selector('.form-check-input');

My code where I want to check the number of chosen items looks:

await t
.typeText(editPage.searchField, 'Drama')
.expect(editPage.chosenListGroup.find(editPage.listGroup)
.count)
.eql(1);

I received the following error: " TypeError: Cannot read property 'find' of undefined"

  1. I do not understand why 'find' is undefined. Where is a bug?
  2. Is my logic to test the filter ok?

Could you answer my question, please?

Aucun commentaire:

Enregistrer un commentaire