Skip to content

Commit e8b0cef

Browse files
alecmerdlerlexierule
authored andcommitted
Fix button selector for Lightning app e2e tests (#13984)
(cherry picked from commit 332182d)
1 parent 48822c8 commit e8b0cef

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/lightning_app/testing/testing.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,20 @@ def run_app_in_cloud(app_folder: str, app_name: str = "app.py") -> Generator:
227227
[LIGHTNING_CLOUD_PROJECT_ID],
228228
)
229229
admin_page.goto(f"{Config.url}/{Config.username}/apps")
230+
231+
# Closing the Create Project dialog.
230232
try:
231-
# Closing the Create Project modal
232-
button = admin_page.locator('button:has-text("Cancel")')
233+
project_dialog = admin_page.locator("text=Create a project")
234+
project_dialog.wait_for(timeout=10 * 1000, state="visible")
235+
print("'Create Project' dialog visible, closing it.")
236+
project_name_input = admin_page.locator('input[type="text"]')
237+
project_name_input.fill("Default Project")
238+
button = admin_page.locator('button:has-text("Continue")')
233239
button.wait_for(timeout=3 * 1000)
234240
button.click()
235-
except (playwright._impl._api_types.Error, playwright._impl._api_types.TimeoutError):
236-
pass
241+
except playwright._impl._api_types.TimeoutError:
242+
print("'Create Project' dialog not visible, skipping.")
243+
237244
admin_page.locator(f"text={name}").click()
238245
admin_page.evaluate(
239246
"""data => {

0 commit comments

Comments
 (0)