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

NS_ERROR_CONNECTION_REFUSED #7

Closed
WeyIin opened this issue Sep 14, 2022 · 5 comments · Fixed by #8
Closed

NS_ERROR_CONNECTION_REFUSED #7

WeyIin opened this issue Sep 14, 2022 · 5 comments · Fixed by #8
Labels
bug Something isn't working

Comments

@WeyIin
Copy link
Contributor

WeyIin commented Sep 14, 2022

Hey guys 👋

I really wanted to check out the app and how the testing is done with playwright and it is really well done.

However, when I try to execute the tests all tests fail. Below is one example..

 FAILED

total        : 20
failed       : 20
duration     : 7s

   page.goto: NS_ERROR_CONNECTION_REFUSED
=========================== logs ===========================
navigating to "http://0.0.0.0:55997/profiles/TestPerson", waiting until "load"
============================================================

   at Object.executor tests/e2e/profiles/show.spec.ts:33
    28|        article.with('profile', 1, (profile) => profile.with('user'))
    29|      )
    30|        .merge({ profileId: profile.id })
    31|        .createMany(3)
    32|
  ❯ 33|      await page.goto(route('profiles.show', profile))
    34|      let screen = await getScreen()
    35|
    36|      assert.exists(await screen.findByRole('heading', { level: 1, name: 'TestPerson' }))
    37|      assert.exists(await screen.findByText('I am a test person'))
    38|      assert.exists(await screen.findByRole('link', { name: 'My Articles' }))


✖ logged in user does not see follow button on their profile

Pretty much followed all the set up steps to the T.

What am I missing? :)

Windows 11
NPM v - 8.5.1
node v - 17.6.0

@HipsterBrown
Copy link
Owner

Thanks for creating an issue @WeyIin

This appears to be an issue with the Firefox runner for Playwright on Windows. I'll do some investigating but, in the meantime, could you try setting the browser config for the plugin to chromium? https://github.com/HipsterBrown/adonis-realworld-example-app/blob/main/tests/bootstrap.ts#L88

playwrightClient({ browser: 'chromium' })

@HipsterBrown HipsterBrown added the bug Something isn't working label Sep 14, 2022
@WeyIin
Copy link
Contributor Author

WeyIin commented Sep 14, 2022

Hi @HipsterBrown ,

Tried that but it was still failing with the error below:

✖ user can sign up and be authenticated

   page.goto: net::ERR_ADDRESS_INVALID at http://0.0.0.0:53634/
=========================== logs ===========================
navigating to "http://0.0.0.0:53634/", waiting until "load"
============================================================

   at Object.executortests/e2e/users/new.spec.ts:15
    10|    })
    11|
    12|    test('user can sign up and be authenticated', async ({ assert, page, getScreen }) => {
    13|      assert.lengthOf(await User.all(), 0)
    14|
  ❯ 15|      await page.goto('/')
    16|      let screen = await getScreen()
    17|
    18|      const signupLink = await screen.findByRole('link', { name: /Sign up/ })
    19|      await signupLink.click()
    20|

Fixed it by adding HOST=127.0.0.1 or HOST=localhost in env.test

Now all tests pass 👍

So all in all, on windows it is a mixture of both, using chromium as a browser and defining a host in env test file. For some reason it doesn't like 0.0.0.0! (default if host is not defined in env)

Thanks @HipsterBrown!

@HipsterBrown
Copy link
Owner

@WeyIin Just to verify, the Firefox runner still doesn't work after setting the HOST=localhost in the .env.test file?

If you're able to contribute that update as a PR, that will be great for anyone else who tries out this project. 🙏

@WeyIin
Copy link
Contributor Author

WeyIin commented Sep 14, 2022

@HipsterBrown - I have removed playwrightClient({ browser: 'chromium' }) and changed it back to playwrightClient() and it seem to work, I guess it's just the host config in env!! I didn't even think of that :)

WeyIin added a commit to WeyIin/adonis-realworld-example-app that referenced this issue Sep 14, 2022
@WeyIin
Copy link
Contributor Author

WeyIin commented Sep 14, 2022

opened a PR to fix the issue - #8

@HipsterBrown HipsterBrown linked a pull request Sep 14, 2022 that will close this issue
HipsterBrown pushed a commit that referenced this issue Sep 14, 2022
simple fix that fixes playwright runner not being able to connect to headless browser in windows, fixes #7 issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants