@@ -95,7 +95,7 @@ export async function driverTeardown() {
9595export async function testSetup (
9696 playgroundUrl : string ,
9797) : Promise < webdriverio . Browser > {
98- if ( ! driver ) {
98+ if ( ! driver ) {
9999 driver = await driverSetup ( ) ;
100100 }
101101 await driver . url ( playgroundUrl ) ;
@@ -232,6 +232,8 @@ export async function currentFocusIsMainWorkspace(
232232/**
233233 * Focuses and selects a block with the provided ID.
234234 *
235+ * This throws an error if no block exists for the specified ID.
236+ *
235237 * @param browser The active WebdriverIO Browser object.
236238 * @param blockId The ID of the block to select.
237239 */
@@ -250,6 +252,9 @@ export async function focusOnBlock(
250252/**
251253 * Focuses and selects the field of a block given a block ID and field name.
252254 *
255+ * This throws an error if no block exists for the specified ID, or if the block
256+ * corresponding to the specified ID has no field with the provided name.
257+ *
253258 * @param browser The active WebdriverIO Browser object.
254259 * @param blockId The ID of the block to select.
255260 * @param fieldName The name of the field on the block to select.
@@ -415,30 +420,69 @@ export async function tabNavigateForward(browser: WebdriverIO.Browser) {
415420 await browser . pause ( PAUSE_TIME ) ;
416421}
417422
423+ /**
424+ * Navigates backward to the test page's previous tab stop.
425+ *
426+ * @param browser The active WebdriverIO Browser object.
427+ */
418428export async function tabNavigateBackward ( browser : WebdriverIO . Browser ) {
419429 await browser . keys ( [ webdriverio . Key . Shift , webdriverio . Key . Tab ] ) ;
420430 await browser . pause ( PAUSE_TIME ) ;
421431}
422432
423- export async function keyLeft ( browser : WebdriverIO . Browser , times : number = 1 ) {
433+ /**
434+ * Sends the keyboard event for arrow key left.
435+ *
436+ * @param browser The active WebdriverIO Browser object.
437+ * @param times The number of times to repeat the key press (default is 1).
438+ */
439+ export async function keyLeft ( browser : WebdriverIO . Browser , times = 1 ) {
424440 await sendKeyAndWait ( browser , webdriverio . Key . ArrowLeft , times ) ;
425441}
426442
427- export async function keyRight (
428- browser : WebdriverIO . Browser , times : number = 1 ) {
443+ /**
444+ * Sends the keyboard event for arrow key right.
445+ *
446+ * @param browser The active WebdriverIO Browser object.
447+ * @param times The number of times to repeat the key press (default is 1).
448+ */
449+ export async function keyRight ( browser : WebdriverIO . Browser , times = 1 ) {
429450 await sendKeyAndWait ( browser , webdriverio . Key . ArrowRight , times ) ;
430451}
431452
432- export async function keyUp ( browser : WebdriverIO . Browser , times : number = 1 ) {
453+ /**
454+ * Sends the keyboard event for arrow key up.
455+ *
456+ * @param browser The active WebdriverIO Browser object.
457+ * @param times The number of times to repeat the key press (default is 1).
458+ */
459+ export async function keyUp ( browser : WebdriverIO . Browser , times = 1 ) {
433460 await sendKeyAndWait ( browser , webdriverio . Key . ArrowUp , times ) ;
434461}
435462
436- export async function keyDown ( browser : WebdriverIO . Browser , times : number = 1 ) {
463+ /**
464+ * Sends the keyboard event for arrow key down.
465+ *
466+ * @param browser The active WebdriverIO Browser object.
467+ * @param times The number of times to repeat the key press (default is 1).
468+ */
469+ export async function keyDown ( browser : WebdriverIO . Browser , times = 1 ) {
437470 await sendKeyAndWait ( browser , webdriverio . Key . ArrowDown , times ) ;
438471}
439472
440- export async function sendKeyAndWait (
441- browser : WebdriverIO . Browser , key : string , times : number ) {
473+ /**
474+ * Sends the specified key for the specified number of times, waiting between
475+ * each key press to allow changes to keep up.
476+ *
477+ * @param browser The active WebdriverIO Browser object.
478+ * @param key The WebdriverIO representative key value to press.
479+ * @param times The number of times to repeat the key press.
480+ */
481+ async function sendKeyAndWait (
482+ browser : WebdriverIO . Browser ,
483+ key : string ,
484+ times : number ,
485+ ) {
442486 for ( let i = 0 ; i < times ; i ++ ) {
443487 await browser . keys ( key ) ;
444488 await browser . pause ( PAUSE_TIME ) ;
0 commit comments