Skip to content

Commit

Permalink
minor tweaks on e2e test files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammed-Mamoun98 committed Dec 10, 2024
1 parent 28d819d commit 5567dd8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/idos-sdk-e2e/tests/01-evm-auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +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.connectToDapp();
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();

Expand Down
23 changes: 12 additions & 11 deletions apps/idos-sdk-e2e/tests/02-data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ test("should fetch credentials successfully", async ({
}) => {
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword, extensionId);
await page.goto("/");

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

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

Expand All @@ -41,11 +39,11 @@ 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.connectToDapp();
await metamask.connectToDapp(["Pristine"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();

const list = await page.locator("#wallets-list");
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(
Expand All @@ -59,29 +57,32 @@ test("should add / delete a wallet successfully", async ({
metamaskPage,
extensionId,
}) => {
await page.goto("/wallets");
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword, extensionId);
await page.goto("/");

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

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

const list = await page.locator("#wallets-list");
await page.goto("/wallets");

// Testing wallet addition
const addWalletButton = page.locator("#add-wallet-button");
await addWalletButton.click();
await page.locator("#address").fill(TEST_WALLET_ADDRESS);
await page.locator("#add-wallet-form-submit").click();
await page.waitForTimeout(3000);
await metamask.confirmSignature();
await page.waitForTimeout(5000);
await expect(list.getByRole("listitem")).toHaveCount(2);
await page.waitForTimeout(10000);
const list = await page.locator("#wallets-list");

await expect(list.getByRole("listitem")).toHaveCount(2);
// Testing wallet deletion
const deleteButton = list.locator(`#delete-wallet-${TEST_WALLET_ADDRESS}`);
const deleteButton = await list.locator(`#delete-wallet-${TEST_WALLET_ADDRESS}`);
await deleteButton.click();
await page.locator(`#confirm-delete-wallet-${TEST_WALLET_ADDRESS}`).click();
await metamask.confirmSignature();
Expand Down
14 changes: 8 additions & 6 deletions apps/idos-sdk-e2e/tests/03-enclave.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ 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.connectToDapp();
await metamask.connectToDapp(["Account 1"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();
await page.waitForTimeout(2000);
Expand All @@ -41,8 +40,9 @@ test("should decrypt a credential successfully", async ({

await passwordInput.fill("qwerty");
await idOSPopup.getByRole("button", { name: "Unlock" }).click();
await page.waitForTimeout(4000);

const code = await page.locator("#credential-details");
const code = await page.locator("#credential-details")
expect(code).toHaveText(credentialContent);
});

Expand All @@ -53,14 +53,16 @@ test("should filter credentials by country successfully", async ({
extensionId,
}) => {
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword, extensionId);
await page.goto("e2e/credential-filtering-by-country");

await metamask.connectToDapp();
await page.getByRole("button", { name: "Connect a wallet" }).click();
await page.getByRole("button", { name: "Metamask" }).first().click();
await metamask.connectToDapp(["Account 1"]);
await page.waitForTimeout(2000);
await metamask.confirmSignature();
await page.waitForTimeout(2000);
await page.goto("e2e/credential-filtering-by-country");
await page.waitForTimeout(2000);

await page.getByRole("button", { name: "View details" }).first().click();
const idOSButton = await page.frameLocator("#idos-enclave-iframe").locator("#unlock");
await idOSButton.click();
const popupPromise = await page.waitForEvent("popup");
Expand Down

0 comments on commit 5567dd8

Please sign in to comment.