-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 527-custom-field-library-tab
- Loading branch information
Showing
159 changed files
with
4,058 additions
and
1,242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { stubPlus } from "cypress/support/stubs"; | ||
|
||
import { RoleRegistry } from "~/types/api"; | ||
|
||
const ALL_TILES = [ | ||
"View data map", | ||
"Add systems", | ||
"View systems", | ||
"Configure privacy requests", | ||
"Review privacy requests", | ||
]; | ||
|
||
const verifyExpectedTiles = (expectedTiles: string[]) => { | ||
expectedTiles.forEach((tile) => { | ||
cy.getByTestId(`tile-${tile}`); | ||
}); | ||
const remainingTiles = ALL_TILES.filter((t) => !expectedTiles.includes(t)); | ||
remainingTiles.forEach((item) => { | ||
cy.getByTestId(`tile-${item}`).should("not.exist"); | ||
}); | ||
}; | ||
|
||
describe("Home page", () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
describe("permissions", () => { | ||
beforeEach(() => { | ||
// For these tests, let's say we always have systems and connectors | ||
cy.intercept("GET", "/api/v1/system", { | ||
fixture: "systems/systems.json", | ||
}).as("getSystems"); | ||
cy.intercept("GET", "/api/v1/connection*", { | ||
fixture: "connectors/list.json", | ||
}).as("getConnectors"); | ||
stubPlus(true); | ||
}); | ||
|
||
it("renders all tiles when all scopes are available", () => { | ||
cy.assumeRole(RoleRegistry.ADMIN); | ||
cy.visit("/"); | ||
verifyExpectedTiles(ALL_TILES); | ||
}); | ||
|
||
it("renders viewer only tiles", () => { | ||
cy.assumeRole(RoleRegistry.VIEWER); | ||
cy.visit("/"); | ||
verifyExpectedTiles(["View data map", "View systems"]); | ||
}); | ||
|
||
it("renders privacy request manager tiles", () => { | ||
cy.assumeRole(RoleRegistry.PRIVACY_REQUEST_MANAGER); | ||
cy.visit("/"); | ||
verifyExpectedTiles(["Review privacy requests"]); | ||
}); | ||
|
||
it("renders privacy request manager + viewer tiles", () => { | ||
cy.assumeRole(RoleRegistry.VIEWER_AND_PRIVACY_REQUEST_MANAGER); | ||
cy.visit("/"); | ||
verifyExpectedTiles([ | ||
"View data map", | ||
"View systems", | ||
"Review privacy requests", | ||
]); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { stubPlus } from "cypress/support/stubs"; | ||
|
||
import { RoleRegistry } from "~/types/api"; | ||
|
||
describe("Routes", () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
describe("permissions", () => { | ||
beforeEach(() => { | ||
// For these tests, let's say we always have systems and connectors | ||
cy.intercept("GET", "/api/v1/system", { | ||
fixture: "systems/systems.json", | ||
}).as("getSystems"); | ||
cy.intercept("GET", "/api/v1/connection*", { | ||
fixture: "connectors/list.json", | ||
}).as("getConnectors"); | ||
stubPlus(true); | ||
}); | ||
|
||
it("admins can access many routes", () => { | ||
cy.assumeRole(RoleRegistry.ADMIN); | ||
cy.visit("/"); | ||
cy.visit("/add-systems"); | ||
cy.wait("@getSystems"); | ||
cy.getByTestId("add-systems"); | ||
cy.visit("/privacy-requests"); | ||
cy.getByTestId("privacy-requests"); | ||
cy.visit("/datastore-connection"); | ||
cy.wait("@getConnectors"); | ||
cy.getByTestId("connection-grid"); | ||
}); | ||
|
||
it("viewers and/or approvers can only access limited routes", () => { | ||
[ | ||
RoleRegistry.VIEWER, | ||
RoleRegistry.PRIVACY_REQUEST_MANAGER, | ||
RoleRegistry.VIEWER_AND_PRIVACY_REQUEST_MANAGER, | ||
].forEach((role) => { | ||
cy.assumeRole(role); | ||
// cannot access /add-systems | ||
cy.visit("/add-systems"); | ||
cy.getByTestId("add-systems").should("not.exist"); | ||
cy.getByTestId("home-content"); | ||
// cannot access /datastore-connection | ||
cy.visit("/datastore-connection"); | ||
cy.getByTestId("connection-grid").should("not.exist"); | ||
cy.getByTestId("home-content"); | ||
// can access /privacy-requests | ||
cy.visit("/privacy-requests"); | ||
cy.getByTestId("privacy-requests"); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
clients/admin-ui/cypress/fixtures/privacy-requests/messaging_configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"details": { | ||
"domain": "test-domain", | ||
"is_eu_domain": "false" | ||
}, | ||
"service_type": "MAILGUN" | ||
} |
Oops, something went wrong.