Polishing e2e test API. Added option to parse links and extract parameters from them. Added option to construct parameterizedlinks in "navigate".
This commit is contained in:
parent
328034bae0
commit
ccd37ac792
12 changed files with 308 additions and 147 deletions
35
test/e2e/helpers/semaphore.js
Normal file
35
test/e2e/helpers/semaphore.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
class Semaphore {
|
||||
constructor() {
|
||||
this.counter = 0;
|
||||
}
|
||||
|
||||
enter() {
|
||||
this.counter++;
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.counter--;
|
||||
}
|
||||
|
||||
async waitForEmpty() {
|
||||
const self = this;
|
||||
|
||||
function wait(resolve) {
|
||||
if (self.counter == 0) {
|
||||
resolve();
|
||||
} else {
|
||||
setTimeout(wait, 500, resolve);
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise(resolve => {
|
||||
setTimeout(wait, 500, resolve);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Semaphore;
|
Loading…
Add table
Add a link
Reference in a new issue