DevExpress / testcafe-browser-tools

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

How testcafe work with testcafe-browser-tools #215

Closed IssacH closed 3 years ago

IssacH commented 3 years ago

Hi @Mehul @inikulin @Seteh @pavsenin @kaatula ,

I've been using testcafe for several months, it's a very cool testing framework and I am quite curious about how testcafe works under the hood. And I tried to find some material, but it seems that few of them talk about the details about the mechanism of testcafe. I also did some investigation on the source code of testcafe. It seems that for chrome browser it uses dev tools protocol to send command to the websocket server to control the browser. But I am a little confused what role does testcafe-browser-tools play in testcafe. I saw some binaries for different os in the testcafe-browser-tools project. For windows, there is resize.exe, screenshot.exe. ... So I have several questions below:

  1. Would it be possible to only use dev tools protocol to perform all actions in browser? Is testcafe-browser-tools used to do something the dev tools protocol cannot do?
  2. Is there any useful document to elaborate the detail mechanism for testcafe?

Thanks, Issac

VasilyStrelyaev commented 3 years ago

TestCafe uses testcafe-browser-tools to resize windows, capture screenshots and videos (when it cannot do this using CDP), as well as to open and close browsers. To execute all these actions, testcafe-browser-tools runs native code.

It’s impossible to open and close browser windows using CDP. Resize and media capture actions also require native code in certain configurations.

The testcafe-browser-tools behavior is not documented at the moment because it's an internal module that is subject to changes.