The balancer continually updates the config server. The interval used by the balancer needs to be taken in account when choosing an appropriate readConcern timeout for the test.
To reproduce, change the maxTimeMS in this line from 5000 ms to some value larger than the ping interval (10 secs):
var runFindCommand = function(ts) { return primaryConn.getDB('local').runCommand({ find: 'oplog.rs', readConcern: { afterOpTime: { ts: ts, t: term, }, }, maxTimeMS: 5000, <- change to 20000 }); };