DevExpress / testcafe-browser-tools

Browser manipulation utils for TestCafe.
https://testcafe.io
MIT License
30 stars 34 forks source link

Native binary for Apple M1 #213

Closed inferpse closed 2 years ago

inferpse commented 3 years ago

Hi,

Current version of TestCafe (1.11.0) doesn't work on Apple M1 macs without Rosetta installed. I have native build of Node.js (v15) and TestCafe fails with following message:

ERROR NativeBinaryHasFailedError: The find-window process failed with the 1 exit code.
Process output:
The application /Users/.../node_modules/testcafe-browser-tools/bin/mac/TestCafe Browser Tools.app/Contents/MacOS/testcafe-browser-tools cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10669 "(null)" UserInfo={_LSLine=3665, _LSFunction=_LSOpenStuffCallLocal}
    at ChildProcess.<anonymous> (/Users/.../node_modules/testcafe-browser-tools/src/utils/exec.js:73:24)
    at ChildProcess.emit (node:events:376:20)
    at ChildProcess.EventEmitter.emit (node:domain:470:12)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:284:12)
    at Process.callbackTrampoline (node:internal/async_hooks:131:14)

I was able to overcome this issue by cloning this repo and building it with gulp buildMac. It was able to compile flawlessly without any errors:

[12:43:04] Using gulpfile ~/git/testcafe-browser-tools/gulpfile.js
[12:43:04] Starting 'buildMac'...
[12:43:04] Starting 'lint'...
[12:43:04] Starting 'cleanMacNatives'...
[12:43:04] Starting 'cleanLib'...
[12:43:04] Finished 'cleanMacNatives' after 148 ms
[12:43:04] Starting 'buildMacExecutables'...
[12:43:04] Finished 'cleanLib' after 153 ms
[12:43:04] Starting 'transpileLib'...
[12:43:04] Finished 'lint' after 515 ms
[12:43:06] Finished 'transpileLib' after 1.69 s
[12:43:07] Finished 'buildMacExecutables' after 3.23 s
[12:43:07] Starting 'buildMacApp'...
[12:43:08] Finished 'buildMacApp' after 360 ms
[12:43:08] Finished 'buildMac' after 3.73 s

After replacing the testcafe-browser-tools binary in node_modules testcafe started to work properly on M1. Could you please update this package on npm so that it will contain universal binary for both Intel and ARM based Macs?

miherlosev commented 3 years ago

Hi @inferpse

Thank you for pointing out that. We will add native binaries for ARM-based Mac into the testcafe-browser-tools module.

inferpse commented 3 years ago

Thanks! 👍 I can help with testing if needed.

inferpse commented 2 years ago

@miherlosev this issue is not really of TYPE: enhancement : TestCafe just doesn't work at all on M1 macs without Rosetta installed.

And I had to compile testcafe-browser-tools again after I've updated my node_modules dependencies... Hope this will be resolved any time soon.

VasilyStrelyaev commented 2 years ago

Thank you for your inquiry. We marked this issue as an enhancement, because it was a request to support a newly emerged platform (at that time), whereas the lack of support for new platforms (as well as, for instance, browsers) is not something we would normally consider a bug. However, as time goes and new things become standard, the lack of support may be considered an issue. That said, we will discuss if we should re-classify or reprioritize this task.

In the meantime, could you please elaborate on your scenario? In particular, why are you unable to use Rosetta?

inferpse commented 2 years ago

Hi Vasily, I don't have any software that requires Rosetta... And it feels like an overkill to install Rosetta just to run 155 KB binary from this repo 🤷‍♂️

TestCafe is amazing and I believe that lack of M1 support might prevent some mac users from using your product. And I feel that adding M1 support is a low-hanging fruit because gulp buildMac produces the binary without any issues on both Big Sur/Monterey running on M1 chip.

AlexSkorkin commented 2 years ago

Thank you for the clarification. We will look into this.

GrahamLea commented 2 years ago

For anyone having trouble getting TestCafe running on an M1 Mac, here's all the steps I just took to get it working. (It's likely some of them aren't necessary, but I can't tell you which ones are and aren't, so this is just everything I did before I got success.)

  1. Install Rosetta from a terminal: softwareupdate --install-rosetta
  2. Upgrade to the latest TestCafe (1.17.1 as of Dec 5, 2021)
  3. npm install
  4. Close and re-open terminal session
  5. Close and re-open Safari
AndreyBelym commented 2 years ago

Fixed in a8a013d713fd915ba1b02b6eb105783ee8af6cbb.