Skip to content

Commit

Permalink
Merge 5267678 into 86d853f
Browse files Browse the repository at this point in the history
  • Loading branch information
hbenl authored Mar 15, 2024
2 parents 86d853f + 5267678 commit a3060ae
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/e2e-tests/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ export async function mapLocators<T>(
);
}

export async function getExpectedErrorDetails(page: Page) {
if (await page.locator('[data-test-id="ExpectedError"]').isVisible()) {
return await page.locator('[data-test-name="ErrorDetails"]').innerText();
}
return null;
}

export async function getSupportFormErrorDetails(page: Page) {
if (await page.locator('[data-test-id="UnexpectedErrorDetails"]').isVisible()) {
try {
Expand Down Expand Up @@ -120,14 +127,18 @@ export async function waitForRecordingToFinishIndexing(page: Page): Promise<void

const timelineCapsuleLocator = page.locator('[data-test-id="Timeline-Capsule"]');

let supportFormErrorDetails: string | null = null;
await waitFor(
async () => {
supportFormErrorDetails = await getSupportFormErrorDetails(page);
const supportFormErrorDetails = await getSupportFormErrorDetails(page);
if (supportFormErrorDetails) {
throw new UnrecoverableError(`Session failed: ${supportFormErrorDetails}`);
}

const expectedErrorDetails = await getExpectedErrorDetails(page);
if (expectedErrorDetails) {
throw new UnrecoverableError(`Session failed: ${expectedErrorDetails}`);
}

if (await timelineCapsuleLocator.isVisible()) {
expect(
await timelineCapsuleLocator.getAttribute("data-test-progress"),
Expand Down

0 comments on commit a3060ae

Please sign in to comment.