mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Fix flaky tests
Summary: The Ace autocomplete sometimes doesn't appear if keys are entered too quickly. A larger fixture document (World) used in the Importer2 tests sometimes takes longer than 5 seconds to import. Test Plan: N/A Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4245
This commit is contained in:
parent
3aeff3c547
commit
6337eeb54f
@ -19,6 +19,7 @@ describe('DropdownConditionEditor', function () {
|
||||
await gu.getCell(1, 1).click();
|
||||
assert.isFalse(await driver.find('.test-field-dropdown-condition').isPresent());
|
||||
await driver.find('.test-field-set-dropdown-condition').click();
|
||||
await gu.waitAppFocus(false);
|
||||
await gu.sendKeys('c');
|
||||
await gu.waitToPass(async () => {
|
||||
const completions = await driver.findAll('.ace_autocomplete .ace_line', el => el.getText());
|
||||
@ -29,7 +30,7 @@ describe('DropdownConditionEditor', function () {
|
||||
're\nc\n.Supervisor\n ',
|
||||
]);
|
||||
});
|
||||
await gu.sendKeys('hoice not in $');
|
||||
await gu.sendKeysSlowly(['hoice not in $']);
|
||||
await gu.waitToPass(async () => {
|
||||
const completions = await driver.findAll('.ace_autocomplete .ace_line', el => el.getText());
|
||||
assert.deepEqual(completions, [
|
||||
@ -144,7 +145,8 @@ describe('DropdownConditionEditor', function () {
|
||||
await gu.getCell(2, 1).click();
|
||||
assert.isFalse(await driver.find('.test-field-dropdown-condition').isPresent());
|
||||
await driver.find('.test-field-set-dropdown-condition').click();
|
||||
await gu.sendKeys('choice');
|
||||
await gu.waitAppFocus(false);
|
||||
await gu.sendKeysSlowly(['choice']);
|
||||
await gu.waitToPass(async () => {
|
||||
const completions = await driver.findAll('.ace_autocomplete .ace_line', el => el.getText());
|
||||
assert.deepEqual(completions, [
|
||||
|
@ -595,7 +595,7 @@ describe('Importer2', function() {
|
||||
|
||||
// Finish importing, and check that the destination tables have the correct data.
|
||||
await driver.find('.test-modal-confirm').click();
|
||||
await gu.waitForServer();
|
||||
await gu.waitForServer(10_000);
|
||||
assert.deepEqual(await gu.getPageNames(), [
|
||||
'Table1',
|
||||
'Table1',
|
||||
|
@ -1751,6 +1751,16 @@ export async function sendKeys(...keys: string[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Send keys with a pause between each key.
|
||||
*/
|
||||
export async function sendKeysSlowly(keys: string[], delayMs = 40) {
|
||||
for (const [i, key] of keys.entries()) {
|
||||
await sendKeys(key);
|
||||
if (i < keys.length - 1) { await driver.sleep(delayMs); }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears active input/textarea.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user