I have very many tables in different pages of the platform and wanted to create a generic function such as - provide the table name and column label and wanted the text returned by the function back to the test.
I have imported this function into the test and am able to send the table definition without having the selector declaration in the function as well. For starters, the ability to return the tdText back to the test is what I am battling with. Any insight - or am I going about this totally wrong?
export async function columnMatcher(tableDefinition){
const table = tableDefinition;
const rowCount = await table.find('tbody > tr').count;
const columnCount = await table.find('tbody > tr').nth(0).find('*').count;
for(let i = 0; i < rowCount; i++) {
for(let j = 0; j < columnCount; j++) {
let tdText = await table.find('tbody > tr').nth(i).find('*').nth(j).textContent;
}
}
}
UPDATE: I was able to just add return tdText and it worked. However, I would like this as a client function. Still figuring out working with client functions.