Skip to content

Commit

Permalink
Merge pull request #403 from Cognifide/feature/conditional-test-accep…
Browse files Browse the repository at this point in the history
…tance

Feature/conditional test acceptance
  • Loading branch information
tkaik authored Oct 19, 2018
2 parents 36b8e04 + bdf70e9 commit 271dc56
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to AET will be documented in this file.

## Unreleased
**List of changes that are finished but not yet released in any final version.**
- [PR-403](https://github.com/Cognifide/aet/pull/403) Conditionally passed tests can be accepted ([#400](https://github.com/Cognifide/aet/issues/400))
- [PR-387](https://github.com/Cognifide/aet/pull/387) Set max allowed page screenshot height to 35k pixels.

## Version 3.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class ComparatorStepResult extends StepResult {

private final boolean rebaseable;

private final boolean acceptable;

public ComparatorStepResult(String artifactId, Status status) {
this(artifactId, status, false);
}
Expand All @@ -31,6 +33,8 @@ public ComparatorStepResult(String artifactId, Status status, Boolean rebaseable
super(artifactId);
this.status = status;
this.rebaseable = rebaseable;
this.acceptable = rebaseable &&
(Status.FAILED.equals(status) || Status.CONDITIONALLY_PASSED.equals(status));
}

@Override
Expand All @@ -46,6 +50,10 @@ public boolean isRebaseable() {
return rebaseable;
}

public boolean isAcceptable() {
return acceptable;
}

public enum Status {
PASSED,
FAILED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ define(['angularAMD', 'artifactsService', 'suiteInfoService'],
var stepResult = comparator.stepResult;
caseModel.showAcceptButton =
stepResult &&
stepResult.rebaseable &&
stepResult.status === 'FAILED';
stepResult.acceptable;
if (suiteInfoService.getInfo().patternCorrelationId) {
caseModel.usesCrossSuitePattern = true;
}
Expand Down
8 changes: 5 additions & 3 deletions report/src/main/webapp/app/services/metadata.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ define(['angularAMD', 'metadataCacheService', 'metadataEndpointService'],
_.forEach(decoratedObject.comparators, function (comparator) {
if (hasStepComparatorChangesToAccept(comparator)) {
comparator.stepResult.previousStatus = comparator.stepResult.status;
comparator.stepResult.wasAcceptable = comparator.stepResult.acceptable;
comparator.stepResult.status = 'REBASED';
acceptedPatterns++;
}
Expand Down Expand Up @@ -245,8 +246,7 @@ define(['angularAMD', 'metadataCacheService', 'metadataEndpointService'],

function hasStepComparatorChangesToAccept(comparator) {
return comparator && comparator.stepResult &&
comparator.stepResult.rebaseable &&
comparator.stepResult.status === 'FAILED';
comparator.stepResult.acceptable;
}

function hasStepComparatorAcceptedChanges(comparator) {
Expand Down Expand Up @@ -324,10 +324,12 @@ define(['angularAMD', 'metadataCacheService', 'metadataEndpointService'],
passed();
break;
case 'CONDITIONALLY_PASSED':
if (stepResult.rebaseable) {
updatePatternsToAccept(1);
}
conditionallyPassed();
break;
case 'FAILED':
// if `rebaseable` comparator, increment acceptable patterns counter
if (stepResult.rebaseable) {
updatePatternsToAccept(1);
}
Expand Down
3 changes: 1 addition & 2 deletions report/src/main/webapp/app/services/patterns.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ define(['angularAMD', 'metadataService', 'metadataAccessService'],

if (isCollectorWithPattern(step) && isStepComparatorRebaseable(
comparator)) {
result = comparator.stepResult.previousStatus === 'FAILED';
if (result) {
if (comparator.stepResult.wasAcceptable) {
step.revertPatternStatistics();
step.pattern = step.oldPattern;
delete step.oldPattern;
Expand Down

0 comments on commit 271dc56

Please sign in to comment.