Skip to content

Commit

Permalink
preback switchAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammed-Mamoun98 committed Dec 11, 2024
1 parent a740846 commit 01f89b6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions apps/idos-sdk-e2e/tests/01-evm-auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test("should login successfully with an EVM wallet", async ({
await page.getByRole("button", { name: "Connect a wallet" }).click();
await page.getByRole("button", { name: "Metamask" }).first().click();

await metamask.switchAccount("Pristine");
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();
Expand All @@ -42,6 +43,7 @@ test("should set successfully an EVM signer", async ({
await page.getByRole("button", { name: "Connect a wallet" }).click();
await page.getByRole("button", { name: "Metamask" }).first().click();

await metamask.switchAccount("Pristine");
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();
Expand Down
8 changes: 7 additions & 1 deletion apps/idos-sdk-e2e/tests/02-data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ test("should fetch credentials successfully", async ({
await page.goto("/");
await page.getByRole("button", { name: "Connect a wallet" }).click();
await page.getByRole("button", { name: "Metamask" }).first().click();

await metamask.switchAccount("Pristine");
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();
Expand All @@ -39,14 +41,17 @@ test("should fetch wallets successfully", async ({ context, page, metamaskPage,
await page.getByRole("button", { name: "Connect a wallet" }).click();
await page.getByRole("button", { name: "Metamask" }).first().click();

await metamask.switchAccount("Pristine");
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();

const list = page.locator("#wallets-list");
await expect(list.getByRole("listitem")).toHaveCount(1);
const address = await metamask.getAccountAddress();
await expect(list.getByRole("listitem").first().locator("p").last()).toHaveText(

const wallet = await list.getByRole("listitem").first().locator("p").last().textContent();
await expect(wallet?.toLocaleLowerCase()).toEqual(
address.toLocaleLowerCase(), // The address is stored in lowercase format in the idOS so we need to normalize the MetaMask address.
);
});
Expand All @@ -63,6 +68,7 @@ test("should add / delete a wallet successfully", async ({
await page.getByRole("button", { name: "Connect a wallet" }).click();
await page.getByRole("button", { name: "Metamask" }).first().click();

await metamask.switchAccount("Pristine");
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();
Expand Down
6 changes: 5 additions & 1 deletion apps/idos-sdk-e2e/tests/03-enclave.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ test("should decrypt a credential successfully", async ({
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword, extensionId);
await page.getByRole("button", { name: "Connect a wallet" }).click();
await page.getByRole("button", { name: "Metamask" }).first().click();

await metamask.switchAccount("Pristine");
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();
Expand All @@ -43,7 +45,7 @@ test("should decrypt a credential successfully", async ({
await page.waitForTimeout(4000);

const code = await page.locator("#credential-details").textContent();
expect(code).toContain("uuid:203490be-fec8-49f9-80d7-fa504a057a0c");
expect(code).toContain("uuid:087b9cf0-a968-471d-a4e8-a805a05357ed");
// uuid:203490be-fec8-49f9-80d7-fa504a057a0c for PROD
// uuid:087b9cf0-a968-471d-a4e8-a805a05357ed for PLAYGROUND
});
Expand All @@ -58,6 +60,8 @@ test("should filter credentials by country successfully", async ({

await page.getByRole("button", { name: "Connect a wallet" }).click();
await page.getByRole("button", { name: "Metamask" }).first().click();

await metamask.switchAccount("Pristine");
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();
Expand Down

0 comments on commit 01f89b6

Please sign in to comment.