Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into issue-1207
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-SteveBrush authored Oct 16, 2017
2 parents c25965b + 330d224 commit 81d6991
Show file tree
Hide file tree
Showing 24 changed files with 249 additions and 446 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
"@types/webpack": "2.2.15",
"angular2-template-loader": "0.6.2",
"awesome-typescript-loader": "3.1.3",
"axe-core": "1.1.1",
"base64-image-loader": "1.2.0",
"codelyzer": "3.0.1",
"core-js": "2.4.1",
Expand Down
59 changes: 21 additions & 38 deletions skyux-spa-visual-tests/config/ci.visual.conf.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
/*jshint jasmine: true, node: true */
/* global browser */
'use strict';

let builderUtils = require('@blackbaud/skyux-builder/utils/host-utils');

const browserstack = require('browserstack-local');
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;

var config = require('./shared.visual.conf.js');

var browserstack = require('browserstack-local');
const PixDiff = require('pix-diff');
const config = require('./shared.visual.conf.js');
const { getVisualTestConfig } = require('./utils/visual-test-config');

require('./utils/fast-selenium.js');

config.seleniumAddress = 'http://hub-cloud.browserstack.com/wd/hub';

config.onPrepare = function () {
jasmine.getEnv().addReporter(new SpecReporter());
const PixDiff = require('pix-diff');
browser.pixDiff = new PixDiff(
{
basePath: 'screenshots-baseline/',
diffPath: 'screenshots-diff/',
baseline: true,
width: 1000,
height: 800
}
);

browser.skyVisualTestOptions = {
createdPath: 'screenshots-created/',
createdPathDiff: 'screenshots-created-diff/'
};

var destination = builderUtils.resolve(
'/',
browser.params.localUrl,
JSON.parse(browser.params.chunks),
JSON.parse(browser.params.skyPagesConfig)
);

return browser.get(destination);
browser.params.chunks = JSON.parse(browser.params.chunks);
browser.params.skyPagesConfig = JSON.parse(browser.params.skyPagesConfig);
browser.skyVisualTestConfig = getVisualTestConfig();
browser.pixDiff = new PixDiff(browser.skyVisualTestConfig);
};

config.capabilities = {
config.capabilities = {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--disable-extensions --ignore-certificate-errors']
'args': [
'--disable-extensions',
'--ignore-certificate-errors'
]
},
'browserstack.user': process.env.BROWSER_STACK_USERNAME,
'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
Expand All @@ -56,19 +39,19 @@ config.capabilities = {
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 3e5,
captureTimeout: 3e5,
build: 'skyux2-mac-chrome-webdriver-' + process.env.TRAVIS_BUILD_NUMBER,
build: `skyux2-mac-chrome-webdriver-${process.env.TRAVIS_BUILD_NUMBER}`,
resolution: '1280x960',
name: 'SKYUX2BROWSERSTACKCI',
'browserstack.localIdentifier': 'SKYUX2BROWSERSTACKCI',
'acceptSslCerts': true
};

config.seleniumAddress = 'http://hub-cloud.browserstack.com/wd/hub';

config.beforeLaunch = function () {
console.log('Connecting local...');

require('ts-node').register({ ignore: false });
console.log('Connecting local');
return new Promise(function (resolve, reject){

return new Promise((resolve, reject) => {
exports.bs_local = new browserstack.Local();
exports.bs_local.start(
{
Expand All @@ -90,7 +73,7 @@ config.beforeLaunch = function () {

// Code to stop browserstack local after end of test
config.afterLaunch = function () {
return new Promise(function (resolve) {
return new Promise((resolve) => {
exports.bs_local.stop(resolve);
});
};
Expand Down
61 changes: 15 additions & 46 deletions skyux-spa-visual-tests/config/local-browserstack.visual.conf.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,21 @@
/*jshint jasmine: true, node: true */
/* global browser */
'use strict';

let builderUtils = require('@blackbaud/skyux-builder/utils/host-utils');

const SpecReporter = require('jasmine-spec-reporter').SpecReporter;

var config = require('./shared.visual.conf.js');

var browserstack = require('browserstack-local');
const browserstack = require('browserstack-local');
const config = require('./shared.visual.conf.js');
const timestamp = new Date().toString();

require('./utils/fast-selenium.js');

var timestamp = new Date().toString();

config.onPrepare = function () {
jasmine.getEnv().addReporter(new SpecReporter());
const PixDiff = require('pix-diff');
browser.pixDiff = new PixDiff(
{
basePath: 'screenshots-baseline-local/',
diffPath: 'screenshots-diff-local/',
baseline: true,
width: 1000,
height: 600
}
);

browser.skyVisualTestOptions = {
createdPath: 'screenshots-created-local/',
createdPathDiff: 'screenshots-created-diff-local/'
};

var destination = builderUtils.resolve(
'/',
browser.params.localUrl,
JSON.parse(browser.params.chunks),
JSON.parse(browser.params.skyPagesConfig)
);

return browser.get(destination);

};
config.seleniumAddress = 'http://hub-cloud.browserstack.com/wd/hub';

config.capabilities = {
config.capabilities = {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--disable-extensions --ignore-certificate-errors']
'args': [
'--disable-extensions',
'--ignore-certificate-errors'
]
},
'browserstack.user': process.env.BROWSER_STACK_USERNAME,
'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
Expand All @@ -59,19 +28,19 @@ config.capabilities = {
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 3e5,
captureTimeout: 3e5,
build: 'skyux2-mac-chrome-webdriver-local-' + timestamp,
build: `skyux2-mac-chrome-webdriver-local-${timestamp}`,
resolution: '1280x960',
name: 'SKYUX2BROWSERSTACKLOCAL',
'browserstack.localIdentifier': 'SKYUX2BROWSERSTACKLOCAL',
'acceptSslCerts': true,
'browserstack.video': 'false'
};

config.seleniumAddress = 'http://hub-cloud.browserstack.com/wd/hub';

config.beforeLaunch = function () {
require('ts-node').register({ ignore: false });
console.log('Connecting local');

console.log('Connecting local...');

return new Promise(function (resolve, reject) {
exports.bs_local = new browserstack.Local();
exports.bs_local.start(
Expand All @@ -86,15 +55,15 @@ config.beforeLaunch = function () {
return reject(error);
}

console.log('Connected. Now testing...');
console.log('Connected. Running tests...');
resolve();
});
});
};

// Code to stop browserstack local after end of test
config.afterLaunch = function () {
return new Promise(function (resolve) {
return new Promise((resolve) => {
exports.bs_local.stop(resolve);
});
};
Expand Down
43 changes: 6 additions & 37 deletions skyux-spa-visual-tests/config/local.visual.conf.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,18 @@
/*jshint jasmine: true, node: true */
/* global browser */
'use strict';

let builderUtils = require('@blackbaud/skyux-builder/utils/host-utils');
const config = require('./shared.visual.conf.js');

const SpecReporter = require('jasmine-spec-reporter').SpecReporter;

var config = require('./shared.visual.conf.js');
config.onPrepare = function () {
jasmine.getEnv().addReporter(new SpecReporter());
const PixDiff = require('pix-diff');
browser.pixDiff = new PixDiff(
{
basePath: 'screenshots-baseline-local/',
diffPath: 'screenshots-diff-local/',
baseline: true,
width: 1000,
height: 800
}
);

browser.skyVisualTestOptions = {
createdPath: 'screenshots-created-local/',
createdPathDiff: 'screenshots-created-diff-local/'
};

var destination = builderUtils.resolve(
'/',
browser.params.localUrl,
JSON.parse(browser.params.chunks),
JSON.parse(browser.params.skyPagesConfig)
);

return browser.get(destination);

};

config.capabilities = {
config.capabilities = {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--ignore-certificate-errors']
'args': [
'--disable-extensions',
'--ignore-certificate-errors'
]
}
};

config.directConnect = true;

exports.config = config;

14 changes: 12 additions & 2 deletions skyux-spa-visual-tests/config/shared.visual.conf.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
/*jshint jasmine: true, node: true */
'use strict';

const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
const PixDiff = require('pix-diff');
const { getVisualTestConfig } = require('./utils/visual-test-config');

module.exports = {
useAllAngular2AppRoots: true,
onPrepare: function () {
jasmine.getEnv().addReporter(new SpecReporter());

browser.params.chunks = JSON.parse(browser.params.chunks);
browser.params.skyPagesConfig = JSON.parse(browser.params.skyPagesConfig);
browser.skyVisualTestConfig = getVisualTestConfig('local');
browser.pixDiff = new PixDiff(browser.skyVisualTestConfig);
},
beforeLaunch: function () {
require('ts-node').register({ ignore: false });
},

jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 90000
Expand Down
25 changes: 12 additions & 13 deletions skyux-spa-visual-tests/config/utils/fast-selenium.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,37 @@
'use strict';

/* Taken from browserstack selenium test tips at https://www.browserstack.com/automate/node */
var http = require('http');
var https = require('https');
const http = require('http');
const https = require('https');

var keepAliveTimeout = 30 * 1000;
const keepAliveTimeout = 30 * 1000;

if (http.globalAgent && http.globalAgent.hasOwnProperty('keepAlive')) {
http.globalAgent.keepAlive = true;
https.globalAgent.keepAlive = true;
http.globalAgent.keepAliveMsecs = keepAliveTimeout;
https.globalAgent.keepAliveMsecs = keepAliveTimeout;
} else {
var agent = new http.Agent({
const agent = new http.Agent({
keepAlive: true,
keepAliveMsecs: keepAliveTimeout
});

var secureAgent = new https.Agent({
const secureAgent = new https.Agent({
keepAlive: true,
keepAliveMsecs: keepAliveTimeout
});

var httpRequest = http.request;
var httpsRequest = https.request;
const httpRequest = http.request;
const httpsRequest = https.request;

http.request = function (options, callback) {
if (options.protocol === 'https:') {
http.request = (options, callback) => {
if (options.protocol === 'https:') {
options.agent = secureAgent;
return httpsRequest(options, callback);
}
else {
} else {
options.agent = agent;
return httpRequest(options, callback);
}

return httpRequest(options, callback);
};
}
4 changes: 3 additions & 1 deletion skyux-spa-visual-tests/config/utils/start-visual.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,19 @@ function killServers(exitCode) {
* @name spawnProtractor
*/
function spawnProtractor(chunks, port, skyPagesConfig) {

logger.info('Running Protractor');

const protractorPath = path.resolve(
'node_modules',
'.bin',
'protractor'
);

const protractor = spawn.spawn(
protractorPath,
[
getProtractorConfigPath(),
'--disableChecks',
`--baseUrl ${skyPagesConfig.skyux.host.url}`,
`--params.localUrl=https://localhost:${port}`,
`--params.chunks=${JSON.stringify(chunks)}`,
Expand Down
Loading

0 comments on commit 81d6991

Please sign in to comment.