testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

Testcafe fails on macOS against webpack development server

Open dvaldivia opened this issue 3 years ago • 11 comments

What is your Scenario?

Trying to run tests on a Mac with Apple Silicon (darwin-arm64) against a webpack dev server running on port 3000

What is the Current behavior?

the test fails with a DNS error for localhost:3000 which doesn't happen for servers hosting only assets on localhost i.e: localhost:8080

the run fails with a DNS error

➜ yarn run testcafe chrome:headless tests                 
yarn run v1.22.17
$ /Users/dvaldivia/go/src/github.com/dvaldivia/testcafe-mac/node_modules/.bin/testcafe chrome:headless tests
 Running tests in:
 - Chrome 97.0.4692.71 / macOS 10.15.7

 Getting Started
 ✖ My first test

   1) AssertionError: expected false to be truthy

      Browser: Chrome 97.0.4692.71 / macOS 10.15.7

          5 |
          6 |test('My first test', async t => {
          7 |    // Test code
          8 |await t
          9 |        .expect(Selector('.App').exists)
       > 10 |        .ok();
         11 |});
         12 |

         at <anonymous> (/Users/dvaldivia/go/src/github.com/dvaldivia/testcafe-mac/tests/basic.ts:10:10)
         at <anonymous> (/Users/dvaldivia/go/src/github.com/dvaldivia/testcafe-mac/tests/basic.ts:8:71)
         at __awaiter (/Users/dvaldivia/go/src/github.com/dvaldivia/testcafe-mac/tests/basic.ts:4:12)
         at <anonymous> (/Users/dvaldivia/go/src/github.com/dvaldivia/testcafe-mac/tests/basic.ts:6:33)


   2) undefinedFailed to load the page at "http://localhost:3000/".
      Increase the value of the "pageRequestTimeout" variable, enable the "retryTestPages" option, or use quarantine mode to perform additional attempts
      to execute this test.
      You can find troubleshooting information for this issue at "https://go.devexpress.com/TestCafe_FAQ_ARequestHasFailed.aspx".
      
      Error details:
      Failed to find a DNS-record for the resource at "http://localhost:3000/".

      Browser: Chrome 97.0.4692.71 / macOS 10.15.7



 1/1 failed (4s)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What is the Expected behavior?

the tests should run, this works on linux (testd with ubuntu)

What is your public website URL? (or attach your complete example)

https://github.com/dvaldivia/testcafe-mac

What is your TestCafe test code?

import { Selector } from 'testcafe';

fixture`Getting Started`
    .page`http://localhost:3000`;

test('My first test', async t => {
    // Test code
await t
        .expect(Selector('.App').exists)
        .ok();
});

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

  1. get a mac with apple silicon
  2. clone https://github.com/dvaldivia/testcafe-mac and cd into the folder
  3. yarn install and yarn start
  4. run tests via yarn run testcafe chrome:headless tests

TestCafe version

1.18.3

Node.js version

v17.3.0

Command-line arguments

yarn run testcafe chrome:headless tests

Browser name(s) and version(s)

chrome and firefox

Platform(s) and version(s)

macOS 12.2

Other

No response

dvaldivia avatar Jan 29 '22 03:01 dvaldivia

Hi,

Thank you for your input. We reproduced the issue; please stay tuned.

Note for the team - works with node version 16.13.0.

AlexanderMoiseev avatar Jan 31 '22 07:01 AlexanderMoiseev

I do not believe this is M1 specific. I've had this problem on BOTH my M1 and previous generation MacBook Pro. My comparable test and problem: https://stackoverflow.com/questions/71022754/testcafe-fails-to-connect-to-localhost-on-osx

scheidm avatar Mar 10 '22 12:03 scheidm

Thank you, @scheidm! I have reproduced this error on an x86 Mac as well. I will update the issue title.

VasilyStrelyaev avatar Mar 11 '22 07:03 VasilyStrelyaev

Hey there, do we have any updates on this issue? This is also happening to me :)

joleek avatar Jun 14 '22 19:06 joleek

I was able to get around the issue by reverting to a previous version of NodeJS. Maybe that will help people find work-arounds and solutions

scheidm avatar Jun 14 '22 19:06 scheidm

@leekkww, we have no updates at the moment. We will post in this thread once we have any news.

@scheidm, thank you for sharing the workaround.

VasilyStrelyaev avatar Jun 16 '22 08:06 VasilyStrelyaev

Going back to node16 also solves it for me. I recommend tj/n as version manager.

janwirth avatar Jul 03 '22 21:07 janwirth

not working v16 also. Any updates on possible workaround / fixes?

srbagg avatar Aug 03 '22 10:08 srbagg

No updates yet. Once we get any results, we will post them in this thread.

github-actions[bot] avatar Aug 09 '22 06:08 github-actions[bot]

Getting same issue on linux (almalinux:8.6-20220512) as well.

srbagg avatar Aug 11 '22 05:08 srbagg

Thank you for the additional information!

VasilyStrelyaev avatar Aug 15 '22 08:08 VasilyStrelyaev

Hello everyone, 

I've just tried to reproduce this issue with TestCafe v2.3.0, and it looks like it is not reproducible anymore. Would you please check this on your side and let me know your results?

Artem-Babich avatar Feb 06 '23 11:02 Artem-Babich

Hello everyone,

I've just tried to reproduce this issue with TestCafe v2.3.0, and it looks like it is not reproducible anymore. Would you please check this on your side and let me know your results?

This seems to have resolved it for me

James-h143 avatar Feb 14 '23 12:02 James-h143

This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.

github-actions[bot] avatar Feb 16 '23 11:02 github-actions[bot]

I'm currently having this problem using node v18 and testcafe 3.3.0 on osx

MattMcFarland avatar Nov 07 '23 18:11 MattMcFarland

Hello,

I've tried to reproduce the issue by using the example from the original post in this thread and everything works fine for me. My environment details:

  • TestCafe 3.3.0
  • macOS 13.5.2,
  • Chrome 119.0.6045.123,
  • Firefox 119.0,
  • Safari 16.6,
  • NodeJS v18.4.0.

Possibly, the issue you are facing differs from the issue in the original post. Please, create a new issue and share with us a reproducible simple sample. Also, please specify your environment details.

aleks-pro avatar Nov 13 '23 13:11 aleks-pro