Skip to content
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
25 changes: 19 additions & 6 deletions tests/cypress/e2e/dashboard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ describe("Role-based button functionality", () => {
cy.url().should("include", "/roles");
cy.visitWithToken("/dashboard");

cy.get("#btnVisits").contains("Control de visitas").click();
cy.url().should("include", "/visits");
cy.visitWithToken("/dashboard");

cy.get("#btnParcelControl").contains("Control de paquetería").click();
cy.url().should("include", "/packages");
cy.visitWithToken("/dashboard");
Expand All @@ -57,8 +53,6 @@ describe("Role-based button functionality", () => {
cy.get("#forbidden").should("not.be.visible");

cy.get("#guard").within(() => {
cy.get("#btnVisits").contains("Control de visitas").click();
cy.url().should("include", "/visits");
cy.visitWithToken("/dashboard");

cy.get("#btnParcelControl").contains("Control de paquetería").click();
Expand All @@ -85,4 +79,23 @@ describe("Role-based button functionality", () => {
cy.get("#admin").should("not.be.visible");
cy.get("#guard").should("not.be.visible");
});

it("should ensure 'Control de visitas' button is visible but disabled", () => {
cy.intercept(
{ method: "POST", url: "/actions/jwt-decode.php" },
{
statusCode: 200,
body: {
role: "guard",
},
},
).as("jwtDecode");

cy.visitWithToken("/dashboard");

cy.wait("@jwtDecode");

cy.get("#guard").should("be.visible");
cy.get("#btnVisits").should("be.visible").and("be.disabled");
});
});
2 changes: 1 addition & 1 deletion views/dashboard/blocks/visitsbutton.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
id="btnVisits"
class="btn btn-primary btn-lg me-3"
style="width: 150px; height: 150px"
onclick="navigateTo('/visits/')"
disabled
>
<span class="material-symbols-outlined">car_rental</span><br />
Control de visitas
Expand Down
Loading