![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@bozhkovatanas/wallet-mock
Advanced tools
Mock Web3 Browser wallets, like Metamask, in Playwright tests.
Fully functional end-to-end (E2E) tests for your decentralized application (dApp). This package installs a fully
operational, headless Web3 Wallet into the Playwright Browser Context. The
wallet can be configured to execute on the blockchain or return mock responses. It is discoverable
through EIP-6963 and leverages viem Account
and Transport
interfaces for easy customization.
npm install -D @bozhkovatanas/wallet-mock
import { test } from "@playwright/test";
import { installMockWallet } from "@bozhkovatanas/wallet-mock";
import { privateKeyToAccount } from "viem/accounts";
import { http } from "viem";
// Replace with your actual RPC URLs
const ETHEREUM_RPC_URL = `https://YOUR_ETHEREUM_RPC_URL`;
const ARBITRUM_RPC_URL = `https://YOUR_ARBITRUM_RPC_URL`;
test.beforeEach(async ({page}) => {
const transports = new Map<number, Transport>();
transports.set(1, http(ETHEREUM_RPC_URL));
transports.set(42161, http(ARBITRUM_RPC_URL));
await installMockWallet({
page,
account: privateKeyToAccount(process.env.TEST_PRIVATE_KEY as Hash),
transports,
});
});
test("Wallet Integration Test", async ({page}) => {
await page.getByRole("button", { name: "Log In" }).click();
await page.getByRole("button", { name: "Choose Wallet" }).click();
await page.getByRole("menuitem", { name: "Mock Wallet" }).click();
// Add your test assertions here
});
Note: This setup will execute actual transactions on the blockchain without user intervention using the provided Private Key.
installMockWallet
The installMockWallet
function is the main export of the library, designed to integrate a mock wallet into your
testing setup.
type InstallMockWalletParamsWithBrowserContext = {
account: LocalAccount,
transports: Map<number, Transport>,
browserContext: BrowserContext
};
type InstallMockWalletParamsWithPage = {
account: LocalAccount,
transports: Map<number, Transport>,
page: Page
};
async function installMockWallet(params: InstallMockWalletParamsWithBrowserContext | InstallMockWalletParamsWithPage): Promise<void>;
You can pass in either a BrowserContext
or a Page
object, depending on your Playwright testing setup.
The Mock Wallet will show up as an EIP-6963 compatible wallet.
To test with a local Hardhat node:
Start your local Hardhat Node:
npx hardhat node
Connect the Mock Wallet to your Hardhat Node:
await installMockWallet({
page,
account: privateKeyToAccount(
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
),
transports: new Map().set(1, http("http://127.0.0.1:8545")),
});
FAQs
Mock Web3 Browser wallets, like Metamask, in Playwright tests.
We found that @bozhkovatanas/wallet-mock demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.