I was wondering how to use page object variable on .each()
function.
The scenario is every I click delete link, the sweet alert confirmation will be shown, and I must confirm that dialog to delete the data.
Here is my page object:
'use strict';
// page object name
var Data = function()
{
// all delete links
this.delete_links = element.all(by.css('div[ng-click="delete(Data.id)"]'));
// confirm button
this.btn_confirm = element(by.css('.confirm'));
// delete function
this.delete = function()
{
// delete all links with confirmation
this.delete_links.each(function(element, index)
{
// click delete link
element.click().then(function()
{
browser.sleep(1000);
});
// click yes
this.btn_confirm.click().then(function()
{
browser.sleep(1000);
});
});
};
};
module.exports = Data;
Aucun commentaire:
Enregistrer un commentaire