Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just Question; Is it possible to rerun by --onlyFailures when the playwright fail to connect to the browser? #610

Open
aha-oretama opened this issue Mar 4, 2021 · 2 comments

Comments

@aha-oretama
Copy link
Contributor

aha-oretama commented Mar 4, 2021

Describe the bug
This is not a bug, just a question.

I use --onlyFailures to make our tests more stable.
We can use it for no-watch mode now.
jestjs/jest#10678

I use Moon which provides a browser grid.

Sometimes, our test failed to connect the browser for some reasons...
For example, it takes much time for the browser to stand up and the connection timeout occurs.

In this situation, when executing the following command, jest-playwright doesn't rerun the failed test 😢

$ jest --onlyFailures

I'm glad that jest-playwright helps to rerun the failed tests when the connection error occurs.

Question:
Are there any workarounds to rerun the failed tests by --onlyFailures when the playwright fails to connect to the browser?
Or do you have any plan to support for this feature?

To Reproduce

Use this jest-playwright.config.js

module.exports = {
  launchType: 'SERVER',
  connectOptions: {
    wsEndpoint: "ws://wrong-url"
  }
};

Execute following commands

$ jest
$ jest --onlyFailures

Expected behavior
jest-playwright helps to rerun the failed tests when the connection error occurs.

Desktop (please complete the following information):

  • OS: macOS
  • Playwright version 1.8.1
  • jest-playwright version 1.4.7
@mmarkelov
Copy link
Member

mmarkelov commented Mar 4, 2021

@aha-oretama not sure but maybe retryTimes can help

@aha-oretama
Copy link
Contributor Author

I tried... but it doesn't work 😓

This is my sample code. I confirmed that the test can be retried when there is no connection error.

jest.retryTimes(3);

beforeEach(async () => {
  await jestPlaywright.resetBrowser();
  await page.goto('https://whatismybrowser.com/')
})

test('should display correct browser', async () => {
  const browser = await page.$eval('.string-major', (el) => el.innerHTML)
  expect(true).toBe(false);
  expect(browser).toContain('Chrome')
})

But, when the connection error occurs, the test is never retried... 😢
The log is like this.


  ● Test suite failed to run

    browserType.connect: getaddrinfo ENOTFOUND wrong-url. Most likely ws endpoint is incorrect

      at WebSocket.<anonymous> (node_modules/playwright/lib/client/browserType.js:158:28)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants