GithubHelp home page GithubHelp logo

browserstack / browserstack-cypress-cli Goto Github PK

View Code? Open in Web Editor NEW
50.0 17.0 34.0 1.86 MB

NPM package for the customers to run Cypress on Browserstack Infra

License: MIT License

JavaScript 99.78% CSS 0.22%

browserstack-cypress-cli's Introduction

BrowserStack Cypress CLI

npm version

Note: Running Cypress tests on BrowserStack is now in public beta. Learn more here

If you are looking for a getting started guide, and a more up-to date documentation, check out the BrowserStack Cypress documentation

The browserstack-cypress-cli is BrowserStack's command-line interface (CLI) which allows you to run your Cypress tests on BrowserStack.

Quick Start

Running your first Cypress test suite on BrowserStack is super easy - just install our CLI, configure the test run settings and start testing. Here’s a quick start guide to help you get started.

Step 1: Install the CLI

First, install the BrowserStack - Cypress CLI via npm:

# Install the BrowserStack Cypress CLI
$ npm install -g browserstack-cypress-cli

Step 2: Configure

Next, set up your BrowserStack credentials and configure the browsers that you want to run your tests on. Use the init command to generate a sample browserstack.json file, or alternatively create one from scratch.

# Create a sample configuration file for configurations and capabilities
$ browserstack-cypress init

Fill in the auth, browsers, run_settings values in the browserstack.json file to be able to run your tests. Refer to the configuration options to learn more about all the options you can use in browserstack.json and the possible values that you can mention.

Make sure you also specify the npm packages that your tests need to run using the npm_dependencies option in run_settings.

Step 3: Run your tests

After you specify the required run settings, you can run your tests on BrowserStack:

$ browserstack-cypress run

After the tests are successfully submitted, you can access the test results on the BrowserStack Automate dashboard

To learn more about the different options the CLI supports - like running tests in parallel, running tests on localhost URLs etc., refer to the BrowserStack Cypress documentation

Documentation

Here are a few important links to get you started and help you successfully integrate the CLI into your CI/CD pipelines.

Getting Help

If you need any help, want to share feedback or report issues while running the tests, reach out to us on [email protected].

License

This project is released under MIT License. Please refer the LICENSE.md for more details.

browserstack-cypress-cli's People

Contributors

07souravkunda avatar agrawalsaurabhs avatar amaanbs avatar archish27 avatar asambstack avatar bstack-security-github avatar dhimil avatar francisf avatar hariharanbrowserstack avatar karanpahlani avatar karanshah-browserstack avatar karanshah81295 avatar khrithik96 avatar krishnasuravarapu avatar nagpalkaran95 avatar nikhlagrwl avatar pawanpanjwani avatar prajwaldhawarikar-bs avatar pranavj1001 avatar rahuln-bs avatar rev-doshi avatar roshan04 avatar sagarganiga avatar samarsault avatar sauravdas1997 avatar shashankg-gollapally avatar shwetashetye avatar sparsh00 avatar sreyanth avatar suryart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

browserstack-cypress-cli's Issues

Specifying npm_dependencies does not seem to work correctly

Hey there,

I'm trying to evaluate Browserstack and I can't seem to get my config to play nice with this tool. I'm trying to use the cypress-axe dependency by including it in my config like this:

{
    "auth": {
        "username": "SOME_USER",
        "access_key": "SOME_STRING"
    },
    "browsers": [
        {
            "browser": "chrome",
            "os": "OS X Catalina",
            "versions": [
                "latest"
            ]
        }
    ],
    "run_settings": {
        "cypress_config_file": "./cypress.json",
        "cypress_proj_dir": "./",
        "project_name": "sandbox",
        "build_name": "cypress-test",
        "exclude": [],
        "npm_dependencies": {
            "axe-core": "^4.0.2",
            "cypress": "^3.8.2",
            "cypress-axe": "^0.8.1"
        },
        "package_config_options": {},
        "parallels": "5",
        "specs": [
            "./cypress/integration/app-nav.js"
        ]
    },
    "connection_settings": {
        "local": false,
        "local_identifier": null
    },
    "disable_usage_reporting": false
}

When I run browserstack-cypress run and check the Dashboard, the test fails with this output:

Oops...we found an error preparing this test file:

  /e2e/cypress/support/index.js

The error was:

Error: Can't walk dependency graph: Cannot find module 'cypress-axe' from '/e2e/cypress/support'
    required by /e2e/cypress/support/index.js

This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

- A missing file or dependency
- A syntax error in the file or one of its dependencies

Fix the error in your code and re-run your tests.

I've read the docs and I don't think I'm missing anything, but I'm almost out of free minutes trying to evaluate this product. Can anyone point me in the right direction?

Uploading .npmrc file is failing

For our projects, we need to install some private mode modules, so I updated the archiver.js as following to zip .npmrc file

Constants.allowedFileTypes.forEach(fileType => { archive.glob(**/*.${fileType}, { cwd: cypressFolderPath, matchBase: true, ignore: ignoreFiles, dot: true }); });

But the tests failed due to the following error

error: Please make sure you are uploading files with extension .js, .json, .txt, .ts, .feature, .features, .pdf, .jpg, .jpeg, .png, or .zip

Is it possible that we can update the upload API to allow dot files?

Run cypress tests using the default browser "Electron"

Hi,

I have been working on writing Cypress tests and am running them on BrowserStack using "browserstack-cypress-cli". I just wanted to know if it would be possible to run these tests on cypress's default browser, Electron, on BrowserStack instead of Chrome/Edge/Firefox.

Please let me know if this would be possible.

Thanks,
Abhijeet

PS: Apologies if this is the wrong place for this question, kindly let me know if there is a better place where I can ask this question.

ReportPortal.io integration is not supported with BrowserStack-Cypress Runs

We currently leverage BrowserStack-Cypress-CLI to run our regression tests and we want it to be integrated with ReportPortal.io but the integration is not supported for the BrowserStack-Cypress runs. While our other tests that execute Cypress run command does integrate well with ReportPortal.io. We have a use-case to get real-time reporting from our regression tests as well which is blocked because of this unsupported feature.

Could you please take a look into this use-case and revert.

Thanks!

No log data to debug connectivity issue

We are trying to integrate this in our Azure DevOps CICD pipeline running on self-hosted on-prem agent and facing below connectivity issue.

We are able to telnet browserstack.com from agent. we could not see any detailed error to debug.

Log:

2021-05-28T19:52:29.9085607Z Generating script.
2021-05-28T19:52:29.9105877Z ========================== Starting Command Output ===========================
2021-05-28T19:52:29.9121836Z [command]/usr/bin/bash --noprofile --norc /root/myagent/_work/_temp/e977b107-1c39-4078-9c4b-49ef5816e7dd.sh
2021-05-28T19:52:30.2974387Z [28/05/2021, 20:52:30] - �[32minfo�[39m: Reading config from /root/myagent/_work/34/s/browserstack.json
2021-05-28T19:52:30.3011195Z [28/05/2021, 20:52:30] - �[32minfo�[39m: Validating the config
2021-05-28T19:52:30.3043628Z [28/05/2021, 20:52:30] - �[33mwarn�[39m: Using 4 machines instead of 5 that you configured as there are 1 specs to be run on 4 browser combinations.
2021-05-28T19:52:30.3053884Z [28/05/2021, 20:52:30] - �[32minfo�[39m: Creating tests.zip with files in .
2021-05-28T19:52:30.4470147Z [28/05/2021, 20:52:30] - �[32minfo�[39m: Uploading the tests to BrowserStack
2021-05-28T19:52:30.5195996Z [28/05/2021, 20:52:30] - �[31merror�[39m:  
2021-05-28T19:52:30.5199142Z {
2021-05-28T19:52:30.5201434Z   message: �[32m'read ECONNRESET'�[39m,
2021-05-28T19:52:30.5203839Z   stack: �[32m'Error: read ECONNRESET\n'�[39m +
2021-05-28T19:52:30.5206303Z     �[32m'    at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20)'�[39m,
2021-05-28T19:52:30.5208977Z   errno: �[33m-104�[39m,
2021-05-28T19:52:30.5211964Z   code: �[32m'ECONNRESET'�[39m,
2021-05-28T19:52:30.5213993Z   syscall: �[32m'read'�[39m
2021-05-28T19:52:30.5215355Z }
2021-05-28T19:52:30.5217319Z [28/05/2021, 20:52:30] - �[31merror�[39m: Zip Upload failed.
2021-05-28T19:52:30.5219928Z [28/05/2021, 20:52:30] - �[32minfo�[39m: Deleted tests.zip successfully.
2021-05-28T19:52:50.1034188Z cat: /root/myagent/_work/34/s/log/build_results.txt: No such file or directory
2021-05-28T19:52:50.1040208Z Browserstack test cases FAILED!
2021-05-28T19:52:50.1171273Z ##[error]Bash exited with code '1'.
2021-05-28T19:52:50.1197866Z ##[section]Finishing: Browserstack Test Automation```

Enable ignore section in browserstack.json

My project has a sub-project with its own node_modules folder.

This folder is being included in the tests.zip file making it much larger than it needs to be, it is also making it fail once uploaded.

It would be nice to have an ignore section within the browserstack.json config to exclude files/folders.

browserstack-cypress run --sync exits before end of test, with local install in monrepo

Problem:

browserstack-cypress run --sync exits before end of test, with local install of browserstack-cypress-cli in lerna monorepo. But it should wait for the end of the test.

That is, with globally installed browserstack-cypress-cli, it shows "All tests…" test status, but locally installed one in monorepo exits before then.

Note: If you install it globally (npm install -g), or don't use monrepo, then the problem does not happen.

Workaround:

In package.json, use nohoist to prevent browserstack-cypress-cli from being hoisted:

  "workspaces": {
    "packages": [
      "packages/*"
    ],
    "nohoist": [
      "**/browserstack-cypress-cli",
      "**/browserstack-cypress-cli/**"
    ]
  }

Log with global install of browserstack-cypress-cli:

	$ bash run-test.sh
	{"state":"connected","pid":7876,"message":"Connected"}
	[2/9/2021, 7:31:52 AM] - info: Reading config from C:\Source\gh-tests-only-repo\packages\cypress-tests\browserstack.json
	[2/9/2021, 7:31:52 AM] - info: Reading username from the environment variable BROWSERSTACK_USERNAME
	[2/9/2021, 7:31:52 AM] - info: Reading access key from the environment variable BROWSERSTACK_ACCESS_KEY
	[2/9/2021, 7:31:52 AM] - info: Reading local identifier from the environment variable BROWSERSTACK_LOCAL_IDENTIFIER
	[2/9/2021, 7:31:52 AM] - info: Validating the config
	[2/9/2021, 7:31:52 AM] - warn: Using 1 machines instead of 4 that you configured as there are 1 specs to be run on 1 browser combinations.
	[2/9/2021, 7:31:52 AM] - info: Creating tests.zip with files in .
	[2/9/2021, 7:31:52 AM] - info: Uploading the tests to BrowserStack
	[2/9/2021, 7:31:52 AM] - info: Uploaded tests successfully (bs://701d6d2dbc041e377f6505pw048adb34f60479ff)
	[2/9/2021, 7:31:52 AM] - info: Deleted tests.zip successfully.
	[2/9/2021, 7:31:52 AM] - info: Browsers list: Windows 10 / Chrome (latest-1)
	[2/9/2021, 7:31:52 AM] - info: Local is set to: true (you will now be able to test localhost / private URLs)
	[2/9/2021, 7:31:52 AM] - info: Running your tests in headless mode. Use --headed arg to run in headful mode.
	[2/9/2021, 7:31:52 AM] - info: Parallels limit specified: 1
	[2/9/2021, 7:31:53 AM] - warn: Your build will run using Cypress 6.2.1 instead of Cypress 6. Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions
	[2/9/2021, 7:31:53 AM] - info: Success! Build created with build id: e52b0c3127ac6afb0eb6a6f76716050a58609d64
	[2/9/2021, 7:31:53 AM] - info: Visit the Automate dashboard for real-time test reporting: https://automate.browserstack.com/dashboard/v2/builds/e52b0c3127ac6afb0wd9a6f76716050a58625164
	
	All tests:
	--------------------------------------------------------------------------------
	 Chrome 87 (Windows 10)          :  cypress/integration/example.spec.ts ✔
	--------------------------------------------------------------------------------
	
	Failed / skipped test report:
	+--------------------------------------------------------------+--------+---------+-------------------------+
	| Spec                                                         | Status | Browser | BrowserStack Session ID |
	+--------------------------------------------------------------+--------+---------+-------------------------+
	
	Total tests: 1, passed: 1, failed: 0, skipped: 0
	Done in 105.759 seconds using 1 machines
	
	[2/9/2021, 7:33:38 AM] - info: Report for build: e52b0c3127ac6afb0eb6a6f7671pw09d58625164 was successfully created.
	See the entire build report here:
	https://automate.browserstack.com/dashboard/v2/builds/e52b0c3127ac6afb0ebwe96f76716050a58625164
	{"status":"success","message":"BrowserStackLocal stopped successfully"}

Log with local install of browserstack-cypress-cli:

	$ bash run-test.sh
	{"state":"connected","pid":8084,"message":"Connected"}
	[2/9/2021, 7:30:21 AM] - info: Reading config from C:\Source\gh-tests-only-repo\packages\cypress-tests\browserstack.json
	[2/9/2021, 7:30:21 AM] - info: Reading username from the environment variable BROWSERSTACK_USERNAME
	[2/9/2021, 7:30:21 AM] - info: Reading access key from the environment variable BROWSERSTACK_ACCESS_KEY
	[2/9/2021, 7:30:21 AM] - info: Reading local identifier from the environment variable BROWSERSTACK_LOCAL_IDENTIFIER
	[2/9/2021, 7:30:21 AM] - info: Validating the config
	[2/9/2021, 7:30:21 AM] - warn: Using 1 machines instead of 4 that you configured as there are 1 specs to be run on 1 browser combinations.
	[2/9/2021, 7:30:21 AM] - info: Creating tests.zip with files in .
	[2/9/2021, 7:30:21 AM] - info: Uploading the tests to BrowserStack
	[2/9/2021, 7:30:21 AM] - info: Uploaded tests successfully (bs://093d2b3f11e51685befcdbopwddb096e012sdfc5)
	[2/9/2021, 7:30:21 AM] - info: Deleted tests.zip successfully.
	[2/9/2021, 7:30:21 AM] - info: Browsers list: Windows 10 / Chrome (latest-1)
	[2/9/2021, 7:30:21 AM] - info: Local is set to: true (you will now be able to test localhost / private URLs)
	[2/9/2021, 7:30:21 AM] - info: Running your tests in headless mode. Use --headed arg to run in headful mode.
	[2/9/2021, 7:30:21 AM] - info: Parallels limit specified: 1
	[2/9/2021, 7:30:22 AM] - warn: Your build will run using Cypress 6.2.1 instead of Cypress 6. Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions
	[2/9/2021, 7:30:22 AM] - info: Success! Build created with build id: d1c650063c35e0769dfafcc671e54wer507d3bc
	[2/9/2021, 7:30:22 AM] - info: Visit the Automate dashboard for real-time test reporting: https://automate.browserstack.com/dashboard/v2/builds/d1c650063c35e0769dfafcc671ewo9350507d3bc
	{"status":"success","message":"BrowserStackLocal stopped successfully"}

Setup:

The shell script to run the test looks like this:
	local_identifier="my-test-1"
	BrowserStackLocal --key $BROWSERSTACK_ACCESS_KEY --local-identifier="$local_identifier" --daemon start
	BROWSERSTACK_LOCAL_IDENTIFIER=$local_identifier ./node_modules/.bin/browserstack-cypress run --sync
	# BROWSERSTACK_LOCAL_IDENTIFIER=$local_identifier browserstack-cypress run --sync
	BrowserStackLocal --key $BROWSERSTACK_ACCESS_KEY --local-identifier="$local_identifier" --daemon stop

Not allowing to create Browserstack configuration file of some specific name.

As per the Pro Tip in the doc -https://www.browserstack.com/docs/automate/cypress/cli-reference#generate-configuration-file

Protip: We recommend that you create multiple BrowserStack config
files for each of your environments of test types (for example, one
each for staging, production, regression, P1 tests etc.,) and use the
relevant Cypress config file for each environment.

I've tried creating different BrowserStack configuration files for every environment as per doc - https://www.browserstack.com/docs/automate/cypress/cli-reference#generate-configuration-file
Running below command:

browserstack-cypress init browserstack.staging.json

Getting error:

Kalpeshs-MacBook-Pro:cypress-browserstack kalpesh$ browserstack-cypress init browserstack.staging.json
[10/10/2020, 10:56:20] - error: File already exists, delete the browserstack.json file manually. skipping...

Tool doesn't support Cypress experimental features

experimental features are enabled:

"experimentalFetchPolyfill": true,
  "experimentalNetworkStubbing": true,

I run my tests using cy.route2 on Browserstack and get the next error:
Screenshot 2020-11-23 at 2 02 19 PM

Locally works fine.

What is workaround? I need to use cy.route2 api method for mocking HTTP requests.

How to run cypress.json file of different name using cypress_proj_dir key other than cypress.json file name

Currently, I have different cypress.json files for each environment. E.g - cypress-qa.json and cypress-dev.json. How can we run a specific cypress-env.json file using "cypress_proj_dir": "./",.
I am running my tests locally by invoking these cypress-env.json files using the environment specific bash files, as per my build environment need.
Can we achieve the same using BrowserStack by mentioning specific cypress-env.json file name? Tried different combinations but it throws below mentioned error:
error: cypress.json file is not found at cypress_proj_dir path ./

High severity vulnerabilities in dependencies

Hi there,

I get the following four high severity vulnerabilities after installing the latest version 1.14.1.

Is there any plan to fix the issues with updated dependencies?

# npm audit report

async  <2.6.4
Severity: high
Prototype Pollution in async - https://github.com/advisories/GHSA-fwr7-v2mv-hh25
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/winston/node_modules/async
  winston  0.4.0 - 2.4.5 || 3.0.0-rc0 - 3.0.0-rc6
  Depends on vulnerable versions of async
  node_modules/winston
    browserstack-cypress-cli  >=1.1.4
    Depends on vulnerable versions of requestretry
    Depends on vulnerable versions of winston
    node_modules/browserstack-cypress-cli

requestretry  <7.0.0
Severity: high
Cookie exposure in requestretry - https://github.com/advisories/GHSA-hjp8-2cm3-cc45
fix available via `npm audit fix --force`
Will install [email protected], which is a breaking change
node_modules/requestretry

4 high severity vulnerabilities

Unable to configure cypress.json

So, I'm able to connect with dashboard, but it is looks like for some reason my old cypress.json config is wrong

Here is the error:
cypress-error

I don't understand why browsers is required, since all allowed browsers I defined in browserstack.json
My cypress.json

{}

My browserstack.json

{
    "auth": {
        "username": "*****",
        "access_key": "*****"
    },
    "browsers": [
        {
            "browser": "chrome",
            "os": "Windows 10",
            "versions": [
                "latest",
                "latest-1"
            ]
        }
    ],
    "run_settings": {
        "cypress_config_file": "./cypress.json",
        "cypress_version": "5",
        "project_name": "Cypress Kitchen Sink Example",
        "build_name": "Build no: 1",
        "parallels": 5,
        "npm_dependencies": {},
        "specs": ["cypress/integration/functional/**/*"]
      },
    "connection_settings": {
        "local": true
    },
    "disable_usage_reporting": false
}

What I'm doing wrong?

I see that you have same cypress.json config in your example

options.uri is a required argument

I'm unable to get started with Browserstack Cypress. I'm running 1.5.0. I've tried using browerstack-cypress-cli both locally and globally, installed via yarn. Here's my config (mostly unchanged from the docs):

{
  "auth": {
    "username": "my_username_here",
    "access_key": "my_key_here"
  },
  "browsers": [{
      "browser": "chrome",
      "os": "Windows 10",
      "versions": ["latest", "latest-1"]
    },
    {
      "browser": "firefox",
      "os": "OS X Mojave",
      "versions": ["latest", "latest-1"]
    },
    {
      "browser": "edge",
      "os": "OS X Catalina",
      "versions": ["latest", "latest-1"]
    }
  ],
  "run_settings": {
    "cypress_config_file": "./src/path/to/monorepo/project/cypress.json",
    "project_name": "Project",
    "build_name": "Build",
    "parallels": "5"
  }
}

And the output:

→ ./node_modules/.bin/browserstack-cypress run
No env file present for the current environment:  development 
 Falling back to .env config
No env file present for the current environment:  development
[10/9/2020, 2:32:42 PM] - info: Reading config from /Users/▉▉/▉▉/browserstack.json
[10/9/2020, 2:32:42 PM] - info: browserstack.json file is validated
[10/9/2020, 2:32:43 PM] - error:  
{
  message: 'options.uri is a required argument',
  stack: 'Error: options.uri is a required argument\n' +
    '    at Request.init (/Users/▉▉/▉▉/node_modules/request/request.js:231:31)\n' +
    '    at new Request (/Users/▉▉/▉▉/node_modules/request/request.js:127:8)\n' +
    '    at request (/Users/▉▉/▉▉/node_modules/request/index.js:53:10)\n' +
    '    at Function.post (/Users/▉▉/▉▉/node_modules/request/index.js:61:12)\n' +
    '    at /Users/▉▉/▉▉/node_modules/browserstack-cypress-cli/bin/helpers/zipUpload.js:28:13\n' +
    '    at new Promise (<anonymous>)\n' +
    '    at Object.uploadCypressZip [as zipUpload] (/Users/▉▉/▉▉/node_modules/browserstack-cypress-cli/bin/helpers/zipUpload.js:10:10)\n' +
    '    at /Users/▉▉/▉▉/node_modules/browserstack-cypress-cli/bin/commands/runs.js:55:28\n' +
    '    at runMicrotasks (<anonymous>)\n' +
    '    at processTicksAndRejections (internal/process/task_queues.js:97:5)'
}
[10/9/2020, 2:32:43 PM] - error: Zip Upload failed.
[10/9/2020, 2:32:44 PM] - info: Zip file deleted successfully.

This is pointing to a Cypress config I'm able to run via Cypress directly outside of Browserstack.

No video is captured in BS

I set video as true in cypress.json file, but when I check the session in BS, there are no videos captured.

Add option to include additional file types in the .zip archive

Our project is structured as a monorepo and we have two Cypress projects that use a shared library that's also part of the monorepo.
It'd be useful to be able to package this library locally and reference the .tar.gz file as an npm package, but this isn't one of the file extensions that can be included in the package.
This might also help in working around issues with private npm repositories.

I think it'd be a good addition either to allow additional file extensions as part of the configuration and/or as a CLI option. Failing that, to include .tar.gz as a supported extension (.zip is already supported).

The tool assumes that the npm packages are installed using the same OS that will run the tests

I've run into lots of issues with running tests with results from BrowserStack that look like this:

 error: Cypress could not run any of the specs in the build since an exception occurred. The stacktrace of the error is given below:

--------------------------------------------------------------------------------
npm
WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @cypress/[email protected] requires a peer of @babel/core@^7.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN @cypress/[email protected] requires a peer of @babel/preset-env@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @cypress/[email protected] requires a peer of babel-loader@^8.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of encoding@^0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN e2e No description
npm WARN e2e No repository field.
npm WARN e2e No license field.

npm
 ERR! code EEXIST
npm ERR! path .\packages\xxx\tests\e2e\node_modules\.bin\webpack

npm ERR!
 Refusing to delete .\packages\xxx\tests\e2e\node_modules\.bin\webpack: is outside .\packages\xxx\tests\e2e\node_modules\webpack and not a link
npm ERR! File exists: .\packages\xxx\tests\e2e\node_modules\.bin\webpack
npm
ERR! Move it away, and try again.

I suspect that this might be happening because I build the test package using a Docker container on Linux, but the machine running the tests uses Windows.
Using cached packages for one OS and then trying to unzip them onto another OS is not going to work a lot of the time. I don't think the tool should be attempting to do this, or there should be some kind of opt-out.

cy.intercept() TypeError: mime.getType is not a function

Hi team, we upgraded from Cypress 8.7.0 to Cypress v9.4.1 as this is the latest supported in Browserstack according to the docs https://www.browserstack.com/docs/automate/cypress/limitations

One of our tests uses cy.intercept and after the upgrade we noticed the following error in that test:

TypeError: An error was thrown while processing a network event: mime.getType is not a function
  TypeError: mime.getType is not a function
      at ret (/root/app/packages/server/lib/controllers/xhrs.js:120:19)
      at parseContentType (/root/app/packages/server/lib/controllers/xhrs.js:124:14)
      at /root/app/packages/net-stubbing/lib/server/util.js:106:107
      at Generator.next (<anonymous>:null:null)
      at fulfilled (/root/app/packages/net-stubbing/lib/server/util.js:5:58)

After debugging, I found out that the problem might be the version of the mime package, as it is used to parse the response mime type. Version 2.4.4 introduced breaking changes (like renaming lookup in favor of getType), but what is weird is that this version upgrade (from 1.6 to 2.4.4) was made in Cypress v4.3.0 so...not sure what's going on.

Any help will be much appreciated. Thank you in advance.

Specifying multiple npm_dependencies in run_settings section within browserstack.json

Howdy,

I am trying to use the tests runners from browserstack while running my Cypress tests within my FE project. I wanted to ask what the suggested approach might be when working within a project with multiple npm dependencies, I have over 100+ declared in my monorepo which I cannot declared manually within the npm_dependencies section of the file browserstack.json. I could generate a template for browserstack.json and generate dynamically the final json file from the template containing every npm dependency and version no., but I wanted to ask first if there is already a tool to do the job.

Thank you for you help

1.18.0 contains breaking changes

We use Nx to build and test our code on our pipeline in parallel, since we have more than one target running at the same time we must differentiate each cypress config file name.
For example, when we run our cypress tests these are the config file generated:
cypress.target-1.json
cypress.target-2.json
cypress.target-3.json

Inspecting the code we've found out that the new version of the library only allows standard names such as cypress.json, cypress.config.js, etc.

As you can see in the verify function here
https://github.com/browserstack/browserstack-cypress-cli/blame/566e0f43db9a190ce978a65236324ba98708a747/bin/helpers/capabilityHelper.js#L252
and here
https://github.com/browserstack/browserstack-cypress-cli/blame/566e0f43db9a190ce978a65236324ba98708a747/bin/helpers/constants.js#L391

every configuration file named differently from the below ones will get discarded

  • cypress.json
  • cypress.config.js
  • cypress.config.ts
  • cypress.config.mjs
  • cypress.config.cjs

Can the ability to ingest files with custom names be reintroduced in the latest version?

Thank you.

--sync flag no longer working on GitHub Actions

I've been using browserstack-cypress-cli for a while now via a GitHub action and am recently noticing that it's not honoring the --sync flag.

[9/20/2021, 3:24:57 PM] - info: Success! Build created with build id: {{build_id}
[9/20/2021, 3:24:57 PM] - info: Visit the Automate dashboard for real-time test reporting: https://automate.browserstack.com/dashboard/v2/builds/{{build_id}}
[9/20/2021, 3:24:58 PM] - error: The report cannot be generated as the build {{build_id}} is still running. Try again later once the build run is completed.
See the entire build report here:
https://automate.browserstack.com/dashboard/v2/builds/{{build_id}}

The command being run is as follows. I have also tried it with --sync true.
npx browserstack-cypress-cli --ccf cypress.qa.json -p 1 --sync --local false --build-name=build-qa-${{ github.sha }} run

Failure when using a tsconfig file with 'extends'

The browserstack cli fails to prepare test files if the tsconfig uses 'extends'. If I copy the exact tsconfig that was extended into my compilerOptions rather than using 'extends', then it succeeds. This can be problematic in cases like mine where many services extend a base config.

Repro steps:

  • create any simple POC with cypress tests, but attempt to 'extend' another tsconfig file in your tsconfig.
  • Run the tests with the browserstack CLI
  • Notice the failure "Error: error while parsing tsconfig.json"

Here is a stack overflow question regarding this: https://stackoverflow.com/questions/72128417/run-typescript-cypress-e2e-tests-over-browserstack#comment128082231_72128417

Incorrect exit code when failing to install npm dependencies

I noticed that when I've forgotten to update the npm_dependencies versions in the browserstack.js, and Browserstack fails to run the build, running browserstack-cypress run --sync --config-file browserstack.js does not return a failure/error exit code on the commandline, it proceeds as if everything is fine.

Here's an example of the output on one of these runs if it helps:

[2021-10-01T11:20:56.943Z] $ browserstack-cypress run --sync --config-file browserstack.js --build-name test-pipeline-changes-2021-10-01-9283ba5
[2021-10-01T11:20:57.504Z] [10/1/2021, 11:20:58 AM] - info: Reading config from /tmp/workspace/ata-webapp_test-pipeline-changes/browserstack.js
[2021-10-01T11:20:57.504Z] [10/1/2021, 11:20:58 AM] - info: Reading username from the environment variable BROWSERSTACK_USERNAME
[2021-10-01T11:20:57.504Z] [10/1/2021, 11:20:58 AM] - info: Reading access key from the environment variable BROWSERSTACK_ACCESS_KEY
[2021-10-01T11:20:57.504Z] [10/1/2021, 11:20:58 AM] - info: Reading local identifier from the environment variable BROWSERSTACK_LOCAL_IDENTIFIER
[2021-10-01T11:20:57.504Z] [10/1/2021, 11:20:58 AM] - info: Validating the config
[2021-10-01T11:21:05.608Z] [10/1/2021, 11:21:06 AM] - info: Creating tests.zip with files in .
[2021-10-01T11:21:15.543Z] [10/1/2021, 11:21:15 AM] - info: Uploading the tests to BrowserStack
[2021-10-01T11:21:18.804Z] [10/1/2021, 11:21:18 AM] - info: Uploaded tests successfully (bs://8e7fb92dceed99cb94b4559048750c0616804a42)
[2021-10-01T11:21:18.804Z] [10/1/2021, 11:21:18 AM] - info: Deleted tests.zip successfully.
[2021-10-01T11:21:18.804Z] [10/1/2021, 11:21:19 AM] - info: Setting up Local testing...
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:24 AM] - info: Browsers list: OS X Catalina / Chrome (latest), Windows 10 / Edge (latest)
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:24 AM] - info: Local testing set up in always-on mode.
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:24 AM] - info: Local testing identifier: prdmgt-data-webapp-test-pipeline-changes-2021-10-01-9283ba5
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:24 AM] - info: Local is set to: true (you will now be able to test localhost / private URLs)
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:24 AM] - info: Running your tests in headless mode. Use --headed arg to run in headful mode.
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:24 AM] - info: Project name is: prdmgt-data-webapp
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:24 AM] - info: Build name is: test-pipeline-changes-2021-10-01-9283ba5
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:24 AM] - info: Parallels limit specified: 2
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:25 AM] - warn: Your build will run using Cypress 8.4.1 instead of Cypress 8. Read more about supported versions here: http://browserstack.com/docs/automate/cypress/supported-versions
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:25 AM] - info: Success! Build created with build id: b558ca63c68e012f640d29aaf82e2c79159a6f39
[2021-10-01T11:21:25.333Z] [10/1/2021, 11:21:25 AM] - info: Visit the Automate dashboard for real-time test reporting: https://automate.browserstack.com/dashboard/v2/builds/b558ca63c68e012f640d29aaf82e2c79159a6f39
[2021-10-01T11:21:29.493Z] [10/1/2021, 11:21:29 AM] - error: The report cannot be generated as the build b558ca63c68e012f640d29aaf82e2c79159a6f39 is still running. Try again later once the build run is completed.
[2021-10-01T11:21:31.380Z] See the entire build report here:
[2021-10-01T11:21:31.380Z] https://automate.browserstack.com/dashboard/v2/builds/b558ca63c68e012f640d29aaf82e2c79159a6f39

Running this in our Jenkins pipeline doesn't report any errors, however looking at the Browserstack build shows there was a NPM_INSTALL_FAILED issue. Can we get an exit code that reflects the failure in this scenario?

The 'task' event has not been registered in the plugins file. You must register it before using cy.task()

I was trying to delete one file before running any tests, but I got the above error. Below is my index.js file

import './commands';
const fs = require('fs');

module.exports = (on, config) => {
  on('task', {
    deleteFile (fileName) {
      if(fs.existsSync(fileName)) {
        return fs.unlink(fileName, (err) => {
          if (err) throw err;
          console.log('Successfully deleted the old failure log');
        });
      }
      return null;
    }
  })
}

before(() => {
  cy.log("Tests starting");
  cy.task('deleteFile', '../../failure.log');
})

Fetch polyfill

Hello, I'm facing issue with running tests which includes stubs for fetch. Neither cypress version 5.0.0 with experimentalFetchPolyfill nor 5.0.1 with experimentalNetworkStubbing is working for me.
Could you please advise how this could be fixed?
Thanks

Incorrect exit code when tests fail

Whenever tests from cypress fail, I'd expect the exit code to be different than 0. Right now I'm getting success whether the tests fail or not. For instance:

Total tests: 37, passed: 34, failed: 3, skipped: 0
Done in 2856.008 seconds using 10 machines

It was reported as success. I'm currently using v1.13 with Cypress 9.4.1, but this happened with v1.12.1 and Cypress 8.7.1. Not sure if this is intended, but it doesn't feel correct for a CI tool.

Noticing this issue from 1.10 all the way through 1.13 (not sure if this was previously present). It might be worth mentioning that I'm using 10 machines with the parallel support.

Probably related to #170

Custom reporter in Cypress config doesn't work in Browserstack

I'm using Cypress to run my e2e testing on Browserstack. I'm using junit reporter which is configured in the cypress.json. When I'm running tests locally test results are generated according to the format (i.e junit). However, when I'm running testing in Browserstack and fetch the results, they are not following the cypress config and are returned as mocha report files (json/html) instead of junit (xml).

cypress.json

{
  "reporter": "junit",
  "reporterOptions": {
    "mochaFile": "results/test-output-[hash].xml",
    "toConsole": true,
    "attachments": true
  }
}

browserstack.json

{
    "auth": {...},
    "browsers": [...],

    "run_settings": {
      "cypress_config_file": "./cypress.json",
      "cypress_version": "6",
      "project_name": "FancyProjectName",
      "build_name": "Build no. 42",
      "parallels": "2",
      "npm_dependencies": {
        "typescript": "^4.2.4"
      }
    }
  }

browserstack-cypress run --sync fails with 'Error: All parallels are currently in use'

browserstack-cypress run --sync fails intermittently with:

[8/30/2021, 7:19:12 PM] - info: Browsers list: OS X Catalina / Chrome (latest)
[8/30/2021, 7:19:12 PM] - info: Local is set to: false (you won't be able to test localhost / private URLs)
[8/30/2021, 7:19:12 PM] - info: Running your tests in headless mode. Use --headed arg to run in headful mode.
[8/30/2021, 7:19:12 PM] - info: Project name is: id-cypress
[8/30/2021, 7:19:12 PM] - info: Build name is: id-cypress
[8/30/2021, 7:19:12 PM] - info: Parallels limit specified: 40
[8/30/2021, 7:19:12 PM] - error: Build creation failed. Error: All parallels are currently in use, and the queue is full. Please wait for the builds to finish and try again or upgrade your plan to run more builds simultaneously.
Done in 2.12s.

and exits with a 0 (success code).

When this occurs, the BS Dashboard shows 8/80 Parallels and 0/80 Queued.

We are using;

 "dependencies": {
    "browserstack-cypress-cli": "^1.8.1"
  }

ID of the last successful build:
7a169c66ce79231e0865d3c5a96428483c6516b4

specify private npm package in "npm_dependencies"

In my project, I can use import to import some npm modules in my tests and it works fine for Cypress directly. When I tried to integrate with browserstack-cypress-cli, I got module import error like below

Error: Can't walk dependency graph: Cannot find module 'moment' from 'C:\Users\hello\Documents\documents\cypress_test\cypress_test_folder\cypress\pages' required by C:\Users\hello\Documents\documents\cypress_test\cypress_test_folder\cypress\pages\AboutYouPage.js

Then I added these packages to "npm_dependencies" in browserstack.json, but one problem is that one of modules is Private, how can I specify the token to install this module?

Unable to retrieve local enviroment variable for npmrc

I have an npmrc file which contains an auth token stored within my .bash_profile.

When trying to run cypress through browserstack I get an error that this environment variable cannot be found. This package is also not included in the npm_dependencies, so after putting any hardcoded string in the npmrc file it will work. Is it possible to put in local environment variables or am I doing something wrong?

 {
   "auth": {
     ...
   },
   "browsers": [
     {
       "browser": "chrome",
       "os": "Windows 10",
       "versions": [
         "latest"
       ]
     }
   ],
   "run_settings": {
     "cypress_config_file": "./cypress-dev.json",
     "project_name": "project",
     "build_name": "project build",
     "parallels": "1",
     "exclude": [],
     "npm_dependencies": {
       "typescript": "4.1.5"
     },
     "package_config_options": {},
     "headless": false,
     "sys_env_vars": ["FONTAWESOME_NPM_AUTH_TOKEN"]
   },
   "connection_settings": {
     "local": true,
     "local_identifier": null,
     "local_mode": null,
     "local_config_file": null
   },
   "disable_usage_reporting": true
 }

Npmrc:

@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=${FONTAWESOME_NPM_AUTH_TOKEN}

Error when running on browserstack:

Error: Failed to replace env in config: ${FONTAWESOME_NPM_AUTH_TOKEN}
    at \cypress_node\node_modules\npm\lib\config\core.js:415:13
    at String.replace (<anonymous>)
    at envReplace (\cypress_node\node_modules\npm\lib\config\core.js:411:12)
    at parseField (\cypress_node\node_modules\npm\lib\config\core.js:389:7)
    at \cypress_node\node_modules\npm\lib\config\core.js:330:24
    at Array.forEach (<anonymous>)
    at Conf.add (\cypress_node\node_modules\npm\lib\config\core.js:328:23)
    at ConfigChain.addString (\cypress_node\node_modules\npm\node_modules\config-chain\index.js:244:8)
    at Conf.<anonymous> (\cypress_node\node_modules\npm\lib\config\core.js:316:10)
    at \cypress_node\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:115:16
\cypress_node\node_modules\npm\lib\npm.js:59
      throw new Error('npm.load() required')
      ^

Unable to run : browserstack-cypress run --sync

Hi,
After browserstack-cypress run --sync I'm receiving:

[3/15/2021, 4:34:03 PM] - info: Reading config from C:\tests\browserstack.json
[3/15/2021, 4:34:03 PM] - info: Validating the config
[3/15/2021, 4:34:03 PM] - info: Creating tests.zip with files in .
[3/15/2021, 4:34:04 PM] - info: Uploading the tests to BrowserStack
[3/15/2021, 4:34:04 PM] - error:
{
  message: 'Client network socket disconnected before secure TLS connection was established',
  stack: 'Error: Client network socket disconnected before secure TLS connection was established\n' +
    '    at connResetException (internal/errors.js:604:14)\n' +
    '    at TLSSocket.onConnectEnd (_tls_wrap.js:1513:19)\n' +
    '    at Object.onceWrapper (events.js:417:28)\n' +
    '    at TLSSocket.emit (events.js:323:22)\n' +
    '    at endReadableNT (_stream_readable.js:1204:12)\n' +
    '    at processTicksAndRejections (internal/process/task_queues.js:84:21)',
  code: 'ECONNRESET',
  path: null,
  host: 'api-cloud.browserstack.com',
  port: 443,
  localAddress: undefined
}
[3/15/2021, 4:34:04 PM] - error: Zip Upload failed.
[3/15/2021, 4:34:04 PM] - info: Deleted tests.zip successfully.

Could you please help me ?

Exitcode != 0 if test fails

For CI it is essential that exit code is something other then 0 if test fails or anything else goes wrong.

Cypress no longer supports cypress.json

As of Cypress 10, cypress.json is no longer supported (https://docs.cypress.io/guides/references/configuration).

Browserstack-cypress-cli requires a json file in cypress_config_file and throws an invalid JSON parse error when I reference cypress.config.ts (which is to be expected as its not JSON).

(node:10945) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
[12/07/2022, 12:05:20] - error:  
{
  message: 'Unexpected token i in JSON at position 0',
  stack: 'SyntaxError: Unexpected token i in JSON at position 0\n' +
    '    at JSON.parse (<anonymous>)\n' +
    '    at Object.exports.getCypressJSON (/Users/ross/.nvm/versions/node/v14.18.1/lib/node_modules/browserstack-cypress-cli/bin/helpers/utils.js:1082:24)\n' +
    '    at Object.exports.setProjectId (/Users/ross/.nvm/versions/node/v14.18.1/lib/node_modules/browserstack-cypress-cli/bin/helpers/utils.js:363:28)\n' +
    '    at Object.exports.setRecordCaps (/Users/ross/.nvm/versions/node/v14.18.1/lib/node_modules/browserstack-cypress-cli/bin/helpers/utils.js:371:45)\n' +
    '    at /Users/ross/.nvm/versions/node/v14.18.1/lib/node_modules/browserstack-cypress-cli/bin/commands/runs.js:98:11\n' +
    '    at processTicksAndRejections (internal/process/task_queues.js:95:5)'
}```



Will support for cypress.config.ts be added?

Unable to run browserstack-cypress run command on Openshift

Hi Team -

I have integrated browserstack-cypress-cli with my cypress framework and able to run test scenarios from local IDE to browserstack. While i try to run same command from openshift i get below error -

/bin/sh: browserstack-cypress: command not found

i checked the presence of node_modules.bin\browserstack-cypress exist in this path ... still it couldnt find the command for run.

Any topics discussed on this - Please share me insight on this.

localIdentifier capability should be supported with the local capability

since the BrowserStack Local capability is supported in the connection_settings configuration, you should also provide the ability to set a value for localIdentifier as this would be more in line with how the Cypress tests would need to be used if they're part of a CICD pipeline that runs multiple builds in parallel.
Example implementation should look like the following:

{
   "connection_settings": {
      "local": true,
      "localIdentifier": "build_name+build_number"
    }
}

this would then allow for adding a reference to the browserstack-local npm package which could be started using the same localIdentifier and accessKey as are used for the Cypress tests

Browserstack ignores local_config_file

I'm trying to setup local testing which requires the setting force_local to be on. However no matter what I try the local_config_file doesn't seem to be read out.

I've tried changing the local-indentifier or provide the access key through the local_config_file but these values don't seem to change anything.

Am I missing something as to why the local_config_file doesn't seem to get read out?

Browserstack config json:

{
  "auth": {
    ...
  },
  "browsers": [
    {
      "browser": "chrome",
      "os": "Windows 10",
      "versions": [
        "latest"
      ]
    }
  ],
  "run_settings": {
    "cypress_config_file": "./cypress-ci.json",
    "project_name": "project name",
    "build_name": "build name",
    "parallels": "1",
    "exclude": [],
    "npm_dependencies": {
      "typescript": "4.1.5"
    },
    "package_config_options": {},
    "headless": false,
    "system_env_vars": ["NPM_AUTH_TOKEN"]
  },
  "connection_settings": {
    "local": true,
    "local_config_file": "./local_testing.yml"
  },
  "disable_usage_reporting": true
}

local_config file:

# Route all traffic via machine where BrowserStackLocal Binary is running. Local tries to fetch public urls directly, unless this option is specified.
force-local: True

Could not reach BrowserStack APIs. Please check your network or see if you need to whitelist *.browserstack.com

Can't run test in browserstack:

$ browserstack-cypress run --sync
config: {
  uploadUrl: 'https://api-cloud.browserstack.com/automate-frameworks/cypress/upload',
  rails_host: 'https://api.browserstack.com',
  dashboardUrl: 'https://automate.browserstack.com/dashboard/v2/builds/',
  usageReportingUrl: 'https://eds.browserstack.com:443/send_event_cy_internal',      
  localTestingListUrl: 'https://www.browserstack.com/local/v1/list',
  env: 'production',
  cypress_v1: 'https://api.browserstack.com/automate/cypress/v1',
  buildUrl: 'https://api.browserstack.com/automate/cypress/v1/builds/',
  buildStopUrl: 'https://api.browserstack.com/automate/cypress/v1/builds/stop/',     
  fileName: 'tests.zip',
  retries: 5,
  networkErrorExitCode: 2
}
[26.03.2021, 08:09:29] - info: Reading config from C:\Projects\polka\browserstack.json
[26.03.2021, 08:09:29] - info: Validating the config
[26.03.2021, 08:09:29] - info: Creating tests.zip with files in .
[26.03.2021, 08:11:13] - info: Uploading the tests to BrowserStack
[26.03.2021, 08:11:15] - error: Could not reach BrowserStack APIs. Please check your network or see if you need to whitelist *.browserstack.com
[26.03.2021, 08:11:15] - error: Zip Upload failed.
[26.03.2021, 08:11:15] - info: Deleted tests.zip successfully.

Firewall and antivirus are disabled:

sh-5.0$ curl -X POST https://api-cloud.browserstack.com/automate-frameworks/cypress/upload
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

custom reporter is not working

I added custom reporter in cypress.json and it works fine when doing cypress run - generating failure.log.
But when I run the tests in BS, the custom reporter is not considered and no failure.log is generated.

{
  "defaultCommandTimeout": 90000,
  "pageLoadTimeout": 90000,
  "video": false,
  "retries": {
    "runMode": 1,
    "openMode": 0
  },
  "chromeWebSecurity": false,
  "reporter": "./reporter.js"
}

reporter.js

const mocha = require('mocha');
const chalk = require('chalk');

module.exports = MyReporter;

function MyReporter(runner) {
  mocha.reporters.Base.call(this, runner);
  let passes = 0;
  let failures = 0;

  runner.on('pass', function(test) {
    passes++;
    console.log(chalk.green('Pass: ') + test.fullTitle());
  });

  runner.on('fail', function(test, err) {
    failures++;
    console.log(`${chalk.red('Fail: ') + test.fullTitle()}\n${err.message}`);
    fs.appendFileSync('./failure.log', `Spec: ${test.fullTitle()} was failed\n`);
    fs.appendFileSync('./failure.log', `Failure: ${err.message}\n\n`);
  });

  runner.on('end', function() {
    console.log('End: %d/%d', passes, passes + failures);
  });
}

mocha.utils.inherits(MyReporter, mocha.reporters.Spec);

Getting Error : Please contact BrowserStack support for Cypress.

When I run the code with required configuration , I am getting the below errors :
'Please contact BrowserStack support for Cypress.' }
[5/10/2020, 9:37:48 PM] Zip Upload failed.
[5/10/2020, 9:37:48 PM] [ERROR] Zip Upload failed.
[5/10/2020, 9:37:48 PM] undefined

I debugged the source and found the below message came from browser stack cloud server.
Here is the request :
{ url:
'https://api-cloud.browserstack.com/automate-frameworks/cypress/upload',
auth:
{ user: 'xxxxxxxxxx',
password: 'xxxxxxxxxxxxxxxxx',
pass: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx' },
formData:
{ file:
ReadStream {
_readableState: [ReadableState],
readable: false,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
path: 'tests.zip',
fd: null,
flags: 'r',
mode: 438,
start: undefined,
end: Infinity,
autoClose: true,
pos: undefined,
bytesRead: 44607,
closed: true,
emit: [Function] },
filetype: 'zip',
filename: 'tests' } }
and response:

{ error: 'Please contact BrowserStack support for Cypress.' }

error: Build creation failed. Error: null

[7/28/2020, 3:58:20 PM] - info: Reading config from /Users/pedro/Workspace/end2end-stg/browserstack.json
[7/28/2020, 3:58:20 PM] - info: browserstack.json file is validated
[7/28/2020, 3:58:22 PM] - info: Zip uploaded with url: bs://71562c8a274231544ab2f67a5fb7b64587eb1da2
[7/28/2020, 3:58:22 PM] - info: Browser list: Windows 10-firefox75,Windows 10-edge81,OS X Catalina-chrome77,OS X Catalina-firefox75
[7/28/2020, 3:58:22 PM] - info: Test suite: bs://71562c8a274231544ab2f67a5fb7b64587eb1da2
[7/28/2020, 3:58:22 PM] - info: Local is set to: false
[7/28/2020, 3:58:22 PM] - info: Parallels limit specified: 2
[7/28/2020, 3:58:22 PM] - error: Build creation failed. Error: null
[7/28/2020, 3:58:25 PM] - info: Zip file deleted successfully.

my cypress.json is empty tho, it should get the default one from cypress?

How to specify mobile device?

I see the default list of gives you many desktop browsers to test against, but what about mobile devices such as iphone and android?

Firefox not running on latest for windows 10

You might notice that a few specs are missing in the test report as Cypress failed to run a few specs in the following environments:
Windows 10 firefox102

Browser: firefox
Version: Latest
OS: Windows 10
Cypress: 9 (9.6.1)

Expected:

  • runs firefox100 and runs as expected

Actual:

  • runs firefox102 and fails to run

According to https://www.browserstack.com/list-of-browsers-and-platforms/cypress_testing it should only be running 100.

Note: I haven't had time to test any other OS with firefox

(Apologies if this isn't the right place to be posting this)

cannot add run to a queue even when thread is available

I'm seeing the following error when trying to run from browserstack-cypress run: Build creation failed. Error: All parallel tests are currently in use, including the queued tests. Please wait to finish or upgrade your plan to add more sessions. If I look at my dashboard, I see near Parallel Threads: 10 running, 0 queued. Not sure if the issue lies with Browserstack's API or this library.

error output in browserstack test run shows it's using outdated Cypress version of 4.12

Is this expected? I'm using features in version 5, specifically 5.3.0

TimeoutError: operation timed out
    at afterTimeout (/root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:46:19)
    at Timeout.timeoutTimeout [as _onTimeout] (/root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/timers.js:76:13)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)

Cannot find module 'unzipper'

I'm currently trying to upgrade from 1.8.1, there's an issue with 1.9.0 whereby the CLI no longer waits for the browserstack build to finish (as if --sync isn't making a difference), so I thought I'd try bumping to 1.10.0, however now I'm getting the following error:


[2021-10-01T11:56:56.660Z] Error: Cannot find module 'unzipper'

[2021-10-01T11:56:56.660Z] Require stack:

[2021-10-01T11:56:56.660Z] - /tmp/workspace/ata-webapp_test-pipeline-changes/node_modules/browserstack-cypress-cli/bin/helpers/buildArtifacts.js

[2021-10-01T11:56:56.660Z] - /tmp/workspace/ata-webapp_test-pipeline-changes/node_modules/browserstack-cypress-cli/bin/commands/runs.js

[2021-10-01T11:56:56.660Z] - /tmp/workspace/ata-webapp_test-pipeline-changes/node_modules/browserstack-cypress-cli/bin/runner.js

[2021-10-01T11:56:56.660Z]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
[2021-10-01T11:56:56.660Z]     at Function.Module._load (internal/modules/cjs/loader.js:746:27)
[2021-10-01T11:56:56.660Z]     at Module.require (internal/modules/cjs/loader.js:974:19)
[2021-10-01T11:56:56.660Z]     at require (internal/modules/cjs/helpers.js:93:18)
[2021-10-01T11:56:56.660Z]     at Object.<anonymous> (/tmp/workspace/ata-webapp_test-pipeline-changes/node_modules/browserstack-cypress-cli/bin/helpers/buildArtifacts.js:7:14)
[2021-10-01T11:56:56.660Z]     at Module._compile (internal/modules/cjs/loader.js:1085:14)
[2021-10-01T11:56:56.660Z]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
[2021-10-01T11:56:56.660Z]     at Module.load (internal/modules/cjs/loader.js:950:32)
[2021-10-01T11:56:56.660Z]     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
[2021-10-01T11:56:56.660Z]     at Module.require (internal/modules/cjs/loader.js:974:19) {
[2021-10-01T11:56:56.660Z]   code: 'MODULE_NOT_FOUND',
[2021-10-01T11:56:56.660Z]   requireStack: [
[2021-10-01T11:56:56.660Z]     '/tmp/workspace/ata-webapp_test-pipeline-changes/node_modules/browserstack-cypress-cli/bin/helpers/buildArtifacts.js',
[2021-10-01T11:56:56.660Z]     '/tmp/workspace/ata-webapp_test-pipeline-changes/node_modules/browserstack-cypress-cli/bin/commands/runs.js',
[2021-10-01T11:56:56.660Z]     '/tmp/workspace/ata-webapp_test-pipeline-changes/node_modules/browserstack-cypress-cli/bin/runner.js'
[2021-10-01T11:56:56.660Z]   ]
[2021-10-01T11:56:56.660Z] }
[2021-10-01T11:56:56.660Z] error Command failed with exit code 1.

I had a quick look and seen that unzipper is only in the devDependencies of this NPM package, should it be a dependency?

Tests.zip generating excessive large file (GBs)

Using the below configuration on Mac OS and running the cli, the command never finished and was generating a tests.zip file gigabytes in size.

Running cli version 1.4

{
  "env": {
    "TEST_ENV": "[test-site]"
  },
  "auth": {
    "username": "",
    "access_key": ""
  },
  "browsers": [
    {
      "browser": "chrome",
      "os": "Windows 10",
      "versions": ["84"]
    }
  ],
  "run_settings": {
    "cypress_proj_dir": ".",
    "project_name": "project-name",
    "build_name": "build-name",
    "specs": ["src/components/**/*.browser.js"],
    "exclude": ["node_modules", "example"],
    "parallels": 1,
    "npm_dependencies": {
      "cypress-axe": "^0.8.1"
    },
    "package_config_options": {}
  },
  "connection_settings": {
    "local": false,
    "local_identifier": null
  },
  "disable_usage_reporting": false
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.