From 9928af68c740a8f6a7fef36bb77bc4a45050a176 Mon Sep 17 00:00:00 2001 From: Louis Bompart Date: Tue, 6 Feb 2024 16:27:13 -0500 Subject: [PATCH] wait for response instead of UI. https://coveord.atlassian.net/browse/CDX-1510 --- packages/cli-e2e/__tests__/atomic.specs.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/cli-e2e/__tests__/atomic.specs.ts b/packages/cli-e2e/__tests__/atomic.specs.ts index ce8c34fba3..2bfec0360a 100644 --- a/packages/cli-e2e/__tests__/atomic.specs.ts +++ b/packages/cli-e2e/__tests__/atomic.specs.ts @@ -1,7 +1,10 @@ import type {Browser, Page, HTTPResponse} from 'puppeteer'; import {captureScreenshots, getNewBrowser, openNewPage} from '../utils/browser'; import {answerPrompt, getProjectPath, setupUIProject} from '../utils/cli'; -import {isSuccessfulSearchResponse} from '../utils/platform'; +import { + isSearchRequestOrResponse, + isSuccessfulSearchResponse, +} from '../utils/platform'; import {ProcessManager} from '../utils/processManager'; import {Terminal} from '../utils/terminal/terminal'; import {BrowserConsoleInterceptor} from '../utils/browserConsoleInterceptor'; @@ -21,6 +24,7 @@ interface BuildAppOptions { describe('ui:create:atomic', () => { const searchPageEndpoint = 'http://localhost:3333'; const searchInterfaceSelector = 'atomic-search-interface'; + const atomicResult = 'atomic-result'; let normalizedProjectDir = ''; let originalProjectDir = ''; const normalizeProjectDirectory = (buildAppOptions: BuildAppOptions) => { @@ -330,8 +334,7 @@ describe('ui:create:atomic', () => { it('should send a search query when the page is loaded', async () => { await page.goto(searchPageEndpoint, {waitUntil: 'networkidle2'}); - await page.waitForSelector(searchInterfaceSelector); - + await page.waitForResponse(isSearchRequestOrResponse); expect( interceptedResponse.some(isSuccessfulSearchResponse) ).toBeTruthy();