AngularJS e2e测试ng表过滤器

AngularJS e2e测试ng表过滤器,angularjs,ngtable,Angularjs,Ngtable,我将AngularJS 1.2.10与ng表一起使用,并使用jasmine&karma编写了我的第一个端到端测试 问题是,当我输入一个过滤器输入框(由ng表提供)时,我测试中的列表不会自动更新,即:它没有在测试中运行过滤器。不过,当我通过浏览器手动测试它时,我确实可以工作 这是我的测验 it "should allow filtering on name", -> browser().navigateTo('#/debtors') expect(browser().lo

我将AngularJS 1.2.10与ng表一起使用,并使用jasmine&karma编写了我的第一个端到端测试

问题是,当我输入一个过滤器输入框(由ng表提供)时,我测试中的列表不会自动更新,即:它没有在测试中运行过滤器。不过,当我通过浏览器手动测试它时,我确实可以工作

这是我的测验

  it "should allow filtering on name", ->
    browser().navigateTo('#/debtors')
    expect(browser().location().path()).toBe("/debtors")
    element(".ng-table-filters > th:nth-child(2) input").val('John')
    sleep(10)
    expect(repeater('.table > tbody tr').count()).toBeGreaterThan(0)
    expect(repeater('.table > tbody tr').row(0)).toContain("John Smith")
这是我的过滤代码:

<table ng-table="tableParams" show-filter="true" class="table">
  <button ng-click="tableParams.sorting({code: 'asc'})" class="btn btn-default pull-right">Clear sorting</button>
  <button ng-click="tableParams.filter({})" class="btn btn-default pull-right">Clear filter</button>
  <tr class='listing' ng-repeat="debtor in $data">
    <td data-title="'Code'" sortable="'code'" filter="{ 'code': 'text'}">
      {{debtor.code}}
    </td>
    <td data-title="'Name'" sortable="'name'" filter="{ 'name': 'text'}">
      {{debtor.name}}
    </td>
    <td>
      <a href="/api#/clients/{{debtor.id}}">Show</a>
      <a href="/api#/clients/{{debtor.id}}/edit">Edit</a>
      <a href="" ng-confirm-click="destroy(debtor.id)">Delete</a>
    </td>
  </tr>
</table>

清分
透明过滤器
{{债务人代码}
{{债务人名称}

当手动测试时,在显示结果之前会有一个轻微的停顿,我不需要点击任何提交按钮。当我在测试中这样做的时候,虽然看起来ngTable事件没有触发。

我开始使用量角器,而量角器更适合AngularJS项目

describe('filter debtor', ->

  beforeEach ->
    helper.login()

  afterEach ->
    helper.logout()

  describe "when person", ->
    it 'shows the client after creation', ->
      browser.get('/api#/clients/new_debtor')
      element(By.id("name")).sendKeys("John")
      element(By.id("surname")).sendKeys("Smith")
      element(By.id("create_btn")).click()

      browser.get('/api#/debtors')
      element.all(By.model("params.filter()[name]")).last().sendKeys("John")
      first=element.all(By.id("listing")).first()
      expect(first.getText()).toContain("John Smith")