Most testing tools (like Selenium) work by running outside the browser and executing remote commands over the network. Cypress is the exact opposite. Cypress executes in the same run loop as the web application.
Behind Cypress is a Node 服务器进程
. Cypress and Node processes are constantly communicating, synchronizing, and executing tasks with each other. Access to these two parts (that is, the corresponding front and back operations) allows us to respond to web application events in real time, while performing tasks outside the browser that require elevated privileges.
Cypress also dynamically reads and changes network traffic by operating directly at the network layer. This allows Cypress to not only modify everything that goes in and out of the browser, but also to change code that might interfere with its ability to automatically operate the browser.
Cypress ultimately controls the entire automation process from top to bottom, which puts it in a unique position to understand everything that's going on inside and outside the browser.
Since Cypress is installed on the test developer's machine, it can also tap into the operating system to perform automated tasks. This makes it possible to perform tasks such as screen capture, recording video, general file system operations, and network operations.
Execute the command line npx cypress open
, and encounter the error message:
$ npx cypress open
It looks like this is your first time using Cypress: 10.4.0
Cypress failed to start.
This may be due to a missing library or dependency. https://on.cypress.io/required-dependenc : Please refer to the error below for more details.
[0815/165943.734:FATAL:v8_initializer.cc(525)] Error loading V8 startup snapshot file
Platform: win32-x64 (10.0.19044)Cypress Version: 10.4.0
From the package-lock.json
file, the Cypress version used is 10.4.0
:
We can find the source code of v8_initializer.cc
from gitcode:
https://gitcode.net/mirrors/chromium/chromium/-/blob/lkgr-android-internal/gin/v8_initializer.cc
// static
void V8Initializer::LoadV8SnapshotFromFile(
base::File snapshot_file,
base::MemoryMappedFile::Region* snapshot_file_region,
V8SnapshotFileType snapshot_file_type) {
if (g_mapped_snapshot)
return;
if (!snapshot_file.IsValid()) {
LOG(FATAL) << "Error loading V8 startup snapshot file";
return;
}
I looked at the Cypress package.json settings of the SAP e-commerce cloud Spartacus UI and found that the 8.5.0
version was used:
After my own Cypress project was also switched to this version, the problem disappeared:
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。