diff --git a/web-wallet/CHANGELOG.md b/web-wallet/CHANGELOG.md
index 18ef9354a0..103c57ce82 100644
--- a/web-wallet/CHANGELOG.md
+++ b/web-wallet/CHANGELOG.md
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
-
+- Add Create Wallet flow tests [#1443]
- Add visible version, commit hash and build date [#1441]
- Add Address validation (Transfer flow) [#1377]
@@ -112,6 +112,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#1417]: https://github.com/dusk-network/rusk/issues/1417
[#1445]: https://github.com/dusk-network/rusk/issues/1445
[#1441]: https://github.com/dusk-network/rusk/issues/1441
+[#1443]: https://github.com/dusk-network/rusk/issues/1443
[Unreleased]: https://github.com/dusk-network/rusk/tree/master/web-wallet
diff --git a/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap b/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap
index c3f478b861..0a33d8bce8 100644
--- a/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap
+++ b/web-wallet/src/routes/(welcome)/setup/create/__tests__/__snapshots__/page.spec.js.snap
@@ -1,5 +1,330 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+exports[`Create > should render the \`Securely store your seed phrase!\` agreement step after the ToS 1`] = `
+
should render the Terms of Service step of the Create flow 1`]
`;
+
+exports[`Create > should render the Terms of Service step of the Create flow if there is no userId saved in localStorage 1`] = `
+
+
+
+
+
+
+
+
+ Our
+
+ Terms & Privacy Policy
+
+
+ govern your use of our services,
+ including data handling and user responsibilities.
+ Your privacy and security are our top priorities.
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
diff --git a/web-wallet/src/routes/(welcome)/setup/create/__tests__/page.spec.js b/web-wallet/src/routes/(welcome)/setup/create/__tests__/page.spec.js
index 31f6330518..9cfec229bc 100644
--- a/web-wallet/src/routes/(welcome)/setup/create/__tests__/page.spec.js
+++ b/web-wallet/src/routes/(welcome)/setup/create/__tests__/page.spec.js
@@ -1,18 +1,55 @@
import {
+ afterAll,
afterEach,
describe,
expect,
- it
+ it,
+ vi
} from "vitest";
-import { cleanup, render } from "@testing-library/svelte";
+import { cleanup, fireEvent, render } from "@testing-library/svelte";
+import { addresses } from "$lib/mock-data";
import Create from "../+page.svelte";
+import { settingsStore } from "$lib/stores";
+import { setKey } from "lamb";
+import { Wallet } from "@dusk-network/dusk-wallet-js";
+import { generateMnemonic } from "bip39";
+import { getSeedFromMnemonic } from "$lib/wallet";
-describe("Create", () => {
- afterEach(cleanup);
+describe("Create", async () => {
+ const walletGetPsksSpy = vi.spyOn(Wallet.prototype, "getPsks").mockResolvedValue(addresses);
+ const mnemonic = generateMnemonic();
+ const seed = getSeedFromMnemonic(mnemonic);
+ const userId = (await new Wallet(seed).getPsks())[0];
+
+ afterEach(async () => {
+ cleanup();
+ settingsStore.reset();
+ walletGetPsksSpy.mockClear();
+ });
+
+ afterAll(() => {
+ walletGetPsksSpy.mockRestore();
+ });
+
+ it("should render the Existing Wallet notice step of the Restore flow if there is a userId saved in localStorage", () => {
+ settingsStore.update(setKey("userId", userId));
- it("should render the Terms of Service step of the Create flow", () => {
const { container } = render(Create);
expect(container.firstChild).toMatchSnapshot();
});
+
+ it("should render the Terms of Service step of the Create flow if there is no userId saved in localStorage", () => {
+ const { container } = render(Create);
+
+ expect(container.firstChild).toMatchSnapshot();
+ });
+
+ it("should render the `Securely store your seed phrase!` agreement step after the ToS", async () => {
+ const { container, getByRole } = render(Create);
+
+ await fireEvent.click(getByRole("button", { name: "Accept" }));
+
+ expect(container.firstChild).toMatchSnapshot();
+ });
});
diff --git a/web-wallet/src/routes/(welcome)/setup/restore/__tests__/page.spec.js b/web-wallet/src/routes/(welcome)/setup/restore/__tests__/page.spec.js
index 9f80c81d2d..9085d7d47a 100644
--- a/web-wallet/src/routes/(welcome)/setup/restore/__tests__/page.spec.js
+++ b/web-wallet/src/routes/(welcome)/setup/restore/__tests__/page.spec.js
@@ -70,15 +70,15 @@ describe("Restore", async () => {
walletGetPsksSpy.mockRestore();
});
- it("should render the Terms of Service step of the Restore flow if there is no userId saved in localStorage", () => {
+ it("should render the Existing Wallet notice step of the Restore flow if there is a userId saved in localStorage", () => {
+ settingsStore.update(setKey("userId", userId));
+
const { container } = render(Restore);
expect(container.firstChild).toMatchSnapshot();
});
- it("should render the Existing Wallet notice step of the Restore flow if there is a userId saved in localStorage", () => {
- settingsStore.update(setKey("userId", userId));
-
+ it("should render the Terms of Service step of the Restore flow if there is no userId saved in localStorage", () => {
const { container } = render(Restore);
expect(container.firstChild).toMatchSnapshot();