赛普拉斯测试掌上电脑

cypress to test handsontable

我正在使用 cypress 进行端到端测试。有一个屏幕,我使用 handsontable。它类似于 excel sheet。我无法使用柏树将内容写入其单元格,因为该单元格实际上只是一个 td,但在内部它在编辑时被映射到一个 textarea

有人可以提供使用 cypress 在其单元格中输入文本的测试吗?

我绑定了下面的,但是没用

cy.get('.handsontable tbody tr:nth-child(1) td:nth-child(2)').dblclick().type('test');

如果无法输入,您可以尝试在如下标识的字段中粘贴 text;我有 运行 下面的测试,我可以将 AUD 粘贴到第一个 td 行的 currency 列中。我在 Windows 10 OS 上使用赛普拉斯版本 3.1.2,Chrome 70 测试 运行ner

describe("Cypress test on handsontable", function() {
  it("Some test on handsontable", function() {
  cy.visit("https://handsontable.com/examples?headers")
  cy.get('.handsontable tbody tr:nth-child(1) td:nth-child(5)').then($td => {
      $td.text('AUD');
     });
   });
});

我能够输入具有以下规范的单元格。

context('handsontable', () => {
  it('handsontable', () => {
    cy.visit("https://handsontable.com/examples?headers");
    cy.get('.handsontable tbody > :nth-child(10) > :nth-child(2)').click().click().get('.handsontableInput').type('test');
  })
})

由于某种原因 dblclick() 没有工作。