Angular Version 5.2.3
Protractor和Angular的新手,在设置测试时遇到问题。我只能想象这可能是由于动画问题导致测试速度变慢,因为测试有时会过去。也许我需要采取不同的方法,但目标是看我是否可以排序表。有没有办法禁用动画?我尝试使用element.all(locator).allowAnimations抛出一个Angular未定义错误。
it('should sort full name column', async () => { // ignoring for now until figure out a way to wait until table sorts
await listUserPage.navigateTo();
await browser.wait(EC.presenceOf(listUserPage.userTable));
const unsortRows: string[] = [];
const sortRows: string[] = [];
// get all values of full name column
await listUserPage.tableRows.each(async (row) => {
const col = row.all(by.tagName('mat-cell')).get(0);
unsortRows.push(await col.getText());
});
// sort in order we expect
unsortRows.reverse();
await listUserPage.clickFullNameSort();
await listUserPage.clickFullNameSort(); // need to click twice, once for asc then again for desc
await browser.driver.sleep(500);
await listUserPage.tableRows.each(async (row) => {
const col = row.all(by.tagName('mat-cell')).get(0);
sortRows.push(await col.getText());
});