Closed
Description
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
Metadata
Metadata
Assignees
Labels
No labels