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

chore: Update selectors for Table Response #38302

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/client/cypress/locators/QueryEditor.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"addDatasource": ".t--add-datasource",
"editDatasourceButton": ".t--edit-datasource",
"switch": ".t--form-control-SWITCH input",
"queryResponse": "(//div[@class='table']//div[@class='tr'])[3]//div[@class='td']",
"queryResponse": "(//div[@class='table']//div[@class='tr'])[3]//div[@class='td mp-mask']",
"querySelect": "//div[contains(@class, 't--template-menu')]//div[text()='Select']",
"queryCreate": "//div[contains(@class, 't--template-menu')]//div[text()='Create']",
"queryUpdate": "//div[contains(@class, 't--template-menu')]//div[text()='Update']",
Expand Down
4 changes: 2 additions & 2 deletions app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ Cypress.Commands.add("ValidatePaginateResponseUrlData", (runTestCss) => {
cy.wait(2000);
cy.get(runTestCss).click();
cy.wait(2000);
cy.xpath("//div[@class='tr'][1]//div[@class='td'][6]//span")
cy.xpath("//div[@class='tr'][1]//div[@class='td mp-mask'][6]//span")
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider using data- attributes instead of direct XPath.*
The updated selector relies on XPath with a class-based path. Please switch to data-* attributes or other recommended locators for improved robustness and maintainability.

.invoke("text")
.then((valueToTest) => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
Expand All @@ -839,7 +839,7 @@ Cypress.Commands.add("ValidatePaginateResponseUrlDataV2", (runTestCss) => {
cy.wait(2000);
cy.get(runTestCss).click();
cy.wait(2000);
cy.xpath("//div[@class='tr'][1]//div[@class='td'][6]//span")
cy.xpath("//div[@class='tr'][1]//div[@class='td mp-mask'][6]//span")
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Refactor to avoid XPath usage.
Again, the locator references an element by class name using XPath. Adopting data-* attributes or referencing an existing locator would align better with recommended Cypress practices.

.invoke("text")
.then((valueToTest) => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
Expand Down
Loading