Skip to content

Commit

Permalink
Add visual tests and first baseline screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
kwltrs committed Dec 13, 2016
1 parent 2d4c4a3 commit c2c93fc
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .gemini.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rootUrl: ***REMOVED***
gridUrl: 'overidden by test script to point towards dockerized browser'
screenshotsDir: './visual-tests/baseline-screenshots'
browsers:
firefox-small:
windowSize: 479x10000
desiredCapabilities:
browserName: firefox
firefox-medium:
windowSize: 767x10000
desiredCapabilities:
browserName: firefox
firefox-large:
windowSize: 1023x10000
desiredCapabilities:
browserName: firefox
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
"ffe-core": "^8.1.0"
},
"devDependencies": {
"ffe-core": "^8.1.0",
"ffe-visual-tests-support": "^2.1.0",
"less": "^2.7.1",
"mkdirp": "^0.5.1",
"ffe-core": "^8.1.0"
"mkdirp": "^0.5.1"
}
}
7 changes: 7 additions & 0 deletions run_visual-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

source node_modules/ffe-visual-tests-support/run_gemini_command.lib

rm -rf gemini-report/

run_gemini_command test --reporter html --reporter flat
8 changes: 8 additions & 0 deletions update_visual-tests-baselines.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

npm install
npm run examples

source node_modules/ffe-visual-tests-support/run_gemini_command.lib

run_gemini_command update
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions visual-tests/specs/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var fs = require('fs');



var HTML_PATTERN = /\.html$/

fs.readdirSync('./examples')
.filter(function(f) { return f.match(HTML_PATTERN) })
.forEach(function(f) {
gemini.suite(f.replace(HTML_PATTERN, ""), function(suite) {
suite.setUrl('/' + f)
.setCaptureElements('body')
.before(function(actions, find) {
actions.executeJS(function(window) {
Array.prototype.forEach.call(document.querySelectorAll(".ffe-loading-spinner, .ffe-action-button__label-spinner, .ffe-primary-button__label-spinner, .ffe-secondary-button__label-spinner"), function(el) {
// Removes spinning/animation elements that impair test stability
el && el.parentNode.removeChild(el);
});
})
.wait(500); // for checkbox animations to reach steady state

})
.capture('plain');
})
});

0 comments on commit c2c93fc

Please sign in to comment.