How to cache data with JavaScript testing ?
My code:
var welcome = browser.page.welcome();
welcome.navigate();
welcome.expect.element('@usersButton').to.be.visible.before(2000);
var users = browser.page.users();
welcome.click('@usersButton');
users.expect.element('@idUsersTableFirstRow').to.be.visible.before(1000);
var positionMainPage = users.getText('@positionUsersTableFirstRow');
var idMainPage = users.getText('@idUsersTableFirstRow');
var emailMainPage = users.getText('@emailUsersTableFirstRow');
users.click('@idUsersTableFirstRow');
users.expect.element('@userDetailsFirstName').to.be.visible.before(2000);
users.expect.element('@userDetailsPosition').text.to.equal(positionMainPage).after(500);
users.expect.element('@userDetailsId').text.to.equal(idMainPage).after(500);
users.expect.element('@userDetailsEmail').text.to.equal(emailMainPage).after(500);`
TC steps: Open page and press Users button / Remember value of position, id and email from the first record in the table / Click on the first record in the table to move to details view /In details view check that data of position, id, email are relevant to these cached ones.
Have tired approach as I used in pure Java but seems it doesn't work.
Getting an assertion error that:
Expected element <#position> text to equal: "[object Object]" after 500ms - expected "equal '[object Object]'" but got: TEST_VALUE
Aucun commentaire:
Enregistrer un commentaire