Testcafe fails on macOS against webpack development server
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
- get a mac with apple silicon
- clone https://github.com/dvaldivia/testcafe-mac and cd into the folder
yarn installandyarn start- 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
Hi,
Thank you for your input. We reproduced the issue; please stay tuned.
Note for the team - works with node version 16.13.0.
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
Thank you, @scheidm! I have reproduced this error on an x86 Mac as well. I will update the issue title.
Hey there, do we have any updates on this issue? This is also happening to me :)
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
@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.
Going back to node16 also solves it for me. I recommend tj/n as version manager.
not working v16 also. Any updates on possible workaround / fixes?
No updates yet. Once we get any results, we will post them in this thread.
Getting same issue on linux (almalinux:8.6-20220512) as well.
Thank you for the additional information!
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?
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
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.
I'm currently having this problem using node v18 and testcafe 3.3.0 on osx
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.