Arquivo da categoria: Testes Ágeis

AngularJS – e2e Testing AngularJS Apps with Protractor and SauceLabs

sauce.conf.js

var browsers = require('./browsers'),
    creds = require('./creds');

var config = {
    specs: [
        './e2e/**/*.spec.js'
    ],

    baseUrl: 'http://localhost:3333',
    allScriptsTimeout: 30000,
    getPageTimeout: 30000,
    jasmineNodeOpts: {
        showColors: true,
        isVerbose: true,
        includeStackTrace: true,
        defaultTimeoutInterval: 300000
    }
};

config.baseUrl = 'http://benclinkinbeard.com/demos/ptor';
config.sauceUser = process.env.SAUCE_USERNAME || creds.sauceUser;
config.sauceKey = process.env.SAUCE_ACCESS_KEY || creds.sauceKey;

config.multiCapabilities = [
    browsers.chrome,
    browsers.firefox,
    browsers.ie9,
    browsers.ie10,
    browsers.ie11,
    browsers.ios
];

exports.config = config;

browsers.js

exports.chrome = {
    name: 'Chrome',
    browserName: 'chrome'
}

exports.firefox = {
    name: 'Firefox',
    browserName: 'firefox'
}

exports.safari = {
    name: 'Safari',
    browserName: 'safari'
}

exports.ie8 = {
    name: 'IE 8',
    browserName: 'internet explorer',
    version: '8.0',
    tags: ['ie']
}

exports.ie9 = {
    name: 'IE 9',
    browserName: 'internet explorer',
    version: '9.0',
    tags: ['ie']
}

exports.ie10 = {
    name: 'IE 10',
    browserName: 'internet explorer',
    version: '10.0',
    tags: ['ie']
}

exports.ie11 = {
    name: 'IE 11',
    browserName: 'internet explorer',
    version: '11.0',
    tags: ['ie']
}

// iOS for local or Sauce Labs (via Appium)
exports.ios = {
    name: 'iOS 7 - iPad',
    platformName: 'iOS',
    platformVersion: '7.1',
    deviceName: 'iPad Simulator',
    browserName: 'safari',
    orientation: 'landscape',
    'appium-version': '1.2',
    tags: ['ios']
}

AngularJS – Using Protractor to Test Mobile Safari with Appium

package.json

{
  "name": "multiCapabilities",
  "version": "0.0.0",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "test-e2e": "protractor test/protractor.conf.js",
    "test-e2e-dev": "protractor test/protractor.conf.js --chrome",
    "test-e2e-ios": "protractor test/protractor.conf.js --ios"
  },
  "devDependencies": {
    "appium": "^1.2.0",
    "protractor": "^1.0.0"
  }
}

protractor.conf.js

var browsers = {
  firefox: {
    name: 'Firefox',
    browserName: 'firefox'
  },
  chrome: {
    name: 'Chrome',
    browserName: 'chrome'
  },
  ios: {
    name: 'iOS 7 - iPad',
    platformName: 'iOS',
    platformVersion: '7.1',
    deviceName: 'iPad Simulator',
    browserName: 'Safari',
    orientation: 'landscape'
  }
}

var config = {
  specs: [
    './e2e/**/*.spec.js'
  ],

  baseUrl: 'http://localhost:3333'
};

if (process.argv[3] === '--chrome') {
  config.capabilities = browsers.chrome;
} else if (process.argv[3] === '--ios') {
  config.seleniumAddress = 'http://localhost:4723/wd/hub';
  config.capabilities = browsers.ios;
} else {
  config.multiCapabilities = [
    browsers.firefox,
    browsers.chrome
  ]
}

exports.config = config;