Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

TypeError: Cannot read properties of undefined (reading 'seed') #127

Closed
JohnSmithyy opened this issue Sep 1, 2022 · 1 comment · Fixed by #131
Closed

TypeError: Cannot read properties of undefined (reading 'seed') #127

JohnSmithyy opened this issue Sep 1, 2022 · 1 comment · Fixed by #131
Assignees
Labels
bug Something isn't working

Comments

@JohnSmithyy
Copy link

Describe the bug
I have a react app created with create react app with typescript. When I try and run the example code found on the main page, I get an error saying TypeError: Cannot read properties of undefined (reading 'seed').

Any ideas what I'm doing wrong?

My jest.config.js:

/** @type {import('jest').Config} */
const config = {
  verbose: true,
  preset: "@chainsafe/dappeteer",
};

module.exports = config;

My test.test.js file:

import puppeteer from "puppeteer";
import dappeteer from "@chainsafe/dappeteer";

async function main() {
  const [metamask, page] = await dappeteer.bootstrap(puppeteer, {
    metamaskVersion: "v10.15.0",
  });


  // you can change the network if you want
  await metamask.switchNetwork("ropsten");

  // you can import a token
  await metamask.addToken({
    tokenAddress: "0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa",
    symbol: "KAKI",
  });

  // go to a dapp and do something that prompts MetaMask to confirm a transaction
  await page.goto("http://my-dapp.com");
  const payButton = await page.$("#pay-with-eth");
  await payButton.click();

  // 🏌
  await metamask.confirmTransaction();
}

main();

To Reproduce

  1. npm install -s @chainsafe/dappeteer
  2. Do this: https://github.com/ChainSafe/dappeteer/blob/master/docs/JEST.md#use-preset
  3. Run this: https://github.com/ChainSafe/dappeteer#usage

Logs

pootpoot@pootpoot:~/Desktop/dapp/FrontEnd$ npm test
 
> [email protected] test
> jest
 
Determining test suites to run...
Running tests on MetaMask version v10.15.0
 
TypeError: Cannot read properties of undefined (reading 'seed')
    at importAccount (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/@chainsafe/dappeteer/dist/setup/setupActions.js:29:40)
    at /home/pootpoot/Desktop/dapp/FrontEnd/node_modules/@chainsafe/dappeteer/dist/setup/setupMetamask.js:21:19
    at Generator.next (<anonymous>)
    at fulfilled (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/@chainsafe/dappeteer/dist/setup/setupMetamask.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
TypeError: Cannot read properties of undefined (reading 'seed')
    at importAccount (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/@chainsafe/dappeteer/dist/setup/setupActions.js:29:40)
    at /home/pootpoot/Desktop/dapp/FrontEnd/node_modules/@chainsafe/dappeteer/dist/setup/setupMetamask.js:21:19
    at Generator.next (<anonymous>)
    at fulfilled (/home/pootpoot/Desktop/dapp/FrontEnd/node_modules/@chainsafe/dappeteer/dist/setup/setupMetamask.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Expected behavior
Everything to work lol.

Screenshots
If applicable, add screenshots to help explain your problem.

System:

  • OS: Ubuntu
  • OS version: Ubuntu 22.04.1 LTS
  • NodeJs version: v16.17.0
  • dAppeteer version: 3.0.0-rc.0
  • testing framework: testing-library/jest-dom
  • testing framework version: 5.16.4

Additional context
I also noticed that it doesn't pick up the version I specify in my testing file and defaults to latest that is found in the setup.js file within the node_module itself?

@JohnSmithyy JohnSmithyy added the bug Something isn't working label Sep 1, 2022
@maurerbot
Copy link

having a similar issue rn

@BeroBurny BeroBurny self-assigned this Sep 13, 2022
@BeroBurny BeroBurny mentioned this issue Sep 14, 2022
4 tasks
@mpetrunic mpetrunic moved this to New Issues in Dappeteer Sep 22, 2022
@mpetrunic mpetrunic removed this from Dappeteer Sep 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants