diff --git a/.github/workflows/test.yml-template b/.github/workflows/test.yml-template new file mode 100644 index 0000000000..8b5743ecb4 --- /dev/null +++ b/.github/workflows/test.yml-template @@ -0,0 +1,29 @@ +name: Test + +on: + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + - name: Upload HTML report(backstop data) + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: report + path: backstop_data diff --git a/backstop.json b/backstop.json new file mode 100644 index 0000000000..967585f45e --- /dev/null +++ b/backstop.json @@ -0,0 +1,54 @@ +{ + "id": "backstop_default", + "viewports": [ + { + "label": "phone", + "width": 320, + "height": 480 + }, + { + "label": "tablet", + "width": 1024, + "height": 768 + } + ], + "onBeforeScript": "puppet/onBefore.js", + "onReadyScript": "puppet/onReady.js", + "scenarios": [ + { + "label": "BackstopJS Homepage", + "cookiePath": "backstop_data/engine_scripts/cookies.json", + "url": "https://garris.github.io/BackstopJS/", + "referenceUrl": "", + "readyEvent": "", + "readySelector": "", + "delay": 0, + "hideSelectors": [], + "removeSelectors": [], + "hoverSelector": "", + "clickSelector": "", + "postInteractionWait": 0, + "selectors": [], + "selectorExpansion": true, + "expect": 0, + "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": "puppeteer", + "engineOptions": { + "args": ["--no-sandbox"] + }, + "asyncCaptureLimit": 5, + "asyncCompareLimit": 50, + "debug": false, + "debugWindow": false +} diff --git a/backstopConfig.js b/backstopConfig.js index e6f40f1ba6..733ddb6eb7 100644 --- a/backstopConfig.js +++ b/backstopConfig.js @@ -9,17 +9,20 @@ const { basicScenario } = backstop; const config = { ...backstop, fileNameTemplate: '{scenarioLabel}', - viewports: [{ - name: 'custom-size', - width: 200, - height: 50, - }], + viewports: [ + { + name: 'custom-size', + width: 200, + height: 50, + }, + ], scenarios: [ { ...basicScenario, label: 'Entire document', referenceUrl: basicScenario.referenceUrl + '/hello-world/', - }], + }, + ], }; module.exports = config; diff --git a/package-lock.json b/package-lock.json index 61cf4a2b31..53e78eaf03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,15 @@ "version": "1.0.0", "hasInstallScript": true, "license": "GPL-3.0", + "dependencies": { + "backstop": "^1.0.1" + }, "devDependencies": { "@linthtml/linthtml": "^0.9.6", "@mate-academy/backstop-config": "latest", "@mate-academy/bemlint": "latest", "@mate-academy/linthtml-config": "latest", - "@mate-academy/scripts": "^1.8.6", + "@mate-academy/scripts": "^1.9.12", "@mate-academy/stylelint-config": "latest", "backstopjs": "6.3.23", "jest": "^29.7.0", @@ -1211,9 +1214,9 @@ "dev": true }, "node_modules/@mate-academy/scripts": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.8.6.tgz", - "integrity": "sha512-b4om/whj4G9emyi84ORE3FRZzCRwRIesr8tJHXa8EvJdOaAPDpzcJ8A0sFfMsWH9NUOVmOwkBtOXDu5eZZ00Ig==", + "version": "1.9.12", + "resolved": "https://registry.npmjs.org/@mate-academy/scripts/-/scripts-1.9.12.tgz", + "integrity": "sha512-/OcmxMa34lYLFlGx7Ig926W1U1qjrnXbjFJ2TzUcDaLmED+A5se652NcWwGOidXRuMAOYLPU2jNYBEkKyXrFJA==", "dev": true, "dependencies": { "@octokit/rest": "^17.11.2", @@ -4673,6 +4676,11 @@ "@babel/core": "^7.0.0" } }, + "node_modules/backstop": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/backstop/-/backstop-1.0.1.tgz", + "integrity": "sha512-1vLEMys4xy7ffDuTZQnjk7+30fwxQ5Nw5P7KDqm0TtsqsTM38aITYAJ083AEX/uojgtB/iBaq2B6ZygLjNAjUw==" + }, "node_modules/backstopjs": { "version": "6.3.23", "resolved": "https://registry.npmjs.org/backstopjs/-/backstopjs-6.3.23.tgz", diff --git a/package.json b/package.json index ce9d180d76..d125cb8269 100644 --- a/package.json +++ b/package.json @@ -17,13 +17,12 @@ "keywords": [], "author": "Mate Academy", "license": "GPL-3.0", - "dependencies": {}, "devDependencies": { "@linthtml/linthtml": "^0.9.6", "@mate-academy/backstop-config": "latest", "@mate-academy/bemlint": "latest", "@mate-academy/linthtml-config": "latest", - "@mate-academy/scripts": "^1.8.6", + "@mate-academy/scripts": "^1.9.12", "@mate-academy/stylelint-config": "latest", "backstopjs": "6.3.23", "jest": "^29.7.0", @@ -38,5 +37,8 @@ "javascript": false, "bem": false } + }, + "dependencies": { + "backstop": "^1.0.1" } } diff --git a/readme.md b/readme.md index fca5f5e388..35899b3d75 100644 --- a/readme.md +++ b/readme.md @@ -21,5 +21,6 @@ and use this [VSCode settings](https://mate-academy.github.io/fe-program/tools/v ## Demo Links Replace `` with your Github username and copy the links to Pull Request description: -- [DEMO LINK](https://.github.io/layout_hello-world/) -- [TEST REPORT LINK](https://.github.io/layout_hello-world/report/html_report/) + +- [DEMO LINK](https://DionimarDev.github.io/layout_hello-world/) +- [TEST REPORT LINK](https://DionimarDev.github.io/layout_hello-world/report/html_report/) diff --git a/src/index.html b/src/index.html index e69de29bb2..955ab44fc5 100644 --- a/src/index.html +++ b/src/index.html @@ -0,0 +1,14 @@ + + + + + + Document + + + Hello, world! + +