Skip to content

Commit

Permalink
fix: collect image comparison fails in grouping error
Browse files Browse the repository at this point in the history
  • Loading branch information
CatWithApple committed Apr 4, 2019
1 parent fd42fd6 commit ecb9dc5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/static/modules/group-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ function extractErrorsFromRetries(retries) {
const errorsInRetry = new Set();

for (const retry of retries) {
for (const {error} of [...retry.imagesInfo, retry]) {
for (const {error, diffImg} of [...retry.imagesInfo, retry]) {
if (get(error, 'message')) {
errorsInRetry.add(error.message);
}
if (diffImg) {
errorsInRetry.add('image comparison failed');
}
}
}
return [...errorsInRetry];
Expand Down
24 changes: 24 additions & 0 deletions test/lib/static/modules/group-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
mkSuiteTree,
mkTestResult
} = require('../../../utils');
const {mkImg_} = require('../components/utils');

describe('static/modules/group-errors', () => {
it('should not collect errors from success test', () => {
Expand Down Expand Up @@ -75,6 +76,29 @@ describe('static/modules/group-errors', () => {
]);
});

it('should collect image comparison fails', () => {
const suites = [
mkSuiteTree({
browsers: [
mkBrowserResult({
result: mkTestResult({
imagesInfo: [
{diffImg: mkImg_()}
]
})
})
]
})
];

const result = groupErrors({suites});

assert.strictEqual(result.length, 1);
assert.strictEqual(result[0].count, 1);
assert.strictEqual(result[0].name, 'image comparison failed');
assert.strictEqual(result[0].pattern, 'image comparison failed');
});

it('should collect errors from result and retries', () => {
const suites = [
mkSuiteTree({
Expand Down

0 comments on commit ecb9dc5

Please sign in to comment.