Mailspring/spec_integration/helpers/client-actions.es6
Juan Tejada 6c7a162909 add(integration-test): Adds test for onboarding flow with Exchange
Summary:
- Make sure user can log in using exchange
- Adds some test helpers for the test
- Updates eslint.json and cleans up lint errors

Test Plan: - Integration Tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2346
2015-12-14 15:14:58 -08:00

20 lines
459 B
JavaScript

export const wait = (ms)=> {
return new Promise((resolve)=> {
setTimeout(()=> resolve(), ms);
});
};
export const clickRepeat = (client, selector, {times = 1, interval = 0} = {})=> {
if (times === 1) return client.click(selector);
const fn = (remaining)=> {
if (remaining > 0) {
return (
client.click(selector)
.then(()=> wait(interval))
.then(()=> fn(remaining - 1))
);
}
};
return fn(times);
};