Skip to content

Commit

Permalink
wait for response instead of UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart committed Feb 6, 2024
1 parent 2519b50 commit 9928af6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/cli-e2e/__tests__/atomic.specs.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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) => {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 9928af6

Please sign in to comment.