[英]How to verify the first row of an Angular grid after updating the order of the rows?
I'm trying to create a Protractor test for an Angular Grid .我正在尝试为Angular Grid创建 Protractor 测试。
For my test, I am clicking a column on the grid, this then re-orders the rows.对于我的测试,我单击网格上的一列,然后重新排列行。
After this click, I want to verify the order of the rows has been updated correctly, by checking the first cell in that row.单击此按钮后,我想通过检查该行中的第一个单元格来验证行的顺序是否已正确更新。
Below is my test code:下面是我的测试代码:
myNavbarPage.API_610_Table_H1_button.click();
browser.sleep(2000);
myApi610TableH1.Parts_table_header.click();
browser.sleep(5000);
const first = element.all(by.css('div.ag-cell[aria-colindex="1"]')).first();
expect(first.getText()).toBe('Case Gaskets');
The problem I am facing is that first.getText()
is returning the value of the first row in the original order, rather than the updated order.我面临的问题是first.getText()
以原始顺序返回第一行的值,而不是更新后的顺序。
Can someone please tell me how I can verify the cell within the first row after the grid has been updated?有人可以告诉我如何在网格更新后验证第一行中的单元格吗?
Note: I've added the browser.sleep()
just for myself, so I can validate the button clicks, re-ordering, etc. are all working as expected.注意:我已经为自己添加了browser.sleep()
,所以我可以验证按钮点击、重新排序等都按预期工作。
There may be many reasons why it's happening, but to begin with, try to add async/await
它发生的原因可能有很多,但首先,尝试添加async/await
it('test case', async () => {
await myNavbarPage.API_610_Table_H1_button.click();
await browser.sleep(2000);
await myApi610TableH1.Parts_table_header.click();
await browser.sleep(5000);
const first = element.all(by.css('div.ag-cell[aria-colindex="1"]')).first();
expect(await first.getText()).toBe('Case Gaskets');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.