3

I am trying to get a Cypress example test running in Browserstack. I am following this tutorial: Run your Cypress tests

However when it comes to running browserstack-cypress run im getting the following output:

[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.

This is what my browserstack.json looks like:

{
    "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
}

The cypress.json file is empty:

{}

What I'm also not getting is where I am defining what tests I want to run and where they are located.

I appreciate any help! Thanks!

coolaturon
  • 107
  • 1
  • 7

1 Answers1

5

I've come across the "Malformed archive" error when the runner tries to compress the entire project and tries to upload it instead of just the Cypress Test files.

You should be able to fix this by moving the Cypress test files into a subfolder:

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

Set the path to cypress.json in browserstack.json

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

Shawn Lobo
  • 154
  • 3