Skip to content

Commit

Permalink
Treasury creation: add cancel button (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubycop authored Jan 1, 2025
1 parent d7e8b05 commit 22087f0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ const PERMISSIONS = {
vote: "Vote",
};

const storageAccountName = Storage.privateGet("accountName");
const storageAccountName = useMemo(() => Storage.privateGet("accountName"));

useEffect(() => {
if (storageAccountName) {
setShowCongratsModal(true);
Storage.privateSet("accountName", null);
}
}, [storageAccountName]);

Expand Down Expand Up @@ -362,7 +361,10 @@ return (
</div>
</div>
),
onClose: () => setShowCongratsModal(false),
onClose: () => {
setShowCongratsModal(false);
Storage.privateSet("accountName", null);
},
}}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ const Wrapper = ({ title, children }) => (
<div className="d-flex flex-column align-items-center w-100 mb-4">
<div className="d-flex w-100 align-items-center mb-2">
<div style={{ width: "150px" }}>
<button className="btn btn-outline-plain w-100" onClick={() => {}}>
<a
className="btn btn-outline-plain w-100"
href={`https://near.social/${REPL_DEVDAO_ACCOUNT}/widget/app`}
>
Cancel creation
</button>
</a>
</div>
<div
style={{ width: "calc(100% - 300px)" }}
Expand Down
34 changes: 34 additions & 0 deletions playwright-tests/tests/page.treasury-factory.near.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { expect } from "@playwright/test";
import { test } from "../util/test.js";

test.afterEach(async ({ page }, testInfo) => {
console.log(`Finished ${testInfo.title} with status ${testInfo.status}`);
await page.unrouteAll({ behavior: "ignoreErrors" });
});

test.describe("admin connected", function () {
test.use({
contextOptions: {
permissions: ["clipboard-read", "clipboard-write"],
},
storageState: "playwright-tests/storage-states/wallet-connected-admin.json",
});

test("should go to treasury self creation page", async ({
page,
factoryAccount,
}) => {
await page.goto(`/${factoryAccount}/widget/app?page`);

await expect(
await page.locator("h3").filter({ hasText: "Treasury Creation" })
).toBeVisible();

await expect(await page.getByText("Treasury Creation")).toBeVisible();

await page
.locator("a")
.filter({ hasText: "Yes, use this wallet and continue" })
.click();
});
});
1 change: 1 addition & 0 deletions playwright-tests/util/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export const test = base.extend({
instanceAccount: ["treasury-devdao.near", { option: true }],
daoAccount: ["devdao.sputnik-dao.near", { option: true }],
lockupContract: ["devdao.lockup.near", { option: true }],
factoryAccount: ["treasury-factory.near", { option: true }],
});

0 comments on commit 22087f0

Please sign in to comment.