You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Automating your QA with Visual Regression Testing Example Repository
2
2
3
-
This repository is an example for my talk [Automating your QA with Visual Regression Testing](https://2019.europe.wordcamp.org/session/automating-your-qa-with-visual-regression-testing/) at WordCamp Europe 2019. It uses [BackstopJS](https://github.com/garris/BackstopJS/) and [Node JS](https://nodejs.org/) to automate visual QA. The slides for the talk can be found [here](https://goo.gl/V7QtNw).
3
+
This repository is an example for my talk [Automating your QA with Visual Regression Testing](https://2019.europe.wordcamp.org/session/automating-your-qa-with-visual-regression-testing/) at WordCamp Europe 2019. The slides for the talk can be found [here](https://goo.gl/V7QtNw).
4
+
5
+
[BackstopJS](https://github.com/garris/BackstopJS/) is used for the visual regression testing. The app itself is built with [Node JS](https://nodejs.org/), [`commander.js`](https://github.com/tj/commander.js/), and [`Inquirer.js`](https://github.com/SBoudrias/Inquirer.js).
4
6
5
7
## Prerequisites
6
8
@@ -21,7 +23,7 @@ After setting up the repository locally (see above) you will need to:
21
23
22
24
1. Run the command `npm install` to download dependencies
23
25
1. Run the command `npm run start`
24
-
*Type the number of a site from the list or enter _all_to test all sites in `src/sitesToTest.js`
26
+
*Select the site you want to test from the list
25
27
1. Check out the results from the sample test
26
28
* They should open in your browser automatically
27
29
1. Edit `src/sitesToTest.js`
@@ -34,7 +36,7 @@ After setting up the repository locally (see above) you will need to:
34
36
1. Run the command `npm run build`.
35
37
* This command needs to be run anytime you edit items in `src`
36
38
1. Run the command `npm run start`.
37
-
*To test a single site, enter its number from the list, or enter `all`to test all sites in `src/sitesToTest.js`
39
+
*Select the site you want to test from the list
38
40
39
41
**Troubleshooting**
40
42
If you are having issues with the script hanging or BackstopJS taking a long time there may be headless Chrome instances that didn't close properly.
(0,_throwError.default)(_ansiColors.default.red(`${_ansiColors.default.bold(siteToTest)} is not a valid site. Check the name you entered against the ${_ansiColors.default.grey('sitesToTest.js')} config file`));
constcurrentConfig=(0,_backstopConfig.default)(site.nonProductionBaseUrl,site.productionBaseUrl,site.pathsToTest,site.name);// Disable logging since BackstopJS is noisy
40
+
// console.log = function () {};
34
41
35
-
if(!siteExists){
36
-
(0,_throwError.default)(_ansiColors.default.red(`${_ansiColors.default.gray(siteToTest)} is not a valid site. Check the name you entered against the ${_ansiColors.default.gray('sitesToTest.js')} config file`));
(0,_fancyLog.default)(`Running Backstop tests for ${site.label}`);
45
42
(0,_backstopjs.default)('reference',{
46
43
config: currentConfig
47
44
}).then(()=>{
48
-
(0,_fancyLog.default)(`Backstop JS reference complete for ${site.label}! Starting tests.`);
49
45
(0,_backstopjs.default)('test',{
50
46
config: currentConfig
51
47
}).then(()=>{
52
-
(0,_fancyLog.default)(_ansiColors.default.yellow(`Report saved to ${_ansiColors.default.gray(`${rootDir}/backstop_data/${site.name}/html_report/index.html`)}`));
53
-
(0,_fancyLog.default)(_ansiColors.default.green(`Backstop JS tests passed for ${site.label}!`));
48
+
(0,_fancyLog.default)(_ansiColors.default.bgGreen(`Backstop JS tests passed for ${site.label}!`));
54
49
}).catch(()=>{
55
-
(0,_fancyLog.default)(`Report saved to "${rootDir}/backstop_data/${site.name}/html_report/index.html"`);
56
-
(0,_throwError.default)(_ansiColors.default.red(`Backstop JS tests failed for ${_ansiColors.default.gray(site.label)}!`));
50
+
(0,_fancyLog.default)(_ansiColors.default.bgRed(_ansiColors.default.white(`Backstop JS tests failed for ${site.label}!`)));
57
51
});
58
52
}).catch(()=>{
59
-
(0,_throwError.default)(_ansiColors.default.red(`Backstop JS reference failed for ${_ansiColors.default.gray(site.label)}! Please check the BackstopReferenceBaseUrl`));
53
+
(0,_fancyLog.default)(_ansiColors.default.bgRed(_ansiColors.default.white(`Backstop JS tests failed for ${site.label}!`)));
0 commit comments