dimanche 6 septembre 2020

DOM Snapshot warning when assertions declared in page object is called twice inside same Test in TestCafe

I have declared async function in page object which has few assertions defined to validate for the presence of elements on a page and I have to call this function twice in same test but I am getting warning - "You passed a DOM snapshot property to the assertion's 't.expect()' method" even when I am not using await keyword in t.expect().

Please let me know how can I get rid of this warning.

fixture('Assertions in Page Object test suite').beforeEach(async t => {
  await t.useRole(login);
});

test('Validate UI for sample page, async t => {
  await pageObject.validateTableUI(t);
  await t.click(pageObject.changeTab); 
  await pageObject.validateTableUI(t);
});

The Page object method is :

export default class SamplePage {
constructor() {
this.table = Selector('table');
this.tableHeaders = Selector('table thead th);
this.changeTab = Selector('tab);
}

async validateTableUI(t){
await t
      .expect(this.table.visible)
      .ok()
      .expect(this.tableHeaders.visible)
      .ok()
      .expect(this.tableHeaders.nth(1).textContent)
      .contains('Column 1')
      .expect(this.tableHeaders.nth(2).textContent)
      .contains('Column 1');
}

Aucun commentaire:

Enregistrer un commentaire