Skip to content

Commit

Permalink
Add assertions checks for may assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Clue committed Nov 15, 2023
1 parent 11d5490 commit 91a08b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '../../../resources/aria-at-test-io-format.mjs';
import { TestWindow } from '../../../resources/aria-at-test-window.mjs';
import { evaluateAtNameKey } from '../../../utils/aria.js';
import commandsJson from '../../../resources/commands.json';

const Container = styled.div`
padding: 20px;
Expand Down Expand Up @@ -78,6 +79,7 @@ const InstructionsRenderer = ({ testResult, testPageUrl, at }) => {
const testRunIO = new TestRunInputOutput();
const configQueryParams = [['at', evaluateAtNameKey(at.name)]];

testRunIO.setAllCommandsInputFromJSON(commandsJson);
await testRunIO.setInputsFromCollectedTestAsync(renderableContent);
testRunIO.setConfigInputFromQueryParamsAndSupport(configQueryParams);

Expand Down
19 changes: 19 additions & 0 deletions server/util/getMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ const getMetrics = ({
});
const optionalAssertionsFailedCount =
optionalAssertionsCount - optionalAssertionsPassedCount;
const mayAssertionsPassedCount = countAssertions({
...result,
priority: 'MAY',
passedOnly: true
});
const mayAssertionsCount = countAssertions({
...result,
priority: 'MAY'
});
const mayAssertionsFailedCount =
mayAssertionsCount - mayAssertionsPassedCount;

const testsPassedCount = countTests({
...result,
Expand All @@ -121,6 +132,10 @@ const getMetrics = ({
optionalAssertionsCount === 0
? false
: `${optionalAssertionsPassedCount} of ${optionalAssertionsCount} passed`;
const mayFormatted =
mayAssertionsCount === 0
? false
: `${mayAssertionsPassedCount} of ${mayAssertionsCount} passed`;

const unexpectedBehaviorCount = countUnexpectedBehaviors({ ...result });
const unexpectedBehaviorsFormatted =
Expand Down Expand Up @@ -148,12 +163,16 @@ const getMetrics = ({
optionalAssertionsPassedCount,
optionalAssertionsCount,
optionalAssertionsFailedCount,
mayAssertionsPassedCount,
mayAssertionsCount,
mayAssertionsFailedCount,
testsPassedCount,
testsCount,
testsFailedCount,
unexpectedBehaviorCount,
requiredFormatted,
optionalFormatted,
mayFormatted,
unexpectedBehaviorsFormatted,
supportLevel,
supportPercent
Expand Down

0 comments on commit 91a08b5

Please sign in to comment.