Closed ephetic closed 5 years ago
Seeing test flakiness. Hold off on this for now.
Okay, it looks like running the jest tests in parallel upsets the express server (EADDRINUSE) such that the race causes one or both (?) servers to fail, failing those tests. This is how I've fixed it locally (with commensurate changes to the test files that call this helper)
export const startServer = function (buildDir, file) {
return new Promise((resolve, reject) => {
const app = express()
app.use('/build', express.static(path.join(__dirname, buildDir)))
app.get('/', (req, res) => {
res.status(200).sendFile(file, { root: __dirname })
})
let server
let port
const retry = (e) => {
if(e.code == 'EADDRINUSE') {
setTimeout(() => connect, 1000)
}
}
const connect = () => {
port = 0|(Math.random() * 1000) + 3000
server = app.listen(port)
server.once('error', retry)
server.once('listening', () => {
return resolve({server, port})
})
}
connect()
})
}
Hey @ephetic this looks great, I'll have time to look at it earliest somewhere next week. Sorry for the delay.
@ephetic LGTM I'm merging it and will push a point release.
Description
Updates use of @medv/finder to include
[data-qa="xxx"]
attributes throughout selector, not just on the clicked element. This maximizes the value of the custom attribute setting. See issue #52.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
A test has been created that shows clicking on a descendent
span
records a selector likeExisting tests unaffected.
Checklist:
npm run lint
passes with no errors.npm run test
passes with no errors.