robrowser
v0.2.0
Published
BrowserStack automate.
Downloads
14
Maintainers
Keywords
Readme
Robrowser |
Automate your browser testing now! 🤖
Robrowser is a bot to help you test your project in many different browsers and operating systems.
Support
The currently supported tests are:
The next hubs we intend to support are:
If you want some other hub just create an issue!
Usage
Local usage
Using yarn
or npm
yarn add robrowser --dev
Add in your package.json
Run it
"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.
Global installation
npm i -g robrowser
# or
yarn global add robrowser
One-time usage with npx
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
npx robrowser
Configuration
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.
The remote
attribute.
| 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 credentials
| pwd
| string | If you are using a hub, here is your password.
The screenshot
attribute.
| Attribute | Type | Description |
| ---- | ---- | ---- |
| folder
| string | Define the directory where the screenshots will be saved. Default is ./screenshots
The browser
parameter
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.
What is a test?
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.
Credentials
Here is how you get your credentials to use in our config file.
Don't forget not to commit them!
BrowserStack
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
key - Paste your Access Key in the
remote.pwd
key
Testing and linting
We use ava to run tests under the ./tests/
folder, you can execute it with:
yarn test
# or
npm test
Our lint file extends Pagar.me's JavaScript Style Guide and you can execute it with:
yarn lint
# or
npm run lint
Contributing
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!
License
This project is licensed under MIT License