This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pkg): refactor all of the things to support backstop latest, web…
…pack latest
- Loading branch information
Showing
19 changed files
with
212 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ backstop_data/* | |
!backstop_data/casper_scripts | ||
*.iml | ||
*.idea | ||
cache.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,48 @@ | ||
{ | ||
"id": "prod_test", | ||
"id": "octagon", | ||
"viewports": [ | ||
{ | ||
"name": "tablet_h", | ||
"label": "tablet", | ||
"width": 1024, | ||
"height": 768 | ||
} | ||
], | ||
"debug": true, | ||
"onBeforeScript": "chromy/onBefore.js", | ||
"onReadyScript": "chromy/onReady.js", | ||
"scenarios": [ | ||
{ | ||
"label": "Octagon", | ||
"cookiePath": "backstop_data/engine_scripts/cookies.json", | ||
"url": "http://localhost:3333", | ||
"hideSelectors": [], | ||
"referenceUrl": "", | ||
"readyEvent": "", | ||
"readySelector": "", | ||
"delay": 2000, | ||
"hideSelectors": [ | ||
".hide-in-test" | ||
], | ||
"removeSelectors": [], | ||
"selectorExpansion": true, | ||
"hoverSelector": "", | ||
"clickSelector": "", | ||
"postInteractionWait": "", | ||
"selectors": [ | ||
"[data-reactroot]:not(.hasSidebar-0-5)" | ||
"[data-reactroot]:not(.hasSidebar-0-2)" | ||
], | ||
"readyEvent": null, | ||
"delay": 5000, | ||
"selectorExpansion": true, | ||
"misMatchThreshold" : 0.1, | ||
"onBeforeScript": "onBefore.js", | ||
"onReadyScript": "onReady.js" | ||
"requireSameDimensions": true | ||
} | ||
], | ||
"paths": { | ||
"bitmaps_reference": "backstop_data/bitmaps_reference", | ||
"bitmaps_test": "backstop_data/bitmaps_test", | ||
"casper_scripts": "backstop_data/casper_scripts", | ||
"engine_scripts": "backstop_data/engine_scripts", | ||
"html_report": "backstop_data/html_report", | ||
"ci_report": "backstop_data/ci_report" | ||
}, | ||
"casperFlags": [], | ||
"engine": "phantomjs", | ||
"report": [] | ||
"report": ["browser"], | ||
"engine": "chrome", | ||
"engineFlags": [], | ||
"debug": false, | ||
"debugWindow": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
module.exports = { | ||
plugins: [ | ||
require('postcss-import'), | ||
require('postcss-cssnext'), // permit future css rules | ||
require('postcss-neat'), // @TODO investigate purging? may be unused | ||
require('rucksack-css'), // css function superset (e.g. less like syntax) | ||
require('autoprefixer')({ browsers: ['last 2 version'] }) | ||
require('postcss-cssnext'), // permit future css rules | ||
require('postcss-neat') // @TODO investigate purging? may be unused | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
'use strict' | ||
|
||
require('perish') | ||
|
||
const path = require('path') | ||
const cp = require('child_process') | ||
const projectRoot = path.resolve(__dirname, '..') | ||
const npmBin = path.resolve(projectRoot, 'node_modules', '.bin') | ||
|
||
let processHandles = [] | ||
function kill () { | ||
processHandles.forEach(handle => { try { handle.kill() } catch (err) {} }) | ||
} | ||
const execa = require('execa') | ||
const bb = require('bluebird') | ||
const builder = require('./builder') | ||
|
||
const staticContentDir = path.join(projectRoot, 'styleguide') | ||
const server = cp.spawn('httpster', ['-d', staticContentDir], { cwd: npmBin, stdio: 'inherit' }) | ||
processHandles.push(server) | ||
server.on('exit', code => { | ||
if (code) throw new Error('httpster unable to serve') | ||
kill() | ||
}) | ||
const PROJECT_ROOT_DIR = path.resolve(__dirname, '..') | ||
const NPM_BIN_DIR = path.resolve(PROJECT_ROOT_DIR, 'node_modules', '.bin') | ||
const STATIC_CONTENT_DIR = path.join(PROJECT_ROOT_DIR, 'styleguide') | ||
const BACKSTOP_BIN = path.join(NPM_BIN_DIR, 'backstop') | ||
|
||
const backstopBin = path.join(npmBin, 'backstop') | ||
let backstop | ||
|
||
setTimeout(() => { | ||
backstop = cp.spawn(backstopBin, ['test'], { cwd: projectRoot, stdio: 'inherit' }) | ||
processHandles.push(backstop.childProcess) | ||
backstop.on('exit', code => process.exit(code)) | ||
}, 5000) | ||
const test = { | ||
async start () { | ||
await builder.styleguide() | ||
const server = execa('httpster', ['-d', STATIC_CONTENT_DIR], { cwd: NPM_BIN_DIR, stdio: 'inherit' }) | ||
server.on('exit', () => this.kill()) | ||
server.on('error', () => { throw new Error('httpster unable to serve') }) | ||
await bb.delay(5000) | ||
try { | ||
const backstop = await execa(BACKSTOP_BIN, ['test'], { cwd: PROJECT_ROOT_DIR, stdio: 'inherit' }) | ||
backstop.on('exit', code => process.exit(code)) | ||
process.on('exit', this.kill.bind(this)) | ||
} finally { | ||
server.kill() | ||
} | ||
} | ||
} | ||
|
||
process.on('exit', kill) | ||
test.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.