Skip to content

Commit

Permalink
test: flay table header validation (#34080)
Browse files Browse the repository at this point in the history
Xpath used to read the header text is flaky.

Solution:
Replacing xpath with css locator to make it stable

EE PR: appsmithorg/appsmith-ee#4382
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
- Updated spec names and file paths for tests related to Community
Issues and TableV2 widget.

- **Refactor**
- Simplified the selector for table headers to improve readability and
maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
NandanAnantharamu committed Jun 7, 2024
1 parent cf18829 commit bf34395
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/client/cypress/support/Pages/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ export class Table {
private assertHelper = ObjectsRegistry.AssertHelper;

private _tableWrap = "//div[contains(@class,'tableWrap')]";
private _tableHeader =
this._tableWrap +
"//div[contains(@class,'thead')]//div[contains(@class,'tr')][1]";
private _tableHeader = ".thead div[role=columnheader]";
private _columnHeader = (columnName: string) =>
this._tableWrap +
"//div[contains(@class,'thead')]//div[contains(@class,'tr')][1]//div[@role='columnheader']//div[contains(text(),'" +
Expand Down Expand Up @@ -258,7 +256,7 @@ export class Table {
}

public AssertTableHeaderOrder(expectedOrder: string) {
cy.xpath(this._tableHeader)
cy.get(this._tableHeader)
.invoke("text")
.then((x) => {
expect(x).to.eq(expectedOrder);
Expand Down

0 comments on commit bf34395

Please sign in to comment.