Skip to content

await wallet.addNetwork throws error: SyntaxError: async innerText #387

@dmccoy-NL

Description

@dmccoy-NL

Describe the bug
When running this code.

import { BrowserContext, expect, test as baseTest } from "@playwright/test";
import dappwright, { Dappwright, MetaMaskWallet } from "@tenkeylabs/dappwright";

  export const test = baseTest.extend<{
    context: BrowserContext;
    wallet: Dappwright;
  }>({
    context: async ({}, use) => {
      // Launch context with extension
      const [wallet, _, context] = await dappwright.bootstrap("", {
        wallet: "metamask",
        version: MetaMaskWallet.recommendedVersion,
        seed: "test test test test test test test test test test test junk", // Hardhat's default https://hardhat.org/hardhat-network/docs/reference#accounts
        headless: false,
      });

      // Add Hardhat as a custom network
      await wallet.addNetwork({
         networkName: "Hardhat",
         rpc: "http://localhost:8546",
         chainId: 31337,
         symbol: "ETH",
       });

      await use(context);
    },

    wallet: async ({ context }, use) => {
      const metamask = await dappwright.getWallet("metamask", context);

      await use(metamask);
    },
  });

will throw the following error

SyntaxError: async innerText() {
    return (await this._elementChannel.innerText()).value;
}

 > 25 |       await wallet.addNetwork({

To Reproduce
Steps to reproduce the behavior:

  1. Go to example document at README
  2. run tests with playright
  3. see error

Logs

  1) [chrome-latest:Windows 11-browserstack] › wallet-test.spec.ts:5:5 › wallet_test ───────────────

    SyntaxError: async innerText() {
        return (await this._elementChannel.innerText()).value;
      }

       at ../with-web3-test.ts:25

      23 |       // });
      24 |
    > 25 |       await wallet.addNetwork({
         |       ^

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot 2024-10-23 at 1 05 28 PM

System:

  • OS: Ventrua
  • OS version: 13.6.7
  • NodeJs version: v20.17.0
  • dAppwright version: ^2.8.6
  • testing framework [e.g jest]: playwight
  • testing framework versions: playwright: 1.40.1, @playwright/test: 1.40.1

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions