CrossBrowserTesting Support

Support

  • Product
    • Live Testing
    • Automated Testing
    • Record & Replay
    • Visual Testing
  • API Docs
  • Blog
  • Live Q&A
  • Start Testing
CrossBrowserTesting Support » Selenium Testing » Karma

Karma

You can check out the repository used in this documentation here: Karma Repo

Run your Karma tests on CrossBrowserTesting's platform.

A large portion of this code was originally taken and modified from Actano/Marcus Mennemeier's karma-cbt-launcher. The original code can be found here.

Install:

npm install karma-cbt-launcher --save-dev

Usage:

Setup your tests in Karma as you normally would and modify your config file with the customLaunchers and cbtConfig values. See the example directory for a sample test and karma config file.

karma.conf.js

module.exports = (config) => {
  config.set({
    singleRun: true,
    frameworks: ['jasmine'],
    plugins: [
      'karma-*',
      'karma-cbt-launcher'
    ],
    preprocessors: {
      'tests/*.html': ['html2js']
    },
    files: [
      'tests/*.js',
      'tests/index.html'
    ],
    logLevel: config.LOG_DEBUG,
    browsers: [
      'win7_ie11',
      'win10_edge20',
    ],
    reporters: [
      'progress',
      'CrossBrowserTesting',
    ],
    cbtConfig: {
      username: 'CBT_USERNAME',
      authkey: 'CBT_AUTHKEY',
    },
    customLaunchers: {
      win7_ie11: {
        base: 'CrossBrowserTesting',
        browserName: 'win7_ie11',
        browser_api_name: 'IE11',
        os_api_name: 'Win7x64',
        screen_resolution: '1366x768',
      },
      win10_edge20: {
        base: 'CrossBrowserTesting',
        browserName: 'win10_edge20',
        browser_api_name: 'Edge20',
        os_api_name: 'Win10',
        screen_resolution: '1920x1080',
      },
    },
  })
}

You can also specify the username and authkey using environment variables: CBT_USERNAME and CBT_AUTHKEY

Reporter:

A custom reporter 'CrossBrowserTesting' is also included that will mark a test as pass if all tests return success. If a single test returns failed, the entire suite for that device will be marked failed on the CBT results page. The results message will also be set with the number of tests passed and the number that failed.

Related

Selenium Starting Guides

  • Python
  • Java
  • JavaScript
  • PHP
  • Ruby
  • C#
  • Selenium 101

More Help

  • Parallel Testing
  • Jenkins Integration
  • TeamCity Integration
  • Automation Capabilities
  • Local Testing

See Our GitHub Examples


 



Think you need a human?

Our customer success team will be glad to help you with your question.

Contact Support

Still need a free trial?

Try CrossBrowserTesting free for 7 days and see how we make testing easier.

Start Today

Want the latest tips?

Enter your email and we’ll send you tutorials and browser testing strategies right to your inbox.


Product

  • Live Testing
  • Automated Testing
  • Visual Testing
  • Local Testing
  • Integrations

Resources

  • Browsers & Devices
  • Blog
  • Webinars
  • Security
  • ROI Calculator

Support

  • Help Center
  • API Docs
  • Automation Docs
  • Schedule A Demo
  • Enterprise Request

Company

    • About Us
    • Contact Us
    • Careers
    • Terms of Use
    • 1-888-927-6973

© 2008–2016 CrossBrowserTesting.com, LLC. All rights reserved.