BrowserStack automate.
npm install robrowserRobrowser is a bot to help you test your project in many different browsers and operating systems.
The currently supported tests are:
The next hubs we intend to support are:
If you want some other hub just create an issue!
Using yarn or npm
``sh`
yarn add robrowser --dev
Add in your package.json
Run it
`sh`
"scripts": {
"robrowser": "robrowser start"
}
Now just run the command
``
yarn robrowser
Remember, to run you need to configure the robrowser.config.js or .robrowser file at the root of the project.
`sh`
npm i -g robrowseror
yarn global add robrowser
If you have npm@>5.2.0 installed you can use npx to execute commands without needing to install a global package if you don't want to.
To do so just run
`sh`
npx robrowser
Robrowser will look for a robrowser.config.js or .robrowser config file in the folder you're executing it to check for your credentials (currently we just support Browser Stack).
Some of robrowser.config.js or .robrowser configuration parameters.
| Attribute | Type | Description |
| ---- | ---- | ---- |
| remote | object | Configure the connection and access credentials.screenshot
| | object | Configuration related to screenshot.browsers
| | array | List counting the tests that will be performed, let's call it browser.concurrency
| | number | Number of tests running in parallel.
the currency parameter is very important, the hubs have a limited number of parallel tests, if you work as a team this will help you to run your tests without problems.
| Attribute | Type | Description |
| ---- | ---- | ---- |
| host | string | Host dos testes, ex: hub.browserstack.com.port
| | number | Port you want to use for tests, defaut is 80.user
| | string | See credentialspwd
| | string | If you are using a hub, here is your password.
| Attribute | Type | Description |
| ---- | ---- | ---- |
| folder | string | Define the directory where the screenshots will be saved. Default is ./screenshots
> Each browser represents a test, for each test you can set capabilities of each respective browser you want to test.
| Attribute | Type | Description |
| ---- | ---- | ---- |
| os | string | OS you want to test.os_version
| | string | OS version you want to test.browserName
| | string | Browser you want to test.browser_version
| | string | Browser version you want to test.resolution
| | string | Set the resolution of VM before beginning of your test.url
| | string | Url of the page you want to test.test
| | string | Path of test.local
| | boolean | Access a url from your local network.
Check our robrowser.config.js or .robrowser to see all available keys.
Test are nothing more than functions that will receive a browser to run and a callback for the next test, example test file.
For more commands just look at this documentation.
With the config file having tests to be executed, Robrowser will run them for you and create a ./screenshot folder with the results, this way you will be able to see if your frontend projects are rendering as expected.
Here is how you get your credentials to use in our config file.
Don't forget not to commit them!
To get your BrowserStack credentials:
- Log in
- Go to https://www.browserstack.com/automate
- On the left side of the screen click Username and Access Keys
- Paste your Username in the remote.user keyremote.pwd
- Paste your Access Key in the key
We use ava to run tests under the ./tests/ folder, you can execute it with:
`sh`
yarn testor
npm test
Our lint file extends Pagar.me's JavaScript Style Guide and you can execute it with:
`sh``
yarn lintor
npm run lint
Check our Contributing and Code of conduct files so you can join us in this awesome project!
_Spoiler alert_: We LOVE contributions, open Pull Requests and Issues and we will be eternally grateful for you!
This project is licensed under MIT License