Skip to content

A sample configuration showing how you can run your automated tests against BrowserStack using GitLab CI

Notifications You must be signed in to change notification settings

ddavison/gitlab-browserstack-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Running Selenium Tests against BrowserStack using GitLab CI

This project serves as a minimal example of how to run UI tests against BrowserStack through GitLab CI using the Selenium Ruby bindings.

There are essentially two pieces required to get GitLab CI working with BrowserStack.

  1. A .gitlab-ci.yml file
  2. BrowserStack Username / Access Key

How it works

In this example, spec/browserstack_spec.rb is the main piece and is an RSpec test file.

This file contains one essential piece to getting BrowserStack configured:

let(:capabilities) do
  {
    browser: :chrome,
    browser_version: '77.0',
   os: 'OS X',
   os_version: 'Mojave',
   project: 'gitlab-browserstack-example',
   build: ENV['CI_JOB_ID']
 }
end

Here we are configuring the Desired Capabilities for Selenium as well as BrowserStack.

You'll notice we are also specifying ENV['CI_JOB_ID']. This is a pre-defined GitLab CI environment variable and it is to differentiate each run by associating it with a GitLab Job.

Under the capabilities hash, we specify everything we'd like to configure BrowserStack with.

  • Username
  • Access Key
  • Tags / Name / Build for naming your build in BrowserStack

Our GitLab CI configuration file contains one stage called test, that runs when we run the job manually.

In an actual CI/CD environment, you'd most likely have when:manual removed, meaning that these tests will run against BrowserStack on every push / merge request to master.

About

A sample configuration showing how you can run your automated tests against BrowserStack using GitLab CI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages