Skip to content

Commit

Permalink
Add dynamic test for row count
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaudiaGC1339 committed Dec 5, 2024
1 parent 8106e89 commit 746a94e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
15 changes: 9 additions & 6 deletions cypress/specs/dataset-data-preview-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ describe("Dataset data preview page", () => {
});

it("Should display the corret number of rows", () => {
// cy.get(".row-count")
// .its("length")
// .then((rowCount) => {
cy.get('p[data-testid="row-count"]').should("contain", "236 rows");
// });
cy.get('p[data-testid="row-count"]')
.invoke("attr", "data-row-count")
.then((rowCount) => {
cy.get('p[data-testid="row-count"]').should(
"contain",
`${rowCount} rows`
);
});
});

it.only("Should display the table or report table", () => {
it("Should display the table or report table", () => {
cy.get('table[data-testid="data-table"]').should("exist");
cy.get(".data-preview-headers").should("exist");
cy.get(".data-preview-body")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ <h3 class="govuk-notification-banner__heading">
</ul>
</nav>
</div>
<p class="row-count govuk-body-s" data-testid="row-count">
<p
class="row-count govuk-body-s"
data-testid="row-count"
data-row-count="{{row_count}}"
>
{{row_count}} rows
</p>
</div>
Expand Down

0 comments on commit 746a94e

Please sign in to comment.