lundi 16 novembre 2020

EmberJS testing: target id created from each loop

I used an each loop to create a unique id for every input that's created. Ex: id='amount0', id='amount1', etc.. but I can't target them during testing, it says the element is not found.

Error

Promise rejected during "Amount input works": Element not found when calling `fillIn('#amount0')`.

HBS file:


<p output-test-info>
    <button onclick=>-</button>
    
    <input id="amount" onchange=>
</p>

Test file:

test('Amount input works', async function(assert){
    const itemList = document.queryCommandValue('output-test-info');
    this.set('tempName', [{name: 'bobby'}, {name: 'peter'}]);
    this.set('tempAct', [{activity: 'dinner'}, {activity: 'movies'}])
    await render(hbs`<Output @userinfo= @userAct=/>`);

    await fillIn('#amount0', '20');
  })



Aucun commentaire:

Enregistrer un commentaire