Ionic框架模态的量角器测试点击不起作用

时间:2015-03-08 19:17:55

标签: angularjs ionic-framework protractor

我正在使用 Ionicframework 构建一个应用程序,其中我有一个带有指令列表的模态。我现在正在编写一些量角器E2E测试,一切顺利,直到我不得不点击其中一个指令。

我得到的错误是:

UnknownError: unknown error: Element is not clickable at point (185, 212). Other element would receive the click: <div class="modal-backdrop active">...</div>

这可能与模态滑动的动画有关,所以我找到了这个'解决方案':

it 'is very annoying', ->
  members = element.all(By.css('member')) # The directives are: <member >
  EC = protractor.ExpectedConditions

  if members.first()
    browser.wait(EC.elementToBeClickable(members.first()), 5000).then ->
      element.all(By.css('member')).each (member) ->
        member.click()

但我仍然得到错误。

browser.sleep(2000)这样的'技巧'到目前为止还没有奏效。

有谁知道如何让它发挥作用?

1 个答案:

答案 0 :(得分:3)

像往常一样,在问这样的问题时,你不得不把所有东西都砍成基础并开始思考开箱即用(至少你自己的方框)。

解决方案:

element(By.cssContainingText('member .member-name', "Mark Twain")).click()

这是因为Angular会从指令中弹出div并绑定所有事件。 .member-name是成员内部的p,点击它显然可以解决问题。

:)