Skip to content

Commit 98d015c

Browse files
committed
Merge branch 'master' of github.com:browserstack/browserstack-cypress-cli into CYP_105_unit_tests
2 parents 804894e + dedbd95 commit 98d015c

File tree

4 files changed

+43
-18
lines changed

4 files changed

+43
-18
lines changed

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
[![npm version](https://badge.fury.io/js/browserstack-cypress-cli.svg)](https://badge.fury.io/js/browserstack-cypress-cli)
44

5+
> **Note**: Running Cypress tests on BrowserStack is in private alpha. We will be launching a public beta very soon.
6+
>
7+
> As such, if you don't have an email from us confirming your access to the Cypress integration, you won't be able to run your Cypress tests on our platform just yet.
8+
>
9+
> We are actively working on including more users in the private alpha. If you are an existing Automate user, please write to your BrowserStack account manager or to [email protected] to get early access to the platform before the public beta.
10+
511
The `browserstack-cypress-cli` is BrowserStack's command-line interface (CLI) which
612
allows you to run your Cypress tests on BrowserStack.
713

@@ -48,6 +54,9 @@ tests. Refer to the [configuration options](#configuration-options) to learn
4854
more about all the options you can use in `browserstack.json` and the possible
4955
values.
5056

57+
Make sure you specify the npm packages that your tests need to run using the
58+
`npm_dependencies` option in `run_settings`.
59+
5160
Then, run your tests on BrowserStack:
5261

5362
```bash
@@ -75,14 +84,18 @@ specified folder.
7584
"browsers": [
7685
{
7786
"browser": "chrome",
78-
"os": "OS X Catalina",
79-
"versions": ["69","66"]
87+
"os": "Windows 10",
88+
"versions": ["79","78"]
8089
}
8190
],
8291
"run_settings": {
8392
"cypress_proj_dir": "/path/to/directory-that-contains-<cypress.json>-file",
8493
"project_name": "my first project",
85-
"build_name": "build 1"
94+
"build_name": "build 1",
95+
"npm_dependencies": {
96+
"npm-package-you-need-to-run-tests-1": "^1.2.1",
97+
"npm-package-you-need-to-run-tests-2": "^7.1.6-beta.13",
98+
}
8699
},
87100
"connection_settings": {
88101
"local": false,
@@ -97,7 +110,7 @@ Here are all the options that you can provide in the `browserstack.json`:
97110
### Authentication
98111

99112
You can use the `auth` option to specify your username and access keys. You
100-
can find them in your [Automate dashboard](https://automate.browserstack.com/)
113+
can find them in your [Automate dashboard](https://automate.browserstack.com/)
101114

102115
| Option | Description | Possible values |
103116
| ------------ | ----------------------------- | --------------- |
@@ -120,11 +133,11 @@ Example:
120133
You can use the `browsers` option to specify the list of OS, browser and browser
121134
versions. Each browser combination should contain the following details:
122135

123-
| Option | Description | Possible values |
124-
| ---------- | ---------------------------------------------- | -------------------------------------------------------------- |
125-
| `os` | Operating system you want to run the tests on. | `Windows 10`, `OS X Mojave` and `OS X Catalina` |
126-
| `browser` | Browser you want to run the tests on. | `chrome`, `firefox` and `edge` |
127-
| `versions` | A list of supported browser versions. | Chrome: `66` to `80` <br/>Firefox: `60` to `72`<br/>Edge: `80` |
136+
| Option | Description | Possible values |
137+
| ---------- | ---------------------------------------------- | --------------------------------------------------------------------- |
138+
| `os` | Operating system you want to run the tests on. | `Windows 10` |
139+
| `browser` | Browser you want to run the tests on. | `chrome`, `firefox` and `edge` |
140+
| `versions` | A list of supported browser versions. | Chrome: `66` to `81` <br/>Firefox: `60` to `75`<br/>Edge: `80` & `81` |
128141

129142
Example:
130143

@@ -133,10 +146,10 @@ Example:
133146
"browsers": [{
134147
"os": "Windows 10",
135148
"browser": "chrome",
136-
"versions": ["69", "66"]
149+
"versions": ["79", "78"]
137150
},
138151
{
139-
"os": "OS X Mojave",
152+
"os": "Windows 10",
140153
"browser": "firefox",
141154
"versions": ["69", "66"]
142155
}
@@ -154,6 +167,7 @@ BrowserStack.
154167
| `cypress_proj_dir` | Path to the folder which contains `cypress.json` file. | - |
155168
| `project_name` | Name of your project. You'll be able to search & filter your tests on the dashboard using this. | - |
156169
| `build_name` | Name of your build / CI run. You'll be able to search & filter your tests on the dashboard using this. username. | - |
170+
| `npm_dependencies` | A list of NPM packages that are required to run your Cypress tests along with their version numbers. | - |
157171

158172
Example:
159173

@@ -162,7 +176,11 @@ Example:
162176
"run_settings": {
163177
"cypress_proj_dir": "/path/to/directory-that-contains-<cypress.json>-file",
164178
"project_name": "my first project",
165-
"build_name": "build 1"
179+
"build_name": "build 1",
180+
"npm_dependencies": {
181+
"npm-package-you-need-to-run-tests-1": "^1.2.1",
182+
"npm-package-you-need-to-run-tests-2": "^7.1.6-beta.13",
183+
}
166184
}
167185
}
168186
```
@@ -412,8 +430,8 @@ $ browserstack-cypress --disable-usage-reporting <your-commands>
412430
- While using local, please make sure to create `/etc/hosts` entry pointing to
413431
some URL, and use that URL in the tests. The `localhost` URI doesn't work at
414432
the moment. You can use `http://bs-local.com` instead, to replace `localhost`
415-
- Installing npm packages that your tests might require to run the tests are
416-
not supported at this moment.
433+
- Installing npm packages using `npm_dependencies` is not supported for tests
434+
running on macOS.
417435

418436
## License
419437

bin/helpers/archiver.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const archiveSpecs = (runSettings, filePath) => {
88
return new Promise(function (resolve, reject) {
99
var output = fs.createWriteStream(filePath);
1010

11-
var cypressFolderPath = runSettings.cypress_proj_dir
11+
var cypressFolderPath = runSettings.cypress_proj_dir;
1212

1313
var archive = archiver('zip', {
1414
zlib: { level: 9 } // Sets the compression level.
@@ -38,9 +38,14 @@ const archiveSpecs = (runSettings, filePath) => {
3838

3939
let allowedFileTypes = [ 'js', 'json', 'txt', 'ts' ];
4040
allowedFileTypes.forEach(fileType => {
41-
archive.glob(`**/*.${fileType}`, { cwd: cypressFolderPath, matchBase: true, ignore: 'node_modules/**' });
41+
archive.glob(`**/*.${fileType}`, { cwd: cypressFolderPath, matchBase: true, ignore: ['node_modules/**', 'package-lock.json', 'package.json', 'browserstack-package.json'] });
4242
});
4343

44+
if (typeof runSettings.npm_dependencies === 'object') {
45+
var packageJSON = JSON.stringify({devDependencies: runSettings.npm_dependencies}, null, 4);
46+
archive.append(packageJSON, { name: 'browserstack-package.json' });
47+
}
48+
4449
archive.finalize();
4550
});
4651
}

bin/templates/configTemplate.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ module.exports = function () {
1414
"run_settings": {
1515
"cypress_proj_dir" : "/path/to/cypress.json",
1616
"project_name": "project-name",
17-
"build_name": "build-name"
17+
"build_name": "build-name",
18+
"npm_dependencies": {
19+
}
1820
},
1921
"connection_settings": {
2022
"local": false,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "browserstack-cypress-cli",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)