New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hk responsive layout #47
Merged
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
07a4387
Scale down images for small layouts
hanneskaeufler 1ba52e3
Add backstopjs to do visual regression testing
hanneskaeufler 8a16e94
Add first backstop references
hanneskaeufler 4c2b4f0
Run backstop as yarn test
hanneskaeufler de3a04c
Fix squashed header for phone size
hanneskaeufler 7d7a782
Hide link text in social media links for phones
hanneskaeufler 5db5f87
Add some padding to the tagline
hanneskaeufler bd202f8
Add sample post reference test
hanneskaeufler f21379b
Properly downgrade headings
hanneskaeufler 82b2847
I am not going to tackle that todo
hanneskaeufler f0637b2
Add padding around content
hanneskaeufler 1555b7c
Fix <strong> tag styling
hanneskaeufler cb232b6
Add references for archive
hanneskaeufler fa50d55
Improve archive search box
hanneskaeufler a5dae6f
Add approve yarn script
hanneskaeufler 5df2237
Remove unneeded styles
hanneskaeufler File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
---|---|---|
|
@@ -9,3 +9,5 @@ Gemfile.lock | |
/junit/ | ||
*.dwarf | ||
/bin/lucky/ | ||
/backstop_data/html_report/ | ||
/backstop_data/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"id": "backstop_default", | ||
"viewports": [ | ||
{ | ||
"label": "phone", | ||
"width": 320, | ||
"height": 480 | ||
}, | ||
{ | ||
"label": "tablet", | ||
"width": 1024, | ||
"height": 768 | ||
}, | ||
{ | ||
"label": "desktop", | ||
"width": 2880, | ||
"height": 1800 | ||
} | ||
], | ||
"onBeforeScript": "chromy/onBefore.js", | ||
"onReadyScript": "chromy/onReady.js", | ||
"scenarios": [ | ||
{ | ||
"label": "Blog Index", | ||
"cookiePath": "backstop_data/engine_scripts/cookies.json", | ||
"url": "http://localhost:5000", | ||
"referenceUrl": "", | ||
"readyEvent": "", | ||
"readySelector": "", | ||
"delay": 0, | ||
"hideSelectors": [], | ||
"removeSelectors": [], | ||
"hoverSelector": "", | ||
"clickSelector": "", | ||
"postInteractionWait": 0, | ||
"selectors": [], | ||
"selectorExpansion": true, | ||
"misMatchThreshold" : 0.1, | ||
"requireSameDimensions": true | ||
}, | ||
{ | ||
"label": "Blog Sample Post", | ||
"cookiePath": "backstop_data/engine_scripts/cookies.json", | ||
"url": "http://localhost:5000/posts/sample-post", | ||
"referenceUrl": "", | ||
"readyEvent": "", | ||
"readySelector": "", | ||
"delay": 0, | ||
"hideSelectors": [], | ||
"removeSelectors": [], | ||
"hoverSelector": "", | ||
"clickSelector": "", | ||
"postInteractionWait": 0, | ||
"selectors": [], | ||
"selectorExpansion": true, | ||
"misMatchThreshold" : 0.1, | ||
"requireSameDimensions": true | ||
} | ||
], | ||
"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": ["browser"], | ||
"engine": "chrome", | ||
"engineFlags": [], | ||
"asyncCaptureLimit": 5, | ||
"asyncCompareLimit": 50, | ||
"debug": false, | ||
"debugWindow": false | ||
} |
Binary file added
BIN
+266 KB
backstop_data/bitmaps_reference/backstop_default_Blog_Index_0_document_0_phone.png
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
+236 KB
...stop_data/bitmaps_reference/backstop_default_Blog_Index_0_document_1_tablet.png
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
+266 KB
...top_data/bitmaps_reference/backstop_default_Blog_Index_0_document_2_desktop.png
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
+253 KB
...data/bitmaps_reference/backstop_default_Blog_Sample_Post_0_document_0_phone.png
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
+219 KB
...ata/bitmaps_reference/backstop_default_Blog_Sample_Post_0_document_1_tablet.png
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
+240 KB
...ta/bitmaps_reference/backstop_default_Blog_Sample_Post_0_document_2_desktop.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
backstop_data/engine_scripts/casper/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,25 @@ | ||
var WAIT_TIMEOUT = 5000; | ||
|
||
module.exports = function(casper, scenario) { | ||
var waitFor = require('./waitForHelperHelper')(casper, WAIT_TIMEOUT); | ||
var hoverSelector = scenario.hoverSelector, | ||
clickSelector = scenario.clickSelector, | ||
postInteractionWait = scenario.postInteractionWait; | ||
|
||
if (hoverSelector) { | ||
waitFor(hoverSelector); | ||
casper.then(function () { | ||
casper.mouse.move(hoverSelector); | ||
}); | ||
} | ||
|
||
if (clickSelector) { | ||
waitFor(clickSelector); | ||
casper.then(function () { | ||
casper.click(clickSelector); | ||
}); | ||
} | ||
|
||
// TODO: if postInteractionWait === integer then do ==> wait(postInteractionWait) || elsevvv | ||
waitFor(postInteractionWait); | ||
}; |
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,15 @@ | ||
var fs = require('fs'); | ||
|
||
module.exports = function (casper, scenario) { | ||
var cookies = []; | ||
var cookiePath = scenario.cookiePath; | ||
|
||
// READ COOKIES FROM FILE IF EXISTS | ||
if (fs.exists(cookiePath)) { | ||
cookies = JSON.parse(fs.read(cookiePath)); | ||
} | ||
|
||
casper.page.cookies = cookies; | ||
console.log('Cookie state restored with cookies:', JSON.stringify(cookies, null, 2)); | ||
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'); | ||
}; |
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,4 @@ | ||
module.exports = function (casper, scenario, vp) { | ||
require('./loadCookies')(casper, scenario); | ||
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'); | ||
}; |
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,5 @@ | ||
module.exports = function(casper, scenario, vp) { | ||
console.log('SCENARIO> ' + scenario.label); | ||
require('./clickAndHoverHelper')(casper, scenario); | ||
// add more helpers here... | ||
}; |
18 changes: 18 additions & 0 deletions
18
backstop_data/engine_scripts/casper/waitForHelperHelper.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,18 @@ | ||
var TIMEOUT_DEFAULT = 2000; | ||
|
||
module.exports = function (casper, timeout) { | ||
var TIMEOUT = timeout || TIMEOUT_DEFAULT; | ||
|
||
return function waitFor (selector) { | ||
if (selector) { | ||
casper.waitForSelector( | ||
selector, | ||
function () {}, | ||
function () { | ||
console.error('NOT FOUND > ' + selector); | ||
}, | ||
TIMEOUT | ||
); | ||
} | ||
}; | ||
}; |
24 changes: 24 additions & 0 deletions
24
backstop_data/engine_scripts/chromy/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,24 @@ | ||
module.exports = function (chromy, scenario) { | ||
var hoverSelector = scenario.hoverSelector; | ||
var clickSelector = scenario.clickSelector; | ||
var postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int] | ||
|
||
if (hoverSelector) { | ||
chromy | ||
.wait(hoverSelector) | ||
.rect(hoverSelector) | ||
.result(function (rect) { | ||
chromy.mouseMoved(rect.left, rect.top); | ||
}); | ||
} | ||
|
||
if (clickSelector) { | ||
chromy | ||
.wait(clickSelector) | ||
.click(clickSelector); | ||
} | ||
|
||
if (postInteractionWait) { | ||
chromy.wait(postInteractionWait); | ||
} | ||
}; |
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,22 @@ | ||
var fs = require('fs'); | ||
|
||
module.exports = function (chromy, scenario) { | ||
var cookies = []; | ||
var cookiePath = scenario.cookiePath; | ||
|
||
// READ COOKIES FROM FILE IF EXISTS | ||
if (fs.existsSync(cookiePath)) { | ||
cookies = JSON.parse(fs.readFileSync(cookiePath)); | ||
} | ||
|
||
// MUNGE COOKIE DOMAIN FOR CHROMY USAGE | ||
cookies = cookies.map(cookie => { | ||
cookie.url = 'https://' + cookie.domain; | ||
delete cookie.domain; | ||
return cookie; | ||
}); | ||
|
||
// SET COOKIES VIA CHROMY | ||
chromy.setCookie(cookies); | ||
console.log('Cookie state restored with:', JSON.stringify(cookies, null, 2)); | ||
}; |
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,6 @@ | ||
module.exports = function (chromy, scenario, vp) { | ||
require('./loadCookies')(chromy, scenario); | ||
|
||
// IGNORE ANY CERT WARNINGS | ||
chromy.ignoreCertificateErrors(); | ||
}; |
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,5 @@ | ||
module.exports = function (chromy, scenario, vp) { | ||
console.log('SCENARIO > ' + scenario.label); | ||
require('./clickAndHoverHelper')(chromy, scenario); | ||
// add more ready handlers here... | ||
}; |
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,14 @@ | ||
[ | ||
{ | ||
"domain": ".www.yourdomain.com", | ||
"path": "/", | ||
"name": "yourCookieName", | ||
"value": "yourCookieValue", | ||
"expirationDate": 1798790400, | ||
"hostOnly": false, | ||
"httpOnly": false, | ||
"secure": false, | ||
"session": false, | ||
"sameSite": "no_restriction" | ||
} | ||
] |
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,4 @@ | ||
module.exports = function (engine, scenario, vp) { | ||
// This script runs before your app loads. Edit here to log-in, load cookies or set other states required for your test. | ||
console.log('onBefore.js has run for ' + vp.label + '.'); | ||
}; |
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,6 @@ | ||
module.exports = function (engine, scenario, vp) { | ||
engine.evaluate(function () { | ||
// Your web-app is now loaded. Edit here to simulate user interactions or other state changes in the browser window context. | ||
}); | ||
console.log('onReady.js has run for: ', vp.label); | ||
}; |
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,6 +1,17 @@ | ||
describe PostContentRenderer do | ||
it "downgrades headings" do | ||
renderer = PostContentRenderer.new | ||
post = build_post(content: "Yo hello\n# Title\n well ...") | ||
PostContentRenderer.new.render(post).should contain("\n<h2>") | ||
renderer.render(post).should contain("\n<h2>") | ||
|
||
post = build_post(content: "# Title") | ||
renderer.render(post).should contain("<h2>") | ||
end | ||
|
||
it "does not mess with hashes in text" do | ||
renderer = PostContentRenderer.new | ||
post = build_post(content: "Just some text containing a # innocent hash") | ||
|
||
renderer.render(post).should contain("Just some text containing a # innocent has") | ||
end | ||
end |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol thanks