|
1 | 1 | # BrowserStack GitHub Actions
|
2 | 2 |
|
3 |
| -This respository contains the GitHub Actions to help you integrate your test suite with BrowserStack cloud. |
| 3 | +This respository contains a library of GitHub Actions to help you integrate your test suite with the [BrowserStack](https://browserstack.com) device cloud. |
| 4 | + |
| 5 | +You need a BrowserStack username and access-key to run your tests on the BrowserStack device cloud. You can [sign-up for free trial](https://www.browserstack.com/users/sign_up) if you do not have an existing account. |
| 6 | +If you want to test your open source project on BrowserStack then [sign-up here](https://www.browserstack.com/open-source) for lifetime free access to all our products. |
4 | 7 |
|
5 | 8 | ## Available Actions
|
6 |
| -* [setup-env](./setup-env): This action helps in setting up of environment variables to be used in your test scripts for BrowserStack. The environment variables set up here shall be used by other BrowserStack actions as well for their functioning. |
| 9 | +* [setup-env](./setup-env): This Action helps in setting up the required environment variables that are to be used in your test scripts. The environment variables set up here shall be used by other BrowserStack actions as well for their functioning. |
7 | 10 |
|
8 |
| -* [setup-local](./setup-local): This actions sets up local binary for creating local tunnel connections from runner environment to BrowserStack cloud. |
| 11 | +* [setup-local](./setup-local): This Action downloads and starts the appropriate BrowserStackLocal binary, thereby creating a secure tunnel connection from the GitHub Actions runner environment to the BrowserStack device cloud. This secure tunnel will be used by the remote browsers in BrowserStack to access your web application hosted in the GitHub Actions runner environment. **You do not need this Action if the application to be tested is accessible over the public internet.** |
| 12 | + |
| 13 | +## Pre-requisites |
| 14 | +* You should set your BrowserStack Username and Access Key as GitHub Secrets, i.e. `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` respectively. |
| 15 | + |
| 16 | +## Usage |
| 17 | +As this is a library of Actions, invoking this Action will trigger the `setup-env` Action internally. The following usage example will **only** set up the required environment variables: |
| 18 | + |
| 19 | +```yaml |
| 20 | +- name: BrowserStack Action |
| 21 | + uses: 'browserstack/github-actions@master' |
| 22 | + with: |
| 23 | + username: ${{ secrets.BROWSERSTACK_USERNAME }} |
| 24 | + access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} |
| 25 | + build-name: BUILD_INFO |
| 26 | + project-name: REPO_NAME |
| 27 | +``` |
| 28 | +We recommend you to invoke individual Actions from this library separately. A sample of two Actions being invoked back to back is shown below. You can additionally refer to the individual `README` ([setup-env](./setup-env), [setup-local](./setup-local)) of the Actions to know more about how they work, the inputs they support and their usage examples. |
| 29 | + |
| 30 | +## Sample Workflow with usage of both Actions |
| 31 | +The workflow example below would be useful when the web application to be tested is hosted on the GitHub Actions runner environment, i.e. not accessible from the public Internet. |
| 32 | + |
| 33 | +```yaml |
| 34 | +name: 'BrowserStack Test' |
| 35 | +on: [push, pull_request] |
| 36 | +
|
| 37 | +jobs: |
| 38 | + ubuntu-job: |
| 39 | + name: 'BrowserStack Test on Ubuntu' |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - name: 'BrowserStack Env Setup' |
| 43 | + uses: 'browserstack/github-actions/setup-env@master' |
| 44 | + with: |
| 45 | + username: ${{ secrets.BROWSERSTACK_USERNAME }} |
| 46 | + access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} |
| 47 | + build-name: BUILD_INFO |
| 48 | + project-name: REPO_NAME |
| 49 | + - name: 'BrowserStackLocal Setup' |
| 50 | + uses: 'browserstack/github-actions/setup-local@master' |
| 51 | + with: |
| 52 | + local-testing: start |
| 53 | + local-identifier: random |
| 54 | +``` |
| 55 | +Post these setup steps where both the Actions have been used, you have to build and run your application web server on the same machine, in daemon mode and thereafter invoke your test scripts. Your test scripts should use the environment variables that have been set by [`setup-env` Action](./setup-env). For more detailed steps on how to integrate your test suite with BrowserStack on GitHub Actions, visit [BrowserStack Documentation](http://browserstack.com/docs/automate/selenium/github-actions) for the same. |
9 | 56 |
|
| 57 | +After you are done running your tests, invoke the `setup-local` Action again with `local-testing: stop` as an input: |
| 58 | +```yaml |
| 59 | + - name: 'BrowserStackLocal Stop' |
| 60 | + uses: 'browserstack/github-actions/setup-local@master' |
| 61 | + with: |
| 62 | + local-testing: stop |
| 63 | +``` |
10 | 64 | ## Feature requests and bug reports
|
11 |
| -Please file feature requests and bug reports as [github issues](https://github.com/browserstack/github-actions/issues). |
| 65 | +Please file feature requests and bug reports as [github issues](https://github.com/browserstack/github-actions/issues). |
0 commit comments