dimanche 4 novembre 2018

Testing a Select Element with ember-cli-page-object

Not certain if I'm missing something, this seems like it should be built in. I'm using a native select dropdown on a site and am having issues figuring out how to implement it into my integration tests.

This is part of the page object I'm testing against.

  apiSelect: {
    scope: 'section.api-selector block-select',
    select: clickable('.select-dropdown'),
    options: collection('option', {
      label: text(),
      select: clickable()
    }),
    value: value('select'),
    isDisabled: is(':disabled', 'select')
  }

await component.content.customAnswers.apiSelect.select();
    assert.deepEqual(
      api.customAnswers.selectedAnswers,
      [ 'my-api-answer' ],
      'see api answer is set'
    );

I know the above doesn't work (nor should it), but I'd expect at the least for the dropdown to actually receive a click action and be displayed as opened during my test.

Essentially, I need to find a way to open this drop down and have it select an option.

I looked through everything on http://ember-cli-page-object.js.org/docs/v1.14.x/ and wasn't able to find anything outlining how to do this. It seems like it should be super simple, but maybe not? I see a lot of addons for select, but would rather not add another package unless I have to.




Aucun commentaire:

Enregistrer un commentaire