Skip to content

Commit 9cac01e

Browse files
authored
Merge pull request #2206 from cardstack/matrix-helpers-for-loop
Use a for loop instead of map with async in matrix helper
2 parents ac40301 + c7bee91 commit 9cac01e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/matrix/helpers/index.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,8 @@ export async function openAiAssistant(page: Page) {
7777
document.querySelector('[data-test-close-ai-assistant]'),
7878
);
7979

80-
await page.waitForFunction(
81-
() =>
82-
document
83-
.querySelector('[data-test-room]')
84-
?.getAttribute('data-test-room'),
80+
await page.waitForFunction(() =>
81+
document.querySelector('[data-test-room]')?.getAttribute('data-test-room'),
8582
); // Opening the AI assistant either opens last room or creates one - wait for it to settle
8683
}
8784

@@ -492,7 +489,7 @@ export async function assertMessages(
492489
`[data-test-message-idx="${index}"] [data-test-attached-card]`,
493490
),
494491
).toHaveCount(cards.length);
495-
cards.map(async (card) => {
492+
for (let card of cards) {
496493
if (card.title) {
497494
if (message != null && card.title.includes(message)) {
498495
throw new Error(
@@ -514,7 +511,7 @@ export async function assertMessages(
514511
),
515512
).toHaveCount(1);
516513
}
517-
});
514+
}
518515
}
519516

520517
if (files?.length) {
@@ -524,13 +521,16 @@ export async function assertMessages(
524521
),
525522
).toHaveCount(1);
526523
await expect(
527-
page.locator(`[data-test-message-idx="${index}"] [data-test-attached-file]`)).toHaveCount(files.length)
524+
page.locator(
525+
`[data-test-message-idx="${index}"] [data-test-attached-file]`,
526+
),
527+
).toHaveCount(files.length);
528528
files.map(async (file) => {
529-
await expect(
530-
page.locator(
531-
`[data-test-message-idx="${index}"] [data-test-attached-file="${file.sourceUrl}"]`,
532-
),
533-
).toContainText(file.name);
529+
await expect(
530+
page.locator(
531+
`[data-test-message-idx="${index}"] [data-test-attached-file="${file.sourceUrl}"]`,
532+
),
533+
).toContainText(file.name);
534534
});
535535
}
536536

0 commit comments

Comments
 (0)