Skip to content

Commit bf44bca

Browse files
committed
(kb) update tests after keyboard region switching work
- two interactions now need the user to first press esc to get out of current focus before continuing (I'd say an acceptable change?) - sometimes when we want to return on the "app focus", it won't mean the clipboard element anymore
1 parent a216f1c commit bf44bca

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

test/nbrowser/AccessRules1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ describe('AccessRules1', function() {
451451
"Add Widget to Page",
452452
]);
453453
await driver.sendKeys(Key.ESCAPE);
454-
await gu.waitAppFocus();
454+
await gu.waitForFocus('body');
455455
});
456456

457457
it('should support dollar syntax in the editor', async function() {

test/nbrowser/RefTransforms.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ describe('RefTransforms', function() {
9191
await gu.waitForServer();
9292

9393
// Add some references to values in the same table.
94+
await gu.sendKeys(Key.ESCAPE); // First ESCAPE to get out of select focus.
9495
await gu.sendKeys(Key.ENTER, 'foo', Key.ENTER, 'bar', Key.ENTER, Key.ENTER);
9596
await gu.waitForServer();
9697

test/nbrowser/TokenField.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ describe('TokenField', function() {
9191
await gu.waitForServer();
9292

9393
// Add two films.
94+
await gu.sendKeys(Key.ESCAPE); // First ESCAPE to get out of select/panel focus.
9495
await gu.sendKeys(Key.ENTER);
9596
await gu.sendKeys('Toy', Key.ENTER);
9697
await gu.sendKeys('Alien', Key.ENTER);

test/nbrowser/gristUtils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,6 @@ export async function enterCell(...keys: string[]) {
795795
}
796796
await driver.sendKeys(...keys);
797797
await waitForServer(); // Wait for the value to be saved
798-
await waitAppFocus(); // Wait for the cell editor to be closed (maybe unnecessary)
799798
}
800799

801800
/**
@@ -1163,7 +1162,6 @@ export async function docMenuImport(filePath: string) {
11631162
});
11641163
}
11651164

1166-
11671165
/**
11681166
* Wait for the focus to return to the main application, i.e. the special .copypaste element that
11691167
* normally has it (as opposed to an open cell editor, or a focus in some input or menu). Specify
@@ -1173,6 +1171,13 @@ export async function waitAppFocus(yesNo: boolean = true): Promise<void> {
11731171
await driver.wait(async () => (await driver.find('.copypaste').hasFocus()) === yesNo, 5000);
11741172
}
11751173

1174+
/**
1175+
* Wait for the focus to be on the first element matching given selector.
1176+
*/
1177+
export async function waitForFocus(selector: string): Promise<void> {
1178+
await driver.wait(async () => (await driver.find(selector).hasFocus()), 1000);
1179+
}
1180+
11761181
export async function waitForLabelInput(): Promise<void> {
11771182
await driver.wait(async () => (await driver.findWait('.test-column-title-label', 100).hasFocus()), 300);
11781183
}

0 commit comments

Comments
 (0)