From 2497d0d8a16fff3fb0accb52ca25e737cff16553 Mon Sep 17 00:00:00 2001 From: trevor-signal <131492920+trevor-signal@users.noreply.github.com> Date: Mon, 8 Apr 2024 12:58:08 -0400 Subject: [PATCH] Update mock tests to use locator.fill instead of .type --- ts/test-mock/helpers.ts | 8 +++++--- ts/test-mock/storage/message_request_test.ts | 6 +----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ts/test-mock/helpers.ts b/ts/test-mock/helpers.ts index 42f322ef37..408f628682 100644 --- a/ts/test-mock/helpers.ts +++ b/ts/test-mock/helpers.ts @@ -32,14 +32,16 @@ export async function typeIntoInput( currentValue = (await input.textContent()) ?? ''; } - await input.type(text, { delay: 30 }); + const newValue = `${currentValue}${text}`; + + await input.fill(newValue); // Wait to ensure that the input (and react state controlling it) has actually // updated with the right value if (isInputElement) { - await expect(input).toHaveValue(`${currentValue}${text}`); + await expect(input).toHaveValue(newValue); } else { - await input.locator(`:text("${currentValue}${text}")`).waitFor(); + await input.locator(`:text("${newValue}")`).waitFor(); } } diff --git a/ts/test-mock/storage/message_request_test.ts b/ts/test-mock/storage/message_request_test.ts index 1e348902f8..e9a303a4d8 100644 --- a/ts/test-mock/storage/message_request_test.ts +++ b/ts/test-mock/storage/message_request_test.ts @@ -117,11 +117,7 @@ describe('storage service', function (this: Mocha.Suite) { } debug('Enter message text'); - const composeArea = window.locator( - '.composition-area-wrapper, .Inbox__conversation .ConversationView' - ); - const input = composeArea.locator('[data-testid=CompositionInput]'); - + const input = await app.waitForEnabledComposer(); await typeIntoInput(input, 'hello stranger!'); await input.press('Enter');