Skip to content

Commit

Permalink
Use assertion phrase in test result table (#1061)
Browse files Browse the repository at this point in the history
* Add phrase to graphql schema

* Add phrase field for assertions table

* Add fields to excludedTypeNameAndField array

* Fix failing test

* Remove console log

* Remove duplicate query and fix casing

---------

Co-authored-by: Howard Edwards <[email protected]>
  • Loading branch information
Paul-Clue and howard-e authored May 2, 2024
1 parent 3edc15e commit cab502d
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,28 @@ export const CANDIDATE_REPORTS_QUERY = gql`
id
assertion {
text
phrase
}
passed
}
mustAssertionResults: assertionResults(priority: MUST) {
assertion {
text
phrase
}
passed
}
shouldAssertionResults: assertionResults(priority: SHOULD) {
assertion {
text
phrase
}
passed
}
mayAssertionResults: assertionResults(priority: MAY) {
assertion {
text
phrase
}
passed
}
Expand Down
4 changes: 4 additions & 0 deletions client/components/Reports/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ export const REPORT_PAGE_QUERY = gql`
id
assertion {
text
phrase
}
passed
}
mustAssertionResults: assertionResults(priority: MUST) {
assertion {
text
phrase
}
passed
}
Expand All @@ -92,12 +94,14 @@ export const REPORT_PAGE_QUERY = gql`
) {
assertion {
text
phrase
}
passed
}
mayAssertionResults: assertionResults(priority: MAY) {
assertion {
text
phrase
}
passed
}
Expand Down
24 changes: 24 additions & 0 deletions client/components/TestRun/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,28 @@ export const TEST_RUN_PAGE_QUERY = gql`
id
assertion {
text
phrase
}
passed
}
mustAssertionResults: assertionResults(priority: MUST) {
assertion {
text
phrase
}
passed
}
shouldAssertionResults: assertionResults(priority: SHOULD) {
assertion {
text
phrase
}
passed
}
mayAssertionResults: assertionResults(priority: MAY) {
assertion {
text
phrase
}
passed
}
Expand Down Expand Up @@ -88,6 +92,7 @@ export const TEST_RUN_PAGE_QUERY = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -198,6 +203,7 @@ export const TEST_RUN_PAGE_ANON_QUERY = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -323,6 +329,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
id
assertion {
text
phrase
}
passed
}
Expand All @@ -331,6 +338,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -339,6 +347,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -347,6 +356,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand Down Expand Up @@ -384,6 +394,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -480,6 +491,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -609,6 +621,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
id
assertion {
text
phrase
}
passed
}
Expand All @@ -617,6 +630,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -625,6 +639,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -633,6 +648,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand Down Expand Up @@ -670,6 +686,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -766,6 +783,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -895,6 +913,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
id
assertion {
text
phrase
}
passed
}
Expand All @@ -903,6 +922,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -911,6 +931,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -919,6 +940,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand Down Expand Up @@ -956,6 +978,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -1052,6 +1075,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down
8 changes: 7 additions & 1 deletion client/components/common/TestPlanResultsTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ const renderAssertionRow = (assertionResult, priorityString) => {
return (
<tr key={`${assertionResult.id}__${nextId()}`}>
<td>{priorityString}</td>
<td>{assertionResult.assertion.text}</td>
<td>
{assertionResult.assertion.phrase
? assertionResult.assertion.phrase.charAt(0).toUpperCase() +
assertionResult.assertion.phrase.slice(1)
: assertionResult.assertion.text.charAt(0).toUpperCase() +
assertionResult.assertion.text.slice(1)}
</td>
<td>{assertionResult.passed ? 'Passed' : 'Failed'}</td>
</tr>
);
Expand Down
13 changes: 10 additions & 3 deletions server/graphql-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,19 @@ const graphqlSchema = gql`
Whether this assertion contributes to the test failing or not.
"""
priority: AssertionPriority!
# TODO: consider adding a automatedAssertion field which uses regex or
# similar to automatically determine pass or fail.
"""
A human-readable version of the assertion.
A human-readable version of the assertion, like "Role 'radio button' is
conveyed".
"""
text: String!
"""
For TestPlanVersions that use the V2 test format, this field contains
text like "convey role 'radio button'".
See the link for more information:
https://github.com/w3c/aria-at/wiki/Test-Format-Definition-V2#assertionphrase
"""
phrase: String
}
"""
Expand Down
3 changes: 2 additions & 1 deletion server/models/services/TestsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ const getTests = parentRecord => {
}),
assertions: test.assertions.map(assertion => ({
...assertion,
text: isV2 ? assertion.assertionStatement : assertion.text
text: isV2 ? assertion.assertionStatement : assertion.text,
phrase: isV2 ? assertion.assertionPhrase : null
}))
}));
};
Expand Down
16 changes: 16 additions & 0 deletions server/tests/integration/graphql.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,18 @@ describe('graphql', () => {
id
status
}
v2TestPlanVersion: testPlanVersion(id: 133) {
__typename
id
metadata
tests {
__typename
assertions {
__typename
phrase
}
}
}
testPlan(id: "checkbox") {
__typename
id
Expand Down Expand Up @@ -967,3 +979,7 @@ const getMutationInputs = async () => {
browserVersionId: browserVersion.id
};
};

/* Add the phrase to the assertion query. It will not work unless phrase is returned.
Find a test plan version that does have a phrase (V2).
*/

0 comments on commit cab502d

Please sign in to comment.