-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove all instances of REQUIRED and OPTIONAL #938
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Paul-Clue thanks for taking this first step to update the repository to be consistent with the new language!
I think the key thing that may be missing here though is that a database migration is needed to update the older TestPlanVersion.tests[].assertions[].priority
which still use REQUIRED and OPTIONAL as well.
@@ -1455,7 +1455,7 @@ export class TestRunInputOutput { | |||
output: command.atOutput.value, | |||
assertionResults: command.assertions.map(assertion => ({ | |||
assertion: { | |||
priority: assertion.priority === 1 ? 'REQUIRED' : 'OPTIONAL', | |||
priority: assertion.priority === 1 ? 'MUST' : 'SHOULD', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes that happen to files inside client/resources/*
should also have an equivalent PR making that change in w3c/aria-at
(until we get to optimizing the import process to eliminate this need)
@@ -1642,7 +1642,7 @@ const UnexpectedBehaviorImpactMap = createEnumMap({ | |||
/** | |||
* Command result derived from priority 1 and 2 assertions. | |||
* | |||
* Support is "FAILING" is priority 1 assertions fail. Support is "ALL REQUIRED" | |||
* Support is "FAILING" is priority 1 assertions fail. Support is "ALL MUST" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this has to be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. If you do change it, make sure to look at server/util/getMetrics.js which still uses the term "All Required." Probably better to just leave it as-is.
@@ -1653,7 +1653,7 @@ const UnexpectedBehaviorImpactMap = createEnumMap({ | |||
const CommandSupportJSONMap = createEnumMap({ | |||
FULL: 'FULL', | |||
FAILING: 'FAILING', | |||
ALL_REQUIRED: 'ALL REQUIRED', | |||
ALL_REQUIRED: 'ALL MUST', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this, but if it were to change, the enum name may as well be changed too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur with Howard that the main missing thing is the migration. Once that's done I'll run the changes and see if I can find any issues. As for the code, it looks good, not much to add to Howard's review.
@@ -8,14 +8,13 @@ | |||
* @returns {null|string} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO can be removed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1642,7 +1642,7 @@ const UnexpectedBehaviorImpactMap = createEnumMap({ | |||
/** | |||
* Command result derived from priority 1 and 2 assertions. | |||
* | |||
* Support is "FAILING" is priority 1 assertions fail. Support is "ALL REQUIRED" | |||
* Support is "FAILING" is priority 1 assertions fail. Support is "ALL MUST" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. If you do change it, make sure to look at server/util/getMetrics.js which still uses the term "All Required." Probably better to just leave it as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Paul-Clue looks good! There's an issue I found with the migration when testing against the current prod data and have suggested an inline fix.
Also, you can remove REQUIRED
and OPTIONAL
for the AssertionPriority
enum in graphql-schema.js
EXISTS ( | ||
SELECT | ||
1 | ||
FROM | ||
jsonb_array_elements(tests) AS test, | ||
jsonb_array_elements(test -> 'assertions') AS assertion | ||
WHERE | ||
assertion ->> 'priority' = 'REQUIRED' | ||
OR assertion ->> 'priority' = 'OPTIONAL' | ||
)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXISTS ( | |
SELECT | |
1 | |
FROM | |
jsonb_array_elements(tests) AS test, | |
jsonb_array_elements(test -> 'assertions') AS assertion | |
WHERE | |
assertion ->> 'priority' = 'REQUIRED' | |
OR assertion ->> 'priority' = 'OPTIONAL' | |
)`, | |
id = ?`, |
The sequelize replacements
option is expecting an id
replacement which wasn't being used so I assume this must have been the thought. It's much safer to also make this update using the queried id
involved in the loop. Using the previous condition could have unexpected behaviors.
shared/convertAssertionPriority.js
Outdated
* | ||
* @param {number|string} priority | ||
* @returns {null|string} | ||
* @returns {null|string} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @returns {null|string} | |
* @returns {null|string} |
@Paul-Clue looks like the tests are failing, any idea about that? |
@@ -191,7 +191,7 @@ const getMetrics = ({ | |||
assertionsCount: requiredAssertionsCount, | |||
assertionsPassedCount: requiredAssertionsPassedCount, | |||
assertionsFailedCount: requiredAssertionsFailedCount | |||
} = calculateAssertionPriorityCounts(result, 'REQUIRED'); | |||
} = calculateAssertionPriorityCounts(result, 'MUST'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So with this change, because
aria-at-app/shared/getMetrics.js
Line 46 in 3808ed7
`${priority.toLowerCase()}AssertionResults` in scenarioResult; |
queries.js
files, it will incorrectly display total values anywhere TestPlanResultsTable
is getting used.
ie. queries.js
provides requiredAssertionResults
but this change to getMetrics
is expecting mustAssertionResults
.
The following screenshot also shows that for each command, there are 2+ assertions but the command's assertion level status only shows 2 passed
, which would then also affect the total calculation for the entire test:
2 things I think could happen here:
- Revert the change to
getMetrics
until updating each of the named(required|optional)AssertionResults
instances. But this may cause some confusion until then. - Update the named instances of
(required|optional)AssertionResults
as appropriate which means renaming the value being exported fromgetMetrics
and also adding a migration to update metrics across all the TestPlanReports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @howard-e all of the changes have been made and a migration created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thanks for going the route of no. 2 as well. Definitely makes things cleaner for the future!
shared/getMetrics.js
Outdated
@@ -219,11 +219,11 @@ const getMetrics = ({ | |||
testPlanReport?.runnableTests?.length || countTests({ ...result }); | |||
const testsFailedCount = testsCount - testsPassedCount; | |||
|
|||
const requiredFormatted = `${requiredAssertionsPassedCount} of ${requiredAssertionsCount} passed`; | |||
const requiredFormatted = `${mustAssertionsPassedCount} of ${mustAssertionsCount} passed`; | |||
const optionalFormatted = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think requiredFormatted
needs to be mustFormatted
and optionalFormatted
needs to be shouldFormatted
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok done!
@Paul-Clue fantastic work, I just have one comment. I verified everything else is working and once you address that I'll approve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your considerable persistence chasing down all the details needed to get this task done! 😜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to go after fixing my latest inline comment
optionalAssertionResults: assertionResults( | ||
priority: OPTIONAL | ||
) { | ||
mustAssertionResults: assertionResults(priority: SHOULD) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mustAssertionResults: assertionResults(priority: SHOULD) { | |
shouldAssertionResults: assertionResults(priority: SHOULD) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! Thanks @howard-e!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the continued changes to perfect and support this change @Paul-Clue!
See issue #926 |
see issue #868
This PR removes all instances of REQUIRED and OPTIONAL. These changes already exist in presentational components. This PR updates the references of those priority names in the code itself to lessen any confusion in the future.