Skip to content

Commit

Permalink
Merge branch 'main' into automation-mvp-rebase-attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
stalgiag committed Dec 13, 2023
2 parents 2e62661 + 8215cb9 commit 8ff6e6b
Show file tree
Hide file tree
Showing 99 changed files with 4,629 additions and 2,784 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/runtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
yarn sequelize:test db:seed:all
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_1}
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_2}
yarn workspace server db-import-tests:test
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_3}
yarn workspace server db-populate-sample-data:test
- name: test
run: yarn test
Expand Down
16 changes: 10 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ We want to make contributing to this project as approachable and transparent as
ARIA-AT App is maintained by [Bocoup](https://bocoup.com/) and designed and developed with the [W3C ARIA-AT Community Group](https://www.w3.org/community/aria-at/).

## Code of Conduct
This project is governed by the [Bocoup](https://github.com/w3c/aria-at-app/blob/develop/CODE_OF_CONDUCT.md) and [W3C](https://www.w3.org/Consortium/cepc/) Codes of Conduct
This project is governed by the [Bocoup](https://github.com/w3c/aria-at-app/blob/develop/CODE_OF_CONDUCT.md) and [W3C](https://www.w3.org/Consortium/cepc/) Codes of Conduct.

## Development Process
We use GitHub to host code, track issues and feature requests, and accept pull requests.
Expand All @@ -16,10 +16,11 @@ If your issue relates to a specific ARIA-AT test plan or the behavior of the ARI
## Pull Requests
Pull requests are the best way to propose changes to the codebase. We use [GitHub Flow](https://guides.github.com/introduction/flow/index.html) as a development methodology.

If the pull request is not a bug fix, an implementation proposal should first be submitted via a new issue, in order to reach consensus with the maintainers on scope, technical approach, and design implications.
If the pull request is not a bug fix, an implementation proposal should first be submitted via a new issue, in order to reach consensus with the maintainers on scope, technical approach, and design implications.

Implementation proposals and pull requests that affect the overall design or user experience of the app may require a design review before implementation.

Pull requests should be small and granular, ideally addressing one issue or feature at a time. Try to keep each pull request independently mergeable. Multiple dependent PRs should only be used when absolutely necessary to land a longer term change.
Pull requests should be small and granular, ideally addressing one issue or feature at a time. Try to keep each pull request independently mergeable. Multiple dependent PRs should only be used when absolutely necessary to land a longer-term change.

In order to open a pull request:

Expand All @@ -30,11 +31,14 @@ In order to open a pull request:
1. If the pull request is not a bug fix, please link to the related implementation proposal and consensus issue.
1. Submit a pull request!

Maintainers with write access to the repository will create branches directly within the repository.

## Reviewing pull requests, merging, and deploying
All pull requests, including pull requests opened by maintainers, require code review from two maintainers before merging.

The second maintainer who reviews is responsible for merging the pull request into the protected `main` branch.

All pull requests require code review from a maintainer before merging.
Maintainers are responsible for merging pull requests into the protected `main` branch.
Maintainers will periodically deploy the `main` branch to the [staging environments](https://github.com/w3c/aria-at-app/wiki).

## License
When you submit code changes, your submissions are understood to be under the same [W3C Document License](https://github.com/w3c/aria-at-app/blob/main/LICENSE.md) that covers the project. Feel free to contact the maintainers if that's a concern.
When you submit code changes, your submissions are understood to be under the same [W3C Document License](https://github.com/w3c/aria-at-app/blob/main/LICENSE.md) that covers the project.
11 changes: 8 additions & 3 deletions client/components/App/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,14 @@ const App = () => {
<Nav.Link
as={Link}
to="/data-management"
aria-current={location.pathname.startsWith(
'/data-management'
)}
aria-current={
location.pathname.startsWith(
'/data-management'
) ||
location.pathname.startsWith(
'/test-review'
)
}
>
Data Management
</Nav.Link>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import nextId from 'react-id-generator';
import styled from '@emotion/styled';
import { Button } from 'react-bootstrap';
import { unescape } from 'lodash';
import { parseListContent } from '../../TestRenderer/utils';
import {
userCloseWindow,
userOpenWindow
Expand All @@ -13,14 +14,8 @@ import {
} from '../../../resources/aria-at-test-io-format.mjs';
import { TestWindow } from '../../../resources/aria-at-test-window.mjs';
import { evaluateAtNameKey } from '../../../utils/aria.js';

const Container = styled.div`
padding: 20px;
`;

const Heading = styled.h2`
margin: 0 0 0.5em 0;
`;
import commandsJson from '../../../resources/commands.json';
import supportJson from '../../../resources/support.json';

const NumberedList = styled.ol`
counter-reset: numbered-list;
Expand Down Expand Up @@ -49,21 +44,16 @@ const NumberedList = styled.ol`
}
`;

const BulletList = styled.ul`
padding-inline-start: 2.5rem;
list-style-type: circle;
> li {
display: list-item;
list-style: circle;
}
`;

const InstructionsRenderer = ({ testResult, testPageUrl, at }) => {
const { test = {} } = testResult;
const InstructionsRenderer = ({
test,
testPageUrl,
at,
headingLevel = 2,
testFormatVersion
}) => {
const { renderableContent } = test;
const [testRunExport, setTestRunExport] = useState();
const [instructionsContent, setInstructionsContent] = useState({
const [pageContent, setPageContent] = useState({
instructions: {
assertions: { assertions: [] },
instructions: {
Expand All @@ -78,6 +68,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 Expand Up @@ -123,117 +114,81 @@ const InstructionsRenderer = ({ testResult, testPageUrl, at }) => {

useEffect(() => {
if (testRunExport) {
setInstructionsContent(testRunExport.instructions());
setPageContent(testRunExport.instructions());
}
}, [testRunExport]);

const parseRichContent = (instruction = []) => {
let content = null;
for (let value of instruction) {
if (typeof value === 'string') {
if (value === '.')
content = (
<>
{content}
{value}
</>
);
else
content = content = (
<>
{content} {value}
</>
);
} else if ('href' in value) {
const { href, description } = value;
content = (
<>
{content} <a href={href}>{description}</a>
</>
);
}
}
return content;
};

const parseListContent = (instructions = [], commandsContent = null) => {
return instructions.map((value, index) => {
if (typeof value === 'string')
return (
<li key={nextId()}>
{value}
{commandsContent &&
index === instructions.length - 1 && (
<BulletList>{commandsContent}</BulletList>
)}
</li>
);
else if (Array.isArray(value))
return (
<li key={nextId()}>
{parseRichContent(value)}
{commandsContent &&
index === instructions.length - 1 && (
<BulletList>{commandsContent}</BulletList>
)}
</li>
);
});
};

const allInstructions = [
...instructionsContent.instructions.instructions.instructions,
...instructionsContent.instructions.instructions.strongInstructions,
instructionsContent.instructions.instructions.commands.description
];

const commands =
instructionsContent.instructions.instructions.commands.commands;
let allInstructions;
const isV2 = testFormatVersion === 2;

if (isV2) {
const commandSettingSpecified = renderableContent.commands.some(
({ settings }) => settings && settings !== 'defaultMode'
);

const defaultInstructions =
renderableContent.target.at.raw
.defaultConfigurationInstructionsHTML;
const setupScriptDescription = `${supportJson.testPlanStrings.openExampleInstruction} ${renderableContent.target.setupScript.scriptDescription}`;
const testInstructions = renderableContent.instructions.instructions;
const settingsInstructions = `${
supportJson.testPlanStrings.commandListPreface
}${
commandSettingSpecified
? ` ${supportJson.testPlanStrings.commandListSettingsPreface}`
: ''
}`;

allInstructions = [
defaultInstructions,
setupScriptDescription + '.',
testInstructions + ' ' + settingsInstructions
].map(e => unescape(e));
} else {
allInstructions = [
...pageContent.instructions.instructions.instructions,
...pageContent.instructions.instructions.strongInstructions,
pageContent.instructions.instructions.commands.description
];
}

const commands = pageContent.instructions.instructions.commands.commands;
const commandsContent = parseListContent(commands);

const allInstructionsContent = parseListContent(
allInstructions,
commandsContent
);

const assertions = [
...instructionsContent.instructions.assertions.assertions
];

const assertions = [...pageContent.instructions.assertions.assertions];
const assertionsContent = parseListContent(assertions);

const Heading = `h${headingLevel}`;

return (
<Container>
<p>{instructionsContent.instructions.description}</p>
<Heading>
{instructionsContent.instructions.instructions.header}
</Heading>
<>
<NumberedList>{allInstructionsContent}</NumberedList>
<Heading>
{instructionsContent.instructions.assertions.header}
</Heading>
{instructionsContent.instructions.assertions.description}
<Heading>{pageContent.instructions.assertions.header}</Heading>
{pageContent.instructions.assertions.description}
<NumberedList>{assertionsContent}</NumberedList>
<Button
disabled={
!instructionsContent.instructions.openTestPage.enabled
}
onClick={instructionsContent.instructions.openTestPage.click}
disabled={!pageContent.instructions.openTestPage.enabled}
onClick={pageContent.instructions.openTestPage.click}
>
{instructionsContent.instructions.openTestPage.button}
{pageContent.instructions.openTestPage.button}
</Button>
</Container>
</>
);
};

InstructionsRenderer.propTypes = {
testResult: PropTypes.shape({
test: PropTypes.object.isRequired
}),
test: PropTypes.object.isRequired,
testPageUrl: PropTypes.string,
at: PropTypes.shape({
name: PropTypes.string.isRequired
})
}),
testFormatVersion: PropTypes.number,
headingLevel: PropTypes.number
};

export default InstructionsRenderer;
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,11 @@ const CandidateTestPlanRun = () => {
<InstructionsRenderer
key={`instructions-${currentTest.id}`}
at={testPlanReport.at}
testResult={{
scenarioResults: {},
test: currentTest,
completedAt: new Date()
}}
test={currentTest}
testPageUrl={testPlanReport.testPlanVersion.testPageUrl}
testFormatVersion={
testPlanVersion.metadata.testFormatVersion
}
/>,
...testPlanReports.map(testPlanReport => {
const testResult =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const CANDIDATE_REPORTS_QUERY = gql`
testPlanVersionPhases: [CANDIDATE]
testPlanVersionId: $testPlanVersionId
testPlanVersionIds: $testPlanVersionIds
isFinal: true
) {
id
vendorReviewStatus
Expand Down Expand Up @@ -113,7 +114,6 @@ export const CANDIDATE_REPORTS_QUERY = gql`
text
}
passed
failedReason
}
requiredAssertionResults: assertionResults(
priority: REQUIRED
Expand All @@ -122,7 +122,6 @@ export const CANDIDATE_REPORTS_QUERY = gql`
text
}
passed
failedReason
}
optionalAssertionResults: assertionResults(
priority: OPTIONAL
Expand All @@ -131,7 +130,12 @@ export const CANDIDATE_REPORTS_QUERY = gql`
text
}
passed
failedReason
}
mayAssertionResults: assertionResults(priority: MAY) {
assertion {
text
}
passed
}
unexpectedBehaviors {
id
Expand Down
Loading

0 comments on commit 8ff6e6b

Please sign in to comment.