-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
test_boring_app.py
34 lines (26 loc) · 1.04 KB
/
test_boring_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import pytest
from click.testing import CliRunner
from tests_examples_app.public import _PATH_EXAMPLES
from lightning_app.cli.lightning_cli import show
from lightning_app.testing.testing import run_app_in_cloud, wait_for
@pytest.mark.cloud
def test_boring_app_example_cloud() -> None:
with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_boring"), app_name="app_dynamic.py", debug=True) as (
_,
view_page,
_,
name,
):
def check_hello_there(*_, **__):
locator = view_page.frame_locator("iframe").locator('ul:has-text("Hello there!")')
if len(locator.all_text_contents()):
return True
wait_for(view_page, check_hello_there)
runner = CliRunner()
result = runner.invoke(show.commands["logs"], [name])
lines = result.output.splitlines()
assert result.exit_code == 0
assert result.exception is None
assert any("Received from root.dict.dst_w" in line for line in lines)
print("Succeeded App!")