1

I'm trying to run e2e tests for my Gutenberg plugin. Here's my pertinent code

import {
  createNewPost,
  enablePageDialogAccept,
  insertBlock,
  clickButton,
} from "@wordpress/e2e-test-utils";

beforeAll(async () => {
  await enablePageDialogAccept();
});

describe("content editor basic functions", () => {
  test("ContentEditor shows up", async () => {
    await createNewPost();
    return true;
  });
});

I get the following stacktrace

Navigation failed because browser has disconnected!
    at /Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:51:147
    at /Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/vendor/mitt/src/index.js:51:62
    at Array.map (<anonymous>)
    at Object.emit (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/vendor/mitt/src/index.js:51:43)
    at CDPSession.emit (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/common/EventEmitter.js:72:22)
    at CDPSession._onClosed (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:247:14)
    at Connection._onMessage (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:94:25)
    at WebSocket.<anonymous> (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/puppeteer/lib/cjs/puppeteer/node/NodeWebSocketTransport.js:13:32)
    at WebSocket.onMessage (/Users/nav/dev/wordpress-unified/plugins/my-plugin/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:375:28)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:31025) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:31025) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I understand the browser is closed before the test can be run.. what can I do about it? I'm using @wordpress/[email protected]

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.