Cypress 简明教程

Cypress - Supported Browsers

Cypress可以在Chrome、Electron和Firefox等浏览器中运行测试。在测试运行器中,我们可以在右上角选择浏览器。

Cypress can run tests in browsers like Chrome, Electron, and Firefox. In the Test Runner,we have the option to choose the browser from the right upper corner.

另外,必须注意的是,如果浏览器选项不可用,这意味着我们的系统中没有最新版本的浏览器。

Also, it must be noted that if a browser option is not available, it means we do not have the latest version of that browser in our system.

cypress electron

Execution from Other Browsers

下面解释了从命令行从其他浏览器执行:

The execution from other browsers from Command Line is explained below −

要运行 execution in Chrome ,您需要运行下面提到的命令:

To run the execution in Chrome, you need to run the below mentioned command −

./node_modules/.bin/cypress run -- browser chrome

您会看到以下画面:

You can see the following screen −

execution in chrome

要运行 execution in Firefox ,运行下面给出的命令:

To run the execution in Firefox, run the command given below −

./node_modules/.bin/cypress run -- browser firefox

您会看到以下画面:

You can see the following screen −

execution in headed mode

要运行 execution in headed mode ,运行下面给出的命令:

To run the execution in headed mode, run the command given below −

./node_modules/.bin/cypress run -- headed

从命令行,如果未指定选项,Cypress将在无头模式下执行测试。

From the command line, Cypress executes tests in headless mode, if no option is specified.