-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fixes user permissions updates (#4985) * update alerts * fix relationship mutation * add test for role crud * update test * fix modal delete * fix modal delete * fix global permission delete modal * fix test * fix update global permission * update test * add test id in loader + update test * add fragment
- Loading branch information
Showing
12 changed files
with
173 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* Fix Graphql mutations to make user permissions updates work correctly | ||
* Update the alert message to better reflect the changes (between creation and update) | ||
* Fix the objects delete modal on the global permission view | ||
* Fix the global permission update mutation |
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,4 @@ | ||
* Fix Graphql mutations to make user permissions updates work correctly | ||
* Update the alert message to better reflect the changes (between creation and update) | ||
* Fix the objects delete modal on the global permission view | ||
* Fix the global permission update mutation |
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
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
103 changes: 103 additions & 0 deletions
103
frontend/app/tests/e2e/role-management/roles-crud.spec.ts
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,103 @@ | ||
import { expect, test } from "@playwright/test"; | ||
import { ACCOUNT_STATE_PATH } from "../../constants"; | ||
|
||
test.describe("Role management - Roles CRUD", () => { | ||
test.use({ storageState: ACCOUNT_STATE_PATH.ADMIN }); | ||
test.describe.configure({ mode: "serial" }); | ||
|
||
test("should create a role ", async ({ page }) => { | ||
await test.step("access main view", async () => { | ||
await page.goto("/role-management/roles"); | ||
}); | ||
|
||
await test.step("create role", async () => { | ||
await expect(page.getByText("Retrieving roles...")).not.toBeVisible(); | ||
await page.getByRole("button", { name: "Create Account role" }).click(); | ||
await page.getByLabel("Name *").click(); | ||
await page.getByLabel("Name *").fill("test role"); | ||
await page.getByLabel("Groups").click(); | ||
await page.getByTestId("side-panel-container").getByText("Infrahub Users").click(); | ||
await page.getByLabel("Groups").click(); | ||
await page.getByTestId("side-panel-container").getByLabel("Permissions").click(); | ||
await page | ||
.getByTestId("side-panel-container") | ||
.getByText("global:super_admin:allow_all") | ||
.first() | ||
.click(); | ||
await page | ||
.getByTestId("side-panel-container") | ||
.getByText("global:manage_repositories:") | ||
.click(); | ||
await page.getByTestId("side-panel-container").getByLabel("Permissions").click(); | ||
await page.getByRole("button", { name: "Create" }).click(); | ||
await expect(page.getByText("Role created!")).toBeVisible(); | ||
}); | ||
|
||
await test.step("verify role creation", async () => { | ||
await expect(page.getByRole("cell", { name: "test role" })).toBeVisible(); | ||
await expect( | ||
page | ||
.getByRole("cell", { | ||
name: "global:super_admin:allow_all global:manage_repositories:allow_all", | ||
}) | ||
.locator("div") | ||
.first() | ||
).toBeVisible(); | ||
}); | ||
}); | ||
|
||
test("should update a role ", async ({ page }) => { | ||
await test.step("access main view", async () => { | ||
await page.goto("/role-management/roles"); | ||
}); | ||
|
||
await test.step("update role", async () => { | ||
await page | ||
.getByRole("row", { name: "test role Infrahub Users" }) | ||
.getByTestId("actions-row-button") | ||
.click(); | ||
await page.getByTestId("update-row-button").click(); | ||
await page.getByLabel("Name *").click(); | ||
await page.getByLabel("Name *").fill("test role 2"); | ||
await page.getByLabel("Groups").click(); | ||
await page.getByLabel("", { exact: true }).getByText("Infrahub Users").click(); | ||
await page.getByTestId("side-panel-container").getByText("Super Administrators").click(); | ||
await page.getByLabel("Groups").click(); | ||
await page.getByTestId("side-panel-container").getByLabel("Permissions").click(); | ||
await page | ||
.getByTestId("side-panel-container") | ||
.getByText("global:manage_schema:allow_all") | ||
.click(); | ||
await page.getByTestId("side-panel-container").getByLabel("Permissions").click(); | ||
await page.getByRole("button", { name: "Update" }).click(); | ||
await expect(page.getByText("Role updated!")).toBeVisible(); | ||
}); | ||
|
||
await test.step("verify role update", async () => { | ||
await expect(page.getByText("test role 2")).toBeVisible(); | ||
await expect(page.getByText("Super Administrators").nth(1)).toBeVisible(); | ||
}); | ||
}); | ||
|
||
test("should delete a role ", async ({ page }) => { | ||
await test.step("access main view", async () => { | ||
await page.goto("/role-management/roles"); | ||
}); | ||
|
||
await test.step("delete role", async () => { | ||
await page | ||
.getByRole("row", { name: "test role 2" }) | ||
.getByTestId("actions-row-button") | ||
.click(); | ||
await page.getByTestId("delete-row-button").click(); | ||
await page.getByTestId("modal-delete-confirm").click(); | ||
await expect(page.getByText("Are you sure you want to remove")).not.toBeVisible(); | ||
await expect(page.getByText("Object test role 2 deleted")).toBeVisible(); | ||
}); | ||
|
||
await test.step("verify role delete", async () => { | ||
await expect(page.getByTestId("objects-search-input-loader")).not.toBeVisible(); | ||
await expect(page.getByText("test role 2")).not.toBeVisible(); | ||
}); | ||
}); | ||
}); |