Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create function to search in table based in name #26

Open
mmartin24 opened this issue Feb 5, 2024 · 0 comments
Open

Create function to search in table based in name #26

mmartin24 opened this issue Feb 5, 2024 · 0 comments
Labels
automation Add or update automation

Comments

@mmartin24
Copy link
Collaborator

mmartin24 commented Feb 5, 2024

Task

For Cypress tests create a function that can search in any table given a column name or other parameter, matches the row where that value is passed, and return other parameters in that row.

Example snippet:

// WIP To be improved
// It should return value given a coluname and another row parameter.
// It should be possible find multiple columnames and rowvalues.
// Cypress.Commands.add('searchInTable', (columnName, textToMatch) => {
//   cy.get("table > thead > tr > th")
//     .each(($e1, index, $) => { //iterating through array of elements
//       const StoreText = $e1.text().trim(); //storing iterated element in text
//       if (StoreText.includes(columnName)) {
//         //If text found, iteration stops and checks textToMatch is present
//         cy.get('tbody tr td')
//           .eq(index)
//           .then(($td) => {
//             const Assigneetext = $td.text().trim();
//             // cy.wrap(`Column "${columnName}" value is ` + Assigneetext, { timeout: 25000 }).should('contain', textToMatch);
//             cy.wrap(`Column "${columnName}" value is ` + Assigneetext, { timeout: 25000 }).should('contain', textToMatch);
//           });
//       }
//     })
// })
@sbulage sbulage added the automation Add or update automation label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation Add or update automation
Projects
None yet
Development

No branches or pull requests

2 participants