This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mergedResults.numFailedTestSuites = newResults.numFailedTestSuites; | |
mergedResults.numFailedTests = newResults.numFailedTests; | |
mergedResults.numPassedTestSuites = oldResults.numPassedTestSuites + newResults.numPassedTestSuites; | |
mergedResults.numPassedTests = oldResults.numPassedTests + newResults.numPassedTests; | |
mergedResults.success = newResults.success; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function runTestsAndRetry(jestConfig, retriesRemaining, mergedResults) { | |
const { results } = await runCLI(jestConfig, ['e2e/test']); | |
mergedResults = mergeTestResults(mergedResults, results); | |
// configure jest-junit for our test run | |
const junit = new JestJunit( | |
{}, | |
{ | |
outputDirectory: './test-results/', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"test-with-retries": "node run_tests_with_retries.js" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run_tests_with_retries.js | |
import { runCLI } from 'jest'; | |
import jestConfig from './jest.config'; | |
const NUM_RETRIES = 3; | |
async function runTestsAndRetry(jestConfig, retriesRemaining) { | |
const { results } = await runCLI(jestConfig, ['e2e/test']); | |
// If there were no failures or we're out of retries, return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe(‘my e2e test’, () => { | |
// some initial steps | |
it(‘fills out a form and navigates to the next step’, () => { … }); | |
// more testing | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sr-only { | |
position: absolute; | |
width: 1px; | |
height: 1px; | |
margin: -1px; | |
padding: 0; | |
overflow: hidden; | |
clip: rect(0, 0, 0, 0); | |
border: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ExpandedClickableArea(props) { | |
const clickableElemTypes = ['a', 'button', 'input']; | |
const refExpandedArea = useRef(); | |
function handleClick(e) { | |
const clickableElems = [ | |
...refExpandedArea.current.querySelectorAll('[data-expand-click-area]') | |
]; | |
if (clickableElems.length !== 1) { | |
throw new Error( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ClickableContainer(props) { | |
// ideally these are stored in a separate key mapping utility file | |
const enterKey = 13; | |
const spaceKey = 32; | |
const { children, ariaLabel, ...otherProps } = props; | |
function handleKeyDown(e) { | |
if (e.keyCode === enterKey || e.keyCode === spaceKey) { | |
e.preventDefault(); | |
props.onClick(e); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AccountCard(props) { | |
function handleClick(e) { | |
redirect(‘account’, props.account.accountId) | |
} | |
return ( | |
<div onClick={handleClick}> | |
// account card content | |
</div> | |
); |