使用 Browserstack 测试赛普拉斯不起作用:"Malformed Archive"

Testing Cypress with Browserstack does not work: "Malformed Archive"

我正在尝试在 Browserstack 中获取 Cypress 示例测试 运行ning。我正在学习本教程:Run your Cypress tests

然而,当涉及到 运行ning browserstack-cypress run 时,我得到以下输出:

[2020-12-4 17:00:12] - info: Reading config from /home/dennis/Repos/CMS/browserstack.json
[2020-12-4 17:00:12] - info: Reading username from the environment variable BROWSERSTACK_USERNAME
[2020-12-4 17:00:12] - info: Reading access key from the environment variable BROWSERSTACK_ACCESS_KEY
[2020-12-4 17:00:12] - info: browserstack.json file is validated
[2020-12-4 17:00:46] - error: Malformed archive
[2020-12-4 17:00:46] - error: Zip Upload failed.
[2020-12-4 17:00:46] - info: Zip file deleted successfully.

这是我的 browserstack.json 的样子:

{
    "auth": {
        "username": "<user name>",
        "access_key": "<access key>"
    },
    "browsers": [
        {
            "browser": "chrome",
            "os": "Windows 10",
            "versions": [
                "latest",
                "latest-1"
            ]
        }
    ],
    "run_settings": {
        "cypress_config_file": "./cypress.json",
        "project_name": "<project name>",
        "build_name": "",
        "parallels": "10",
        "npm_dependencies": {},
        "package_config_options": {}
    },
    "connection_settings": {
        "local": false,
        "local_identifier": null
    },
    "disable_usage_reporting": false
}

cypress.json 文件为空:

{}

我也没有得到的是我在哪里定义我想要的测试 运行 以及它们所在的位置。

感谢您的帮助!谢谢!

当运行器尝试压缩整个项目并尝试上传它而不是仅上传 Cypress 测试文件时,我遇到了“格式错误的存档”错误。

您应该可以通过将 Cypress 测试文件移动到子文件夹中来解决此问题:

test
|
| cypress.json
| Browserstack.json
| cypress
  |
  | fixtures
  | integration
  | support
  | plugins

在browserstack.json

中将路径设置为cypress.json

参考:https://www.browserstack.com/docs/automate/cypress/sample-tutorial