Below is the test code snippet I am working with:
ID = {
CreatedBy: { id: 'createdBy' },
ModifiedBy: { id: 'modifiedBy' }
}
Profile = {
All: { text: 'All', val: 0 },
Sys: { text: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6b1812181f0e06341812181f0e062b1812181f0e0645080406">[email protected]</a>', val: 1 },
Test: { text: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="70041503042f05031502301c1906155e131f1d">[email protected]</a>', val: 2 }
}
changeSelect(dataId: EnumElement[], params: UserEnum[]) {
dataId.forEach((data) => {
params.forEach((elem) => {
var label = data.id+ ' - Check option changed to - ' + elem.text;
it(label, () => {
return element(by.xpath('//select[@id="' + data.id + '"]/option[@value = "' + elem.val + '"]')).click();
});
});
}
In my testing scenario, I invoke the changeSelect() function like so:
changeSelect([ID.CreatedBy, ID.ModifiedBy], [Profile.Sys, Profile.Test]);
The current output of my changeSelect() function looks like:
createdBy - Check option changed to - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1a6963696e7f77456963696e7f775a6963696e7f7734797577">[email protected]</a>
createdBy - Check option changed to - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="097d6c7a7d567c7a6c7b4965607f6c276a6664">[email protected]</a>
modifiedBy - Check option changed to - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="becdc7cdcadbd3e1cdc7cdcadbd3fecdc7cdcadbd390ddd1d3">[email protected]</a>
modifiedBy - Check option changed to - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7d09180e0922080e180f3d11140b18531e1210">[email protected]</a>
However, I aim for a different output. How can I adjust my loop to achieve this desired result?
createdBy - Check option changed to - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="582b212b2c3d35072b212b2c3d35182b212b2c3d35763b3735">[email protected]</a>
modifiedBy - Check option changed to - <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="88fcedfbfcd7fdfbedfac8e4e1feeda6ebe7e5">[email protected]</a>