Skip to content

Commit c98b0c4

Browse files
authored
[App] Fix e2e tests (#16146)
1 parent bf8e568 commit c98b0c4

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

src/lightning_app/testing/testing.py

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -386,34 +386,24 @@ def run_app_in_cloud(
386386
process = Process(target=_print_logs, kwargs={"app_id": app_id})
387387
process.start()
388388

389-
if not app.spec.is_headless:
390-
while True:
391-
try:
392-
with admin_page.context.expect_page() as page_catcher:
393-
admin_page.locator('[data-cy="open"]').click()
394-
view_page = page_catcher.value
395-
view_page.wait_for_load_state(timeout=0)
396-
break
397-
except (playwright._impl._api_types.Error, playwright._impl._api_types.TimeoutError):
398-
pass
399-
else:
400-
view_page = None
401-
402-
# Wait until the app is running
403-
while True:
404-
sleep(1)
405-
406-
lit_apps = [
407-
app
408-
for app in client.lightningapp_instance_service_list_lightningapp_instances(
409-
project_id=project.project_id
410-
).lightningapps
411-
if app.name == name
412-
]
413-
app = lit_apps[0]
414-
415-
if app.status.phase == V1LightningappInstanceState.RUNNING:
416-
break
389+
# Wait until the app is running
390+
while True:
391+
sleep(1)
392+
393+
lit_apps = [
394+
app
395+
for app in client.lightningapp_instance_service_list_lightningapp_instances(
396+
project_id=project.project_id
397+
).lightningapps
398+
if app.name == name
399+
]
400+
app = lit_apps[0]
401+
402+
if app.status.phase == V1LightningappInstanceState.RUNNING:
403+
break
404+
405+
view_page = context.new_page()
406+
view_page.goto(f"{app.status.url}/view")
417407

418408
# TODO: is re-creating this redundant?
419409
lit_apps = [

0 commit comments

Comments
 (0)