Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ost-ptk committed May 7, 2019
0 parents commit 927358e
Show file tree
Hide file tree
Showing 17 changed files with 867 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#airbnb
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/backstop_data
/src/report
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: '@mate-academy/eslint-config',
};
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea
node_modules
.DS_Store
yarn.lock
package-lock.json
backstop_data
!backstop_data/engine_scripts/
2 changes: 2 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/backstop_data/
/src/report
4 changes: 4 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
extends: "@mate-academy/stylelint-config",
rules: {}
}
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- '11'
cache: npm
before_script:
- bash ./config/hooks/start-server.sh
script:
- npm run css:reference
- npm run css:test
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions config/backstop/backstopConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
'use strict';

// https://github.com/garris/BackstopJS#advanced-scenarios
const basicScenario = {
label: 'test', // name of the test
url: 'http://localhost:8080',
referenceUrl: '', // put here reference to github-pages with ready project
readyEvent: '',
readySelector: '',
delay: 1000,
hideSelectors: ['[data-qa-hidden]'],
removeSelectors: ['[data-qa-remove]'],
hoverSelector: '',
clickSelector: '',
postInteractionWait: 0,
selectors: '',
selectorExpansion: true,
expect: 0,
misMatchThreshold: 1, // 1% of 100%
requireSameDimensions: true,
};

module.exports = {
id: 'test',
onBeforeScript: 'puppet/onBefore.js',
onReadyScript: 'puppet/onReady.js',
viewports: [
{
name: 'tablet_h',
width: 1024,
height: 768,
},
],
scenarios: [
{ ...basicScenario },
// define here scenarios for testing
],
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: 'puppeteer',
engineOptions: {
args: ['--no-sandbox'],
},
asyncCaptureLimit: 5,
asyncCompareLimit: 50,
debug: false,
debugWindow: false,
};
9 changes: 9 additions & 0 deletions config/hooks/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

cp -R backstop_data/ src/report
git add src/
git commit -m "deploy static content"
git subtree push --prefix src origin gh-pages
./node_modules/.bin/rimraf src/report
git add src/
git commit -m "removed report after deploy"
3 changes: 3 additions & 0 deletions config/hooks/start-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
npm run start &
sleep 3
57 changes: 57 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "layout-task-boilerplate",
"version": "1.0.0",
"description": "Boilerplate for layout tasks with visual regression testing",
"main": "src/main.js",
"scripts": {
"css:test": "rimraf ./backstop_data/bitmaps_test && backstop test --config=config/backstop/backstopConfig",
"css:reference": "rimraf ./backstop_data/bitmaps_reference && backstop reference --config=config/backstop/backstopConfig",
"deploy": "bash ./config/hooks/deploy.sh",
"lint": "stylelint src/**/*.css && eslint src/**/*.js && htmllint --rc ./node_modules/@mate-academy/htmllint-config/.htmllintrc src/*.html",
"start": "http-server ./src -p 8080 -c-1"
},
"keywords": [],
"author": "Mate Academy",
"license": "GPL-3.0",
"devDependencies": {
"@mate-academy/eslint-config": "*",
"@mate-academy/htmllint-config": "*",
"@mate-academy/stylelint-config": "*",
"backstopjs": "^4.0.3",
"eslint": "^5.16.0",
"eslint-plugin-node": "^8.0.1",
"htmllint": "^0.7.3",
"htmllint-cli": "0.0.7",
"http-server": "^0.11.1",
"husky": "^1.3.1",
"lint-staged": "^8.1.5",
"rimraf": "^2.6.3",
"stylelint": "^10.0.0"
},
"lint-staged": {
"linters": {
"*.css": [
"stylelint",
"git add"
],
"*.js": [
"eslint",
"git add"
],
"*.html": [
"htmllint --rc ./node_modules/@mate-academy/htmllint-config/.htmllintrc",
"git add"
]
},
"ignore": [
"**/backstop_data/**",
"**/report/**"
]
},
"husky": {
"hooks": {
"post-commit": "git update-index --again",
"pre-commit": "lint-staged"
}
}
}
13 changes: 13 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Boilerplate for layout tasks

Here is the description.

---
**Read the guideline before start**

[Guideline](https://github.com/mate-academy/layout_task-guideline/blob/master/README.md)

**Result**

- [UPDATE DEMO LINK](https://<your_account>.github.io/<repo_name>/)
- [UPDATE TEST REPORT LINK](https://<your_account>.github.io/<repo_name>/report/html_report/)
Empty file added src/images/.gitkeep
Empty file.
19 changes: 19 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
user-scalable=no,
initial-scale=1.0,
maximum-scale=1.0,
minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>

<script type="text/javascript" src="./main.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'use strict';
Empty file added src/style.css
Empty file.

0 comments on commit 927358e

Please sign in to comment.