protractor.conf.js 2.5 KB
Newer Older
B
bryk 已提交
1
// Copyright 2015 Google Inc. All Rights Reserved.
2 3 4 5 6
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
B
bryk 已提交
7
//     http://www.apache.org/licenses/LICENSE-2.0
8 9 10 11 12 13 14 15 16 17
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview Configuration file for Protractor test runner.
 *
18
 * TODO(bryk): Start using ES6 modules in this file when supported.
19
 */
20 21
/* eslint strict: [0] */
'use strict';
22
require('babel-core/register');
23 24
const conf = require('./conf').default;
const path = require('path');
25 26 27

/**
 * Schema can be found here: https://github.com/angular/protractor/blob/master/docs/referenceConf.js
28
 * @return {!Object}
29
 */
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
function createConfig() {
  const config = {
    baseUrl: `http://localhost:${conf.frontend.serverPort}`,

    framework: 'jasmine',

    specs: [path.join(conf.paths.integrationTest, '**/*.js')],
  };

  if (conf.test.useSauceLabs) {
    let name = `Integration tests ${process.env.TRAVIS_REPO_SLUG}, build ` +
        `${process.env.TRAVIS_BUILD_NUMBER}`;
    if (process.env.TRAVIS_PULL_REQUEST !== 'false') {
      name += `, PR: https://github.com/${process.env.TRAVIS_REPO_SLUG}/pull/` +
          `${process.env.TRAVIS_PULL_REQUEST}`;
    }
46

47 48 49 50 51 52 53 54 55 56 57 58 59
    config.sauceUser = process.env.SAUCE_USERNAME;
    config.sauceKey = process.env.SAUCE_ACCESS_KEY;
    config.multiCapabilities = [
      {
        'browserName': 'chrome',
        'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
        'name': name,
      },
      {
        'browserName': 'firefox',
        'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
        'name': name,
      },
60 61 62 63 64 65
      // {
      //    TODO: disable for now until IE compatibility issues are fixed
      //    'browserName': 'internet explorer',
      //    'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
      //    'name': name,
      // },
66
    ];
67

68 69 70
    // Limit concurrency to not exhaust saucelabs resources for the CI user.
    config.maxSessions = 1;

71
  } else {
72
    config.capabilities = {'browserName': 'chrome'};
73
  }
74

75 76 77 78 79 80 81
  return config;
}

/**
 * Exported protractor config required by the framework.
 */
exports.config = createConfig();