Skip to content
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

Use assertion phrase in test result table #1061

Merged
merged 7 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
26 changes: 26 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,8 @@ export const TEST_RUN_PAGE_ANON_QUERY = gql`
assertion {
id
text
phrase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the query work if you delete the duplicate phrase?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Good catch!

phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -323,6 +330,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
id
assertion {
text
phrase
}
passed
}
Expand All @@ -331,6 +339,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -339,6 +348,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -347,6 +357,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand Down Expand Up @@ -384,6 +395,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -480,6 +492,7 @@ export const FIND_OR_CREATE_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -609,6 +622,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
id
assertion {
text
phrase
}
passed
}
Expand All @@ -617,6 +631,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -625,6 +640,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -633,6 +649,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand Down Expand Up @@ -670,6 +687,7 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -766,6 +784,8 @@ export const SAVE_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about the duplicate phrase.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got this one too!

phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -895,6 +915,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
id
assertion {
text
phrase
}
passed
}
Expand All @@ -903,6 +924,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -911,6 +933,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand All @@ -919,6 +942,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
) {
assertion {
text
phrase
}
passed
}
Expand Down Expand Up @@ -956,6 +980,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down Expand Up @@ -1052,6 +1077,7 @@ export const SUBMIT_TEST_RESULT_MUTATION = gql`
assertion {
id
text
phrase
}
}
conflictingResults {
Expand Down
5 changes: 4 additions & 1 deletion client/components/common/TestPlanResultsTable/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ const renderAssertionRow = (assertionResult, priorityString) => {
return (
<tr key={`${assertionResult.id}__${nextId()}`}>
<td>{priorityString}</td>
<td>{assertionResult.assertion.text}</td>
<td>
{assertionResult.assertion.phrase ??
assertionResult.assertion.text}
</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).
*/
Loading