Skip to content

Commit

Permalink
feat: permit automated testing for firefox and chrome with voiceover (#…
Browse files Browse the repository at this point in the history
…1170)

* permit firefox and chrome with voiceover

* add test ids for run automation modal buttons

* add button click
  • Loading branch information
outofambit authored Jul 25, 2024
1 parent e4242bc commit 9c73ab5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
6 changes: 4 additions & 2 deletions client/components/AddTestToQueueWithConfirmation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ function AddTestToQueueWithConfirmation({
} catch (e) {
console.error(e);
}
}
},
testId: 'add-run-later'
});

if (!alreadyHasBotInTestPlanReport) {
Expand All @@ -186,7 +187,8 @@ function AddTestToQueueWithConfirmation({
} catch (e) {
console.error(e);
}
}
},
testId: 'add-run-bot'
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions client/components/common/BasicModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const BasicModal = ({
variant={action.variant ?? 'primary'}
onClick={action.onClick}
className={action.className ?? ''}
data-testid={action.testId ?? ''}
>
{action.label ?? 'Continue'}
</Button>
Expand Down Expand Up @@ -138,6 +139,7 @@ BasicModal.propTypes = {
onClick: PropTypes.func,
variant: PropTypes.string,
className: PropTypes.string,
testId: PropTypes.string,
component: PropTypes.elementType,
props: PropTypes.object
})
Expand Down
1 change: 1 addition & 0 deletions client/tests/AddTestToQueueWithConfirmation.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ describe('AddTestToQueueWithConfirmation', () => {

test('calls mutation on button click with correct variables', async () => {
fireEvent.click(getByTestId('add-button'));
fireEvent.click(await getByTestId('add-run-later'));

await waitFor(() => {
expect(mutationMock).toHaveBeenCalled();
Expand Down
16 changes: 12 additions & 4 deletions client/utils/automation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ export const isSupportedByResponseCollector = ctx => {
// Check if the AT and browser are supported by the automation
const isNvdaWithSupportedBrowser =
atKey === 'nvda' && (browserKey === 'chrome' || browserKey === 'firefox');
const isVoiceOverMacWithSafari =
atKey === 'voiceover_macos' && browserKey === 'safari_macos';
const isVoiceOverMacWithSupportedBrowser =
atKey === 'voiceover_macos' &&
(browserKey === 'safari_macos' ||
browserKey === 'chrome' ||
browserKey === 'firefox');

if (!isNvdaWithSupportedBrowser && !isVoiceOverMacWithSafari) {
if (!isNvdaWithSupportedBrowser && !isVoiceOverMacWithSupportedBrowser) {
return false;
}

Expand Down Expand Up @@ -89,7 +92,12 @@ export const getBotUsernameFromAtBrowser = (at, browser) => {
) {
return 'NVDA Bot';
}
if (at?.key === 'voiceover_macos' && browser?.key === 'safari_macos') {
if (
at?.key === 'voiceover_macos' &&
(browser?.key === 'safari_macos' ||
browser?.key === 'chrome' ||
browser?.key === 'firefox')
) {
return 'VoiceOver Bot';
}
};
1 change: 1 addition & 0 deletions server/services/GithubWorkflowService.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const createGithubWorkflow = async ({ job, directory, gitSha, atVersion }) => {
// due to limitations on Github workflow runners
// See https://github.com/w3c/aria-at-app/issues/1143 for more info
inputs.macos_version = atVersion?.name?.split('.')[0];
inputs.browser = browser;
}
const axiosConfig = {
method: 'POST',
Expand Down

0 comments on commit 9c73ab5

Please sign in to comment.