Skip to content

Commit

Permalink
🧪 test(secrets): fix secrets tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thrownullexception committed May 27, 2024
1 parent 6a68fb1 commit 061e652
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/__tests__/integrations/variables__credentials.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AuthActions } from "frontend/hooks/auth/auth.actions";
import { getTableRows } from "__tests__/_/utils/getTableRows";
import { USE_ROUTER_PARAMS } from "__tests__/_/constants";
import { TestProviders } from "__tests__/_/Provider";
import { closeAllToasts } from "__tests__/_/utils/closeAllToasts";

setupApiHandlers();

Expand Down Expand Up @@ -177,6 +178,8 @@ describe("pages/integrations/variables => credentials", () => {
"Invalid Password"
);

await closeAllToasts();

const table = within(
screen.getByRole("tabpanel", { name: "Secrets" })
).getByRole("table");
Expand Down Expand Up @@ -278,10 +281,12 @@ describe("pages/integrations/variables => credentials", () => {
{ timeout: 2000 }
)
).toBeInTheDocument();

await closeAllToasts();
});
});

describe.skip("update", () => {
describe("update", () => {
it("should update secret", async () => {
render(
<TestProviders>
Expand Down Expand Up @@ -331,10 +336,12 @@ describe("pages/integrations/variables => credentials", () => {
within(dialog).getByRole("button", { name: "Update Secret" })
);

expect((await screen.findAllByRole("status"))[0]).toHaveTextContent(
expect(await screen.findByRole("status")).toHaveTextContent(
"Secret Saved Successfully"
);

await closeAllToasts();

await waitFor(async () => {
expect(await getTableRows(table)).toEqual([
"Key|Value|Action",
Expand Down Expand Up @@ -380,10 +387,12 @@ describe("pages/integrations/variables => credentials", () => {
within(dialog).getByRole("button", { name: "Create Secret" })
);

expect((await screen.findAllByRole("status"))[0]).toHaveTextContent(
expect(await screen.findByRole("status")).toHaveTextContent(
"Secret Saved Successfully"
);

await closeAllToasts();

expect(
await screen.findByRole(
"row",
Expand Down Expand Up @@ -433,7 +442,7 @@ describe("pages/integrations/variables => credentials", () => {

expect(await within(table).findAllByRole("row")).toHaveLength(4);

expect((await screen.findAllByRole("status"))[0]).toHaveTextContent(
expect(await screen.findByRole("status")).toHaveTextContent(
"Secret Deleted Successfully"
);
});
Expand Down

0 comments on commit 061e652

Please sign in to comment.