-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Integrated Visual Regression with ember-backstop (#94)
* Integrating Visual Regression * Removed lerna since flag * made change to .gitignore * Backstop ref changes * Made all computed properties computed * Checking an artifact workflow * Changed artifact workflow with path * Changed backstop config * Backstop Debug * Backstop Debug Window Eliminated * Enabled CI Reporting * Reduced async limit * Trial with max threshold * Trial check for screenshots * Full threshold * New inline banner * no tests for banners * Run 2 VR tests * Removed workflow downloads * Experiments I with async * Experiments II with async * Experiments III with async * Experiments IV with async * Experiments V with async * Experiments VI * Experiments VII * Parallel process * Normal threshold limits * fix(tests): concurrency * fix(lerna): removed --no-bail * New ref images * fix: button ref images * changed threshold * Update continuous-integration-workflow.yml * Hopefully final ref images * Cleanup for final review * Made required changes Co-authored-by: Shibu Lijack <[email protected]>
- Loading branch information
1 parent
22455e6
commit 2613dca
Showing
64 changed files
with
1,464 additions
and
92 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
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 |
---|---|---|
|
@@ -28,3 +28,7 @@ tmp | |
/bower.json.ember-try | ||
/package.json.ember-try | ||
.DS_Store | ||
|
||
#backstopjs | ||
html_report | ||
bitmaps_test |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
id: `ember-backstop test`, | ||
viewports: [ | ||
{ | ||
label: 'webview', | ||
width: 1440, | ||
height: 900, | ||
}, | ||
], | ||
onBeforeScript: `puppet/onBefore.js`, | ||
onReadyScript: `puppet/onReady.js`, | ||
scenarios: [ | ||
{ | ||
label: '{testName}', | ||
cookiePath: 'backstop_data/engine_scripts/cookies.json', | ||
url: '{origin}/backstop/dview/{testId}/{scenarioId}', | ||
delay: 500, | ||
}, | ||
], | ||
paths: { | ||
bitmaps_reference: 'backstop_data/bitmaps_reference', | ||
bitmaps_test: 'backstop_data/bitmaps_test', | ||
engine_scripts: 'backstop_data/engine_scripts', | ||
html_report: 'backstop_data/html_report', | ||
ci_report: 'backstop_data/ci_report', | ||
}, | ||
report: [], | ||
engine: 'puppet', | ||
engineOptions: { | ||
args: ['--no-sandbox'], | ||
}, | ||
asyncCaptureLimit: 10, | ||
asyncCompareLimit: 50, | ||
debug: false, | ||
debugWindow: false, | ||
}; |
Binary file added
BIN
+12.9 KB
...nner_with_link_passes_visual_regression_tests__assert0_0_document_0_webview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.72 KB
..._normal_banner_passes_visual_regression_tests__assert0_0_document_0_webview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
packages/banner/ember-backstop/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint-env browser, node */ | ||
|
||
module.exports = async (page, scenario) => { | ||
const hoverSelector = scenario.hoverSelectors || scenario.hoverSelector; | ||
const clickSelector = scenario.clickSelectors || scenario.clickSelector; | ||
const keyPressSelector = scenario.keyPressSelectors || scenario.keyPressSelector; | ||
const scrollToSelector = scenario.scrollToSelector; | ||
const postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int] | ||
|
||
if (keyPressSelector) { | ||
for (const keyPressSelectorItem of [].concat(keyPressSelector)) { | ||
await page.waitFor(keyPressSelectorItem.selector); | ||
await page.type(keyPressSelectorItem.selector, keyPressSelectorItem.keyPress); | ||
} | ||
} | ||
|
||
if (hoverSelector) { | ||
for (const hoverSelectorIndex of [].concat(hoverSelector)) { | ||
await page.waitFor(hoverSelectorIndex); | ||
await page.hover(hoverSelectorIndex); | ||
} | ||
} | ||
|
||
if (clickSelector) { | ||
for (const clickSelectorIndex of [].concat(clickSelector)) { | ||
await page.waitFor(clickSelectorIndex); | ||
await page.click(clickSelectorIndex); | ||
} | ||
} | ||
|
||
if (postInteractionWait) { | ||
await page.waitFor(postInteractionWait); | ||
} | ||
|
||
if (scrollToSelector) { | ||
await page.waitFor(scrollToSelector); | ||
await page.evaluate(scrollToSelector => { | ||
document.querySelector(scrollToSelector).scrollIntoView(); | ||
}, scrollToSelector); | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/banner/ember-backstop/backstop_data/engine_scripts/puppet/onReady.js
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-env browser, node */ | ||
|
||
const debug = require('debug')('BackstopJS'); | ||
|
||
module.exports = async (page, scenario, vp) => { | ||
debug('SCENARIO > ' + scenario.label); | ||
await require('./overrideCSS')(page, scenario); | ||
await require('./clickAndHoverHelper')(page, scenario); | ||
|
||
// add more ready handlers here... | ||
}; |
13 changes: 13 additions & 0 deletions
13
packages/banner/ember-backstop/backstop_data/engine_scripts/puppet/overrideCSS.js
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* eslint-env browser, node */ | ||
|
||
module.exports = function(page, scenario) { | ||
// inject arbitrary css to override styles | ||
page.evaluate(() => { | ||
const BACKSTOP_TEST_CSS_OVERRIDE = `#ember-testing {width: 100% !important; height: 100% !important; -webkit-transform: scale(1) !important; transform: scale(1) !important;}`; | ||
let style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
let styleNode = document.createTextNode(BACKSTOP_TEST_CSS_OVERRIDE); | ||
style.appendChild(styleNode); | ||
document.head.appendChild(style); | ||
}); | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
id: `ember-backstop test`, | ||
viewports: [ | ||
{ | ||
label: 'webview', | ||
width: 1440, | ||
height: 900, | ||
}, | ||
], | ||
onBeforeScript: `puppet/onBefore.js`, | ||
onReadyScript: `puppet/onReady.js`, | ||
scenarios: [ | ||
{ | ||
label: '{testName}', | ||
cookiePath: 'backstop_data/engine_scripts/cookies.json', | ||
url: '{origin}/backstop/dview/{testId}/{scenarioId}', | ||
delay: 500, | ||
}, | ||
], | ||
paths: { | ||
bitmaps_reference: 'backstop_data/bitmaps_reference', | ||
bitmaps_test: 'backstop_data/bitmaps_test', | ||
engine_scripts: 'backstop_data/engine_scripts', | ||
html_report: 'backstop_data/html_report', | ||
ci_report: 'backstop_data/ci_report', | ||
}, | ||
report: [], | ||
engine: 'puppet', | ||
engineOptions: { | ||
args: ['--no-sandbox'], | ||
}, | ||
asyncCaptureLimit: 10, | ||
asyncCompareLimit: 50, | ||
debug: false, | ||
debugWindow: false, | ||
}; |
Binary file added
BIN
+21.6 KB
...-button__buttons_pass_visual_regression_tests__assert0_0_document_0_webview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.41 KB
..._clicked_buttons_pass_visual_regression_tests__assert0_0_document_0_webview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.13 KB
..._hovered_buttons_pass_visual_regression_tests__assert0_0_document_0_webview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
packages/button/ember-backstop/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint-env browser, node */ | ||
|
||
module.exports = async (page, scenario) => { | ||
const hoverSelector = scenario.hoverSelectors || scenario.hoverSelector; | ||
const clickSelector = scenario.clickSelectors || scenario.clickSelector; | ||
const keyPressSelector = scenario.keyPressSelectors || scenario.keyPressSelector; | ||
const scrollToSelector = scenario.scrollToSelector; | ||
const postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int] | ||
|
||
if (keyPressSelector) { | ||
for (const keyPressSelectorItem of [].concat(keyPressSelector)) { | ||
await page.waitFor(keyPressSelectorItem.selector); | ||
await page.type(keyPressSelectorItem.selector, keyPressSelectorItem.keyPress); | ||
} | ||
} | ||
|
||
if (hoverSelector) { | ||
for (const hoverSelectorIndex of [].concat(hoverSelector)) { | ||
await page.waitFor(hoverSelectorIndex); | ||
await page.hover(hoverSelectorIndex); | ||
} | ||
} | ||
|
||
if (clickSelector) { | ||
for (const clickSelectorIndex of [].concat(clickSelector)) { | ||
await page.waitFor(clickSelectorIndex); | ||
await page.click(clickSelectorIndex); | ||
} | ||
} | ||
|
||
if (postInteractionWait) { | ||
await page.waitFor(postInteractionWait); | ||
} | ||
|
||
if (scrollToSelector) { | ||
await page.waitFor(scrollToSelector); | ||
await page.evaluate(scrollToSelector => { | ||
document.querySelector(scrollToSelector).scrollIntoView(); | ||
}, scrollToSelector); | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/button/ember-backstop/backstop_data/engine_scripts/puppet/onReady.js
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-env browser, node */ | ||
|
||
const debug = require('debug')('BackstopJS'); | ||
|
||
module.exports = async (page, scenario, vp) => { | ||
debug('SCENARIO > ' + scenario.label); | ||
await require('./overrideCSS')(page, scenario); | ||
await require('./clickAndHoverHelper')(page, scenario); | ||
|
||
// add more ready handlers here... | ||
}; |
13 changes: 13 additions & 0 deletions
13
packages/button/ember-backstop/backstop_data/engine_scripts/puppet/overrideCSS.js
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* eslint-env browser, node */ | ||
|
||
module.exports = function(page, scenario) { | ||
// inject arbitrary css to override styles | ||
page.evaluate(() => { | ||
const BACKSTOP_TEST_CSS_OVERRIDE = `#ember-testing {width: 100% !important; height: 100% !important; -webkit-transform: scale(1) !important; transform: scale(1) !important;}`; | ||
let style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
let styleNode = document.createTextNode(BACKSTOP_TEST_CSS_OVERRIDE); | ||
style.appendChild(styleNode); | ||
document.head.appendChild(style); | ||
}); | ||
}; |
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
Oops, something went wrong.