Skip to content

Conversation

@asirvadAbrahamVarghese
Copy link
Contributor

@asirvadAbrahamVarghese asirvadAbrahamVarghese commented Oct 28, 2025

PR to:

  • Add cypress command to click on table row based on text, with optional column index, if index is provided will directly look into that column for match, here ⬇️ column index provided is 6:
image
  • Enhance gtl_no_record(currently no usages) command to be more versatile. The command was previously using the no-record class as selector, but here ⬇️ it uses no-records-found. To make the assertion more reliable, I removed the class from the selector and switched to asserting based on the visible text instead.
image

Also not sure if this might be better under assertion commands(cypress/support/assertions/)

@miq-bot add-label cypress
@miq-bot add-label enhancement
@miq-bot assign @jrafanie


Cypress.Commands.add('gtl_no_record', () => {
return cy.get('#miq-gtl-view > div.no-record').should('be.visible');
Cypress.Commands.add('verify_gtl_no_records_text', ({ containsText = 'No records' } = {}) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this might be better under assertion commands(cypress/support/assertions/)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea.... looks like it follows expect_* convention. Maybe expect_gtl_no_records_with_text or having_text... I think you use with text more commonly elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going with expect_gtl_no_records_with_text 👍

if (columnIndex || columnIndex === 0) {
cy.contains(`.miq-data-table table tbody tr td:nth-child(${columnIndex + 1})`, text).click();
} else {
cy.contains('.miq-data-table table tbody tr td', text).click();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 It's good to be case sensitive here and expect exact text since we'll be creating the objects with the right text so it should be easy to ensure we match it correctly.

It will be interesting to see if this miq-data-table structure holds for all pages containing the data table. I hope so but we'll see as we do more pages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I had the same doubt, that’s why I’m keeping the selector minimal(without including classes) for now. Let’s see how it goes....

Copy link
Member

@jrafanie jrafanie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far. I agree with the rename/move to the assertions directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants