Skip to content

Commit

Permalink
Merge pull request #2 from chandlerprall/visual-regression-tests-521
Browse files Browse the repository at this point in the history
Cleaned up the visual test code and some configs
  • Loading branch information
cuff-links authored Apr 26, 2018
2 parents 72a5ca5 + c96fb0b commit 6275004
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 143 deletions.
56 changes: 0 additions & 56 deletions scripts/run-visual-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,59 +42,3 @@ const checkoutOpts = {
function displayCurrentBranch(branch) {
return "Currently on " + branch.shorthand() + ": " + branch.target();
}

// stop script
return;


var initialBranch;

(function IIFE(){
const self = this;
const checkoutOpts = {
checkoutStrategy: git.Checkout.STRATEGY.SAFE
};
return git.Repository.open("./")
.then(function(repo) {
self.repo = repo;
return self.repo.getCurrentBranch()
.then(function (branch) {
initialBranch = branch.shorthand();
if (initialBranch === 'master') {
throw new Error("Must be on branch to test against master. Currently on master.")
}
console.log(displayCurrentBranch(branch));
})
.then(function (){
console.log('Switching to master');
return self.repo.checkoutBranch("master", checkoutOpts)
})
.then(function(){
return self.repo.getCurrentBranch()
.then(function (branch) {
console.log(displayCurrentBranch(branch));
execSync('yarn start-test-server-and-visual-test', { stdio: [0,1,2] } );
})
})
.then(function() {
console.log('Switching to ' + initialBranch);
return self.repo.checkoutBranch(initialBranch, checkoutOpts)
})
.then(self.repo.getCurrentBranch().then(function(branch) {
console.log(displayCurrentBranch(branch))
execSync('yarn start-test-server-and-visual-test', { stdio: [0,1,2] } )
}))
})
.catch(function(err){
console.log(err);
process.exit(1)
})
.done(function() {
console.log('Finished.')
});

function displayCurrentBranch(branch) {
return "Currently on " + branch.shorthand() + ": " + branch.target();
}
})();

2 changes: 2 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ previously.

### Running Tests Locally

Running Selenium locally requires installing the [Java SDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html).

To run the tests, run:

```bash
Expand Down
1 change: 1 addition & 0 deletions test/spec/components/card/card.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global browser expectImageToBeSame */
describe('Card Component', function () {

beforeEach(function () {
Expand Down
1 change: 1 addition & 0 deletions test/spec/components/table/table.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global browser expectImageToBeSame */
describe('Table Component', function () {

beforeEach(function () {
Expand Down
1 change: 1 addition & 0 deletions test/spec/components/toast/toast.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global browser expectImageToBeSame */
describe('Toast Component', function () {

beforeEach(function () {
Expand Down
12 changes: 4 additions & 8 deletions test/wdio.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/* global browser */
const ci = process.env.CI && process.env.CI === 'true';
const path = require('path');
const VisualRegressionCompare = require('wdio-visual-regression-service/compare');
Expand Down Expand Up @@ -61,7 +61,7 @@ exports.config = {
baseUrl: 'http://localhost:9999',
capabilities: [{
browserName: 'chrome',
version: ci ? '58' : '65',
version: ci ? '58' : null,
platform: 'macOS 10.12',
}, {
maxInstances: 2,
Expand All @@ -79,21 +79,17 @@ exports.config = {
capabilities[1].platform = 'macOS 10.12';
}
},
before: function (capabilities, specs) {
const sinon = require('sinon');
// http://sinonjs.org/
before: function () {
const chai = require('chai');
global.expect = chai.expect;
const chaiWebdriver = require('chai-webdriverio').default;
chai.use(chaiWebdriver(browser));
// http://chaijs.com/
global.fetch = require('node-fetch');

chai.config.includeStack = true;
global.AssertionError = chai.AssertionError;
global.Assertion = chai.Assertion;
global.assert = chai.assert;
chai.Should();
chai.Should(); // eslint-disable-line new-cap

global.expectImageToBeSame = function expectImageToBeSame(results) {
results.forEach((result, idx) => expect(result.isWithinMisMatchTolerance,
Expand Down
96 changes: 17 additions & 79 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2590,11 +2590,11 @@ detect-port@1.2.2:
address "^1.0.1"
debug "^2.6.0"

diff@3.5.0:
diff@3.5.0, diff@^3.1.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"

diff@^3.1.0, diff@^3.2.0, diff@^3.3.1:
diff@^3.2.0, diff@^3.3.1:
version "3.4.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c"

Expand Down Expand Up @@ -2938,10 +2938,6 @@ es6-promise@^3.0.2:
version "3.3.1"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613"

es6-promise@^4.0.3:
version "4.2.4"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29"

es6-set@~0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1"
Expand Down Expand Up @@ -3719,12 +3715,6 @@ form-data@~2.3.1:
combined-stream "^1.0.5"
mime-types "^2.1.12"

formatio@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/formatio/-/formatio-1.2.0.tgz#f3b2167d9068c4698a8d51f4f760a39a54d818eb"
dependencies:
samsam "1.x"

forwarded@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
Expand Down Expand Up @@ -3761,14 +3751,6 @@ fs-extra@^0.30.0:
path-is-absolute "^1.0.0"
rimraf "^2.2.8"

fs-extra@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^2.1.0"
klaw "^1.0.0"

fs-extra@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291"
Expand Down Expand Up @@ -4284,13 +4266,6 @@ hash.js@^1.0.0, hash.js@^1.0.3:
inherits "^2.0.3"
minimalistic-assert "^1.0.0"

hasha@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/hasha/-/hasha-2.2.0.tgz#78d7cbfc1e6d66303fe79837365984517b2f6ee1"
dependencies:
is-stream "^1.0.1"
pinkie-promise "^2.0.0"

hawk@3.1.3, hawk@~3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4"
Expand Down Expand Up @@ -5627,7 +5602,7 @@ jsx-ast-utils@^2.0.0:
dependencies:
array-includes "^3.0.3"

just-extend@^1.1.26:
just-extend@^1.1.27:
version "1.1.27"
resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-1.1.27.tgz#ec6e79410ff914e472652abfa0e603c03d60e905"

Expand Down Expand Up @@ -5951,13 +5926,9 @@ loglevel@^1.4.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa"

lolex@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/lolex/-/lolex-1.6.0.tgz#3a9a0283452a47d7439e72731b9e07d7386e49f6"

lolex@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.3.1.tgz#3d2319894471ea0950ef64692ead2a5318cff362"
lolex@^2.2.0, lolex@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.3.2.tgz#85f9450425103bf9e7a60668ea25dc43274ca807"

longest@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -6424,12 +6395,12 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"

nise@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/nise/-/nise-1.2.0.tgz#079d6cadbbcb12ba30e38f1c999f36ad4d6baa53"
version "1.3.3"
resolved "https://registry.yarnpkg.com/nise/-/nise-1.3.3.tgz#c17a850066a8a1dfeb37f921da02441afc4a82ba"
dependencies:
formatio "^1.2.0"
just-extend "^1.1.26"
lolex "^1.6.0"
"@sinonjs/formatio" "^2.0.0"
just-extend "^1.1.27"
lolex "^2.3.2"
path-to-regexp "^1.7.0"
text-encoding "^0.6.4"

Expand Down Expand Up @@ -7259,20 +7230,6 @@ performance-now@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"

phantomjs-prebuilt@^2.1.16:
version "2.1.16"
resolved "https://registry.yarnpkg.com/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz#efd212a4a3966d3647684ea8ba788549be2aefef"
dependencies:
es6-promise "^4.0.3"
extract-zip "^1.6.5"
fs-extra "^1.0.0"
hasha "^2.2.0"
kew "^0.7.0"
progress "^1.1.8"
request "^2.81.0"
request-progress "^2.0.1"
which "^1.2.10"

pify@^2.0.0, pify@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
Expand Down Expand Up @@ -7734,10 +7691,6 @@ progress@2.0.0, progress@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f"

progress@^1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be"

promise@^7.1.1:
version "7.3.1"
resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf"
Expand Down Expand Up @@ -8350,12 +8303,6 @@ replace-ext@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"

request-progress@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/request-progress/-/request-progress-2.0.1.tgz#5d36bb57961c673aa5b788dbc8141fdf23b44e08"
dependencies:
throttleit "^1.0.0"

request-promise-core@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.1.tgz#3eee00b2c5aa83239cfb04c5700da36f81cd08b6"
Expand Down Expand Up @@ -8626,7 +8573,7 @@ safe-buffer@5.1.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, s
version "5.1.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"

samsam@1.3.0, samsam@1.x:
samsam@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.3.0.tgz#8d1d9350e25622da30de3e44ba692b5221ab7c50"

Expand Down Expand Up @@ -8968,8 +8915,8 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"

sinon@^4.4.8:
version "4.4.8"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-4.4.8.tgz#0479e0ccb8caa0d737ce9773c8d53d57d38f2d84"
version "4.5.0"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-4.5.0.tgz#427ae312a337d3c516804ce2754e8c0d5028cb04"
dependencies:
"@sinonjs/formatio" "^2.0.0"
diff "^3.1.0"
Expand Down Expand Up @@ -9574,10 +9521,6 @@ throat@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a"

throttleit@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c"

through2@^2.0.0, through2@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
Expand Down Expand Up @@ -9743,14 +9686,10 @@ type-check@~0.3.2:
dependencies:
prelude-ls "~1.1.2"

type-detect@^4.0.0:
type-detect@^4.0.0, type-detect@^4.0.5:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"

type-detect@^4.0.5:
version "4.0.7"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.7.tgz#862bd2cf6058ad92799ff5a5b8cf7b6cec726198"

type-is@~1.6.15:
version "1.6.15"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.15.tgz#cab10fb4909e441c82842eafe1ad646c81804410"
Expand Down Expand Up @@ -10189,17 +10128,16 @@ wdio-sync@0.7.1:
fibers "~2.0.0"
object.assign "^4.0.3"

wdio-visual-regression-service@silne30/wdio-visual-regression-service#Add_Filename_To_Result:
wdio-visual-regression-service@^0.9.0:
version "0.9.0"
resolved "https://codeload.github.com/silne30/wdio-visual-regression-service/tar.gz/0a9e560eba80bed1e9a0bd44eadfcf6dd9cef915"
resolved "https://registry.yarnpkg.com/wdio-visual-regression-service/-/wdio-visual-regression-service-0.9.0.tgz#caca5507010f02a20a0b83d321f289e3ad565e5e"
dependencies:
babel-runtime "^6.9.0"
debug "^2.2.0"
fs-extra "^3.0.1"
lodash "^4.13.1"
node-resemble-js "0.0.5"
nodeclient-spectre "^1.0.3"
phantomjs-prebuilt "^2.1.16"
platform "^1.3.1"
wdio-screenshot "^0.6.0"

Expand Down

0 comments on commit 6275004

Please sign in to comment.