Skip to content

Commit

Permalink
Merge branch 'fix/e2e-pipline' of github.com:idos-network/idos-sdk-js…
Browse files Browse the repository at this point in the history
… into playground
  • Loading branch information
Mohammed-Mamoun98 committed Dec 9, 2024
2 parents e729324 + 2d9c19a commit 94f5367
Show file tree
Hide file tree
Showing 15 changed files with 194 additions and 240 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
run: pnpm install

- name: Build
run: pnpm build --filter=@idos-network/issuer-sdk-js --filter=@idos-network/idos-sdk
run: pnpm build --filter=@idos-network/issuer-sdk-js --filter=@idos-network/idos-sdk --filter=@idos-network/idos-sdk-server-dapp

- name: Release
run: pnpx pkg-pr-new publish --pnpm './packages/issuer-sdk-js' './packages/idos-sdk-js'
run: pnpx pkg-pr-new publish --pnpm './packages/issuer-sdk-js' './packages/idos-sdk-js' './packages/idos-sdk-server-dapp'

3 changes: 1 addition & 2 deletions .github/workflows/playwright-playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: './.node_version'
working-directory: ./apps/idos-sdk-e2e
- name: Install dependencies
run: pnpm i
- name: Install Playwright
run: pnpm playwright install --with-deps chromium
- name: Build Synpress cache
run: xvfb-run npx synpress tests/wallet-setup
run: xvfb-run npx synpress
- name: Run Playwright tests
run: xvfb-run npx playwright test
- uses: actions/upload-artifact@v4
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/playwright-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: './.node_version'
working-directory: ./apps/idos-sdk-e2e
- name: Install dependencies
run: pnpm i
- name: Install Playwright
run: pnpm playwright install --with-deps chromium
- name: Build Synpress cache
run: xvfb-run npx synpress tests/wallet-setup
run: xvfb-run npx synpress
- name: Run Playwright tests
run: xvfb-run npx playwright test
- uses: actions/upload-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,7 @@ const useFetchCredentials = () => {
.map((c) => c.id),
})) as idOSCredentialWithShares[]; // @todo: remove once we have more type safety in the SDK.
},
select: (credentials) =>
credentials
.filter((credential) => !credential.original_id)

.map((credential) => {
const { credential_level, credential_status, credential_type, issuer } =
// biome-ignore lint/suspicious/noExplicitAny: // @todo: remove once we have successfully migrated to Credentials 2.0.
credential as any;
const fields = credential.public_notes ? JSON.parse(credential.public_notes) : {};

const public_notes = {
id: fields.id ?? credential.id,
level: fields.level ?? credential_level,
status: fields.status ?? credential_status,
type: fields.type ?? credential_type,
issuer: fields.issuer ?? issuer,
};

return {
...credential,
public_notes: JSON.stringify(public_notes),
};
}),
select: (credentials) => credentials.filter((credential) => !credential.original_id),
});
};

Expand Down
14 changes: 14 additions & 0 deletions apps/idos-sdk-e2e/test/wallet-setup/wallet-setup.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { MetaMask, defineWalletSetup, getExtensionId } from "@synthetixio/synpress";

const SEED_PHRASE = process.env.WALLET_SEED_PHRASE;
const PASSWORD = process.env.WALLET_PASSWORD;

export default defineWalletSetup(PASSWORD, async (context, walletPage) => {
const extensionId = await getExtensionId(context, "MetaMask");

const metamask = new MetaMask(context, walletPage, PASSWORD, extensionId);

await metamask.importWallet(SEED_PHRASE);
// Add a new account that doesn't exist in the idOS.
await metamask.addNewAccount("Pristine");
});
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 @@ -18,6 +18,7 @@ test("should login successfully with an EVM wallet", async ({
extensionId,
}) => {
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(["Pristine"]);
Expand All @@ -32,6 +33,7 @@ test("should set successfully an EVM signer", async ({
extensionId,
}) => {
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.switchAccount("Account 1");
Expand Down
2 changes: 1 addition & 1 deletion apps/idos-sdk-e2e/tests/02-data.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test("should fetch credentials successfully", async ({
await page.waitForTimeout(2000);
await metamask.confirmSignature();
const list = page.locator("#credentials-list");
await expect(list.getByRole("listitem")).toHaveCount(2);
await expect(list.getByRole("listitem")).toHaveCount(3);
});

test("should fetch wallets successfully", async ({ context, page, metamaskPage, extensionId }) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/idos-sdk-e2e/tests/03-enclave.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ test("should filter credentials by country successfully", async ({

const list = page.locator("#credentials-list");

await expect(list.getByRole("listitem")).toHaveCount(1);
await expect(list.getByRole("listitem")).toHaveCount(0);
});
Loading

0 comments on commit 94f5367

Please sign in to comment.