instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
a_file.parent.mkdir(exist_ok=True) with metadata_file.open("a+") as f: fcntl.flock(f.fileno(), fcntl.LOCK_EX) f.seek(0) try: content = f.read() metadata = json.loads(content) if content.strip() else {} except (json.JSONDecodeError, ValueError): metadata = {} video_filename = video_file.name metadata[video_filename] = test_name f.seek(0) f.truncate() json.dump(metadata, f, indent=2) else: # Test passed - remove video file if video_file.exists(): video_file.unlink() except Exception as e: print(f"Failed to process video for test {item.name}: {e}")
traceback.print_exc() else: if report.failed: print(f"No video available for failed test: {item.name}") video_dir = Path("test-videos") if video_dir.exists(): import time recent_videos = [ f for f in video_dir.glob("*.webm") if f.stat().st_mtime > (time.time() - 60) ] print( f"Recent video files found: {[f.name for f in recent_videos]}" )
import traceback
try: content = f.read() metadata = json.loads(content) if content.strip() else {} except (json.JSONDecodeError, ValueError): metadata = {} video_filename = video_file.name metadata[video_filename] = test_name f.seek(0) f.truncate() json.dump(metadata, f, indent=2) else: # Test passed - remove video file if video_file.exists(): video_file.unlink() except Exception as e: print(f"Failed to process video for test {item.name}: {e}") import traceback traceback.print_exc() else: if report.failed: print(f"No video available for failed test: {item.name}")
if video_dir.exists(): import time recent_videos = [ f for f in video_dir.glob("*.webm") if f.stat().st_mtime > (time.time() - 60) ] print( f"Recent video files found: {[f.name for f in recent_videos]}" )
video_dir = Path("test-videos")
content = f.read() metadata = json.loads(content) if content.strip() else {} except (json.JSONDecodeError, ValueError): metadata = {} video_filename = video_file.name metadata[video_filename] = test_name f.seek(0) f.truncate() json.dump(metadata, f, indent=2) else: # Test passed - remove video file if video_file.exists(): video_file.unlink() except Exception as e: print(f"Failed to process video for test {item.name}: {e}") import traceback traceback.print_exc() else: if report.failed: print(f"No video available for failed test: {item.name}") video_dir = Path("test-videos")
if video_dir.exists(): import time recent_videos = [ f for f in video_dir.glob("*.webm") if f.stat().st_mtime > (time.time() - 60) ] print( f"Recent video files found: {[f.name for f in recent_videos]}" )
metadata = json.loads(content) if content.strip() else {} except (json.JSONDecodeError, ValueError): metadata = {} video_filename = video_file.name metadata[video_filename] = test_name f.seek(0) f.truncate() json.dump(metadata, f, indent=2) else: # Test passed - remove video file if video_file.exists(): video_file.unlink() except Exception as e: print(f"Failed to process video for test {item.name}: {e}") import traceback traceback.print_exc() else: if report.failed: print(f"No video available for failed test: {item.name}") video_dir = Path("test-videos") if video_dir.exists():
recent_videos = [ f for f in video_dir.glob("*.webm") if f.stat().st_mtime > (time.time() - 60) ] print( f"Recent video files found: {[f.name for f in recent_videos]}" )
import time
(content) if content.strip() else {} except (json.JSONDecodeError, ValueError): metadata = {} video_filename = video_file.name metadata[video_filename] = test_name f.seek(0) f.truncate() json.dump(metadata, f, indent=2) else: # Test passed - remove video file if video_file.exists(): video_file.unlink() except Exception as e: print(f"Failed to process video for test {item.name}: {e}") import traceback traceback.print_exc() else: if report.failed: print(f"No video available for failed test: {item.name}") video_dir = Path("test-videos") if video_dir.exists(): import time
print( f"Recent video files found: {[f.name for f in recent_videos]}" )
recent_videos = [ f for f in video_dir.glob("*.webm") if f.stat().st_mtime > (time.time() - 60) ]
import re
from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True) reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1) heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() exp
import pytest
import re import pytest
from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True) reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1) heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7]
from playwright.sync_api import Page, expect
import re import pytest from playwright.sync_api import Page, expect
from utils import get_full_url @pytest.fixture def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True) reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1) heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7] /")) reset_button.click() exp
from reflex.testing import AppHarness
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness
@pytest.fixture def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True) reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1) heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7] /")) reset_button.click() expect(heading).to_have_text("0 /"
from utils import get_full_url
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture
def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True) reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1) heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7] /")) reset_button.click() expect(heading).to_have_text("0 /") expect(heading).to_have_text("10 /", timeout=12000)
def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def background_events_url() -> str:
return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True) reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1) heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7] /")) reset_button.click() expect(heading).to_have_text("0 /") expect(heading).to_have_text("10 /", timeout=12000)
from pcweb.pages import docs
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url))
reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1) heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7] /")) reset_button.click() expect(heading).to_have_text("0 /") expect(heading).to_have_text("10 /", timeout=12000)
start_button = page.get_by_role("button", name="Start", exact=True)
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True)
expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1) heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7] /")) reset_button.click() expect(heading).to_have_text("0 /") expect(heading).to_have_text("10 /", timeout=12000)
reset_button = page.get_by_role("button", name="Reset")
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True) reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000)
heading = demo_block.get_by_role("heading") expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7] /")) reset_button.click() expect(heading).to_have_text("0 /") expect(heading).to_have_text("10 /", timeout=12000)
demo_block = page.locator('[id="background_demo"]').nth(1)
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def background_events_url() -> str: from pcweb.pages import docs return docs.events.background_events.path def test_background_events( reflex_web_app: AppHarness, page: Page, background_events_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, background_events_url)) expect(page).to_have_url(re.compile(background_events_url)) start_button = page.get_by_role("button", name="Start", exact=True) reset_button = page.get_by_role("button", name="Reset") expect(start_button).to_be_visible(timeout=60000) demo_block = page.locator('[id="background_demo"]').nth(1)
expect(heading).to_have_text("0 /") start_button.click() expect(heading).to_have_text(re.compile(r"[4-7] /")) reset_button.click() expect(heading).to_have_text("0 /") expect(heading).to_have_text("10 /", timeout=12000)
heading = demo_block.get_by_role("heading")
import re
import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def chaining_event_url() -> str: from pcweb.pages import docs return docs.events.chaining_events.path def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span') expect(chain_heading).to_have_text("0") run_button = page.get_by_role("button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_h
import time
import re import time
from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def chaining_event_url() -> str: from pcweb.pages import docs return docs.events.chaining_events.path def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span') expect(chain_heading).to_have_text("0") run_button = page.get_by_role("button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1")
import pytest
import re import time import pytest
from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def chaining_event_url() -> str: from pcweb.pages import docs return docs.events.chaining_events.path def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span') expect(chain_heading).to_have_text("0") run_button = page.get_by_role("button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2")
from playwright.sync_api import Page, expect
import re import time import pytest from playwright.sync_api import Page, expect
from utils import get_full_url @pytest.fixture def chaining_event_url() -> str: from pcweb.pages import docs return docs.events.chaining_events.path def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span') expect(chain_heading).to_have_text("0") run_button = page.get_by_role("button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_te
from reflex.testing import AppHarness
import re import time import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness
@pytest.fixture def chaining_event_url() -> str: from pcweb.pages import docs return docs.events.chaining_events.path def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span') expect(chain_heading).to_have_text("0") run_button = page.get_by_role("button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_text("3") # expect(chain_head
from utils import get_full_url
import re import time import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture
def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span') expect(chain_heading).to_have_text("0") run_button = page.get_by_role("button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_text("3") # expect(chain_heading).to_have_text("4") # expect(chain_heading).to_have_text("5") # expect(chain_heading).to_have_text("6") # expect(c
def chaining_event_url() -> str: from pcweb.pages import docs return docs.events.chaining_events.path
import re import time import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def chaining_event_url() -> str:
return docs.events.chaining_events.path def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span') expect(chain_heading).to_have_text("0") run_button = page.get_by_role("button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_text("3") # expect(chain_heading).to_have_text("4") # expect(chain_heading).to_have_text("5") # expect(ch
from pcweb.pages import docs
import re import time import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def chaining_event_url() -> str: from pcweb.pages import docs return docs.events.chaining_events.path def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url))
expect(chain_heading).to_have_text("0") run_button = page.get_by_role("button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_text("3") # expect(chain_heading).to_have_text("4") # expect(chain_heading).to_have_text("5") # expect(chain_heading).to_have_text("6") # expect(chain_heading).to_have_text("7") # expect(chain_heading).to_have_text("8") # expect(chain_heading).to_have_text("9") expect(chain_heading).to_have_text("10", timeout=10000) def test_collatz(reflex_web_app: AppHarness, page: Page, chaining_event_url): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaini
chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span')
import re import time import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def chaining_event_url() -> str: from pcweb.pages import docs return docs.events.chaining_events.path def test_handler_from_handler( reflex_web_app: AppHarness, page: Page, chaining_event_url: str, ): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) chain_heading = page.locator('[id="call-handler"] > .rt-Flex > span') expect(chain_heading).to_have_text("0")
run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_text("3") # expect(chain_heading).to_have_text("4") # expect(chain_heading).to_have_text("5") # expect(chain_heading).to_have_text("6") # expect(chain_heading).to_have_text("7") # expect(chain_heading).to_have_text("8") # expect(chain_heading).to_have_text("9") expect(chain_heading).to_have_text("10", timeout=10000) def test_collatz(reflex_web_app: AppHarness, page: Page, chaining_event_url): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) collatz_box = page.l
run_button = page.get_by_role("button", name="Run")
button", name="Run") run_button.scroll_into_view_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_text("3") # expect(chain_heading).to_have_text("4") # expect(chain_heading).to_have_text("5") # expect(chain_heading).to_have_text("6") # expect(chain_heading).to_have_text("7") # expect(chain_heading).to_have_text("8") # expect(chain_heading).to_have_text("9") expect(chain_heading).to_have_text("10", timeout=10000) def test_collatz(reflex_web_app: AppHarness, page: Page, chaining_event_url): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url))
collatz_input = collatz_box.get_by_role("textbox") collatz_input.fill("10", timeout=4000) collatz_input.blur() collatz_heading = page.locator('[id="collatz"] > .rt-Flex > span') # commented this as runtime is not reliable in CI # expect(collatz_heading).to_have_text("10") # expect(collatz_heading).to_have_text("5") # expect(collatz_heading).to_have_text("16") # expect(collatz_heading).to_have_text("8") # expect(collatz_heading).to_have_text("4") # expect(collatz_heading).to_have_text("2") expect(collatz_heading).to_have_text("1", timeout=10000) time.sleep(20)
collatz_box = page.locator('[id="collatz"]')
ew_if_needed() expect(run_button).to_be_visible() run_button.click() # commented this as runtime is not reliable in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_text("3") # expect(chain_heading).to_have_text("4") # expect(chain_heading).to_have_text("5") # expect(chain_heading).to_have_text("6") # expect(chain_heading).to_have_text("7") # expect(chain_heading).to_have_text("8") # expect(chain_heading).to_have_text("9") expect(chain_heading).to_have_text("10", timeout=10000) def test_collatz(reflex_web_app: AppHarness, page: Page, chaining_event_url): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) collatz_box = page.locator('[id="collatz"]')
collatz_input.fill("10", timeout=4000) collatz_input.blur() collatz_heading = page.locator('[id="collatz"] > .rt-Flex > span') # commented this as runtime is not reliable in CI # expect(collatz_heading).to_have_text("10") # expect(collatz_heading).to_have_text("5") # expect(collatz_heading).to_have_text("16") # expect(collatz_heading).to_have_text("8") # expect(collatz_heading).to_have_text("4") # expect(collatz_heading).to_have_text("2") expect(collatz_heading).to_have_text("1", timeout=10000) time.sleep(20)
collatz_input = collatz_box.get_by_role("textbox")
e in CI # expect(chain_heading).to_have_text("1") # expect(chain_heading).to_have_text("2") # expect(chain_heading).to_have_text("3") # expect(chain_heading).to_have_text("4") # expect(chain_heading).to_have_text("5") # expect(chain_heading).to_have_text("6") # expect(chain_heading).to_have_text("7") # expect(chain_heading).to_have_text("8") # expect(chain_heading).to_have_text("9") expect(chain_heading).to_have_text("10", timeout=10000) def test_collatz(reflex_web_app: AppHarness, page: Page, chaining_event_url): assert reflex_web_app.frontend_url is not None page.set_default_timeout(60000) page.set_default_navigation_timeout(60000) page.goto(get_full_url(reflex_web_app, chaining_event_url)) expect(page).to_have_url(re.compile(chaining_event_url)) collatz_box = page.locator('[id="collatz"]') collatz_input = collatz_box.get_by_role("textbox") collatz_input.fill("10", timeout=4000) collatz_input.blur()
# commented this as runtime is not reliable in CI # expect(collatz_heading).to_have_text("10") # expect(collatz_heading).to_have_text("5") # expect(collatz_heading).to_have_text("16") # expect(collatz_heading).to_have_text("8") # expect(collatz_heading).to_have_text("4") # expect(collatz_heading).to_have_text("2") expect(collatz_heading).to_have_text("1", timeout=10000) time.sleep(20)
collatz_heading = page.locator('[id="collatz"] > .rt-Flex > span')
import re
from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def computed_vars_url() -> str: from pcweb.pages import docs return docs.vars.computed_vars.path def test_computed_vars( reflex_web_app: AppHarness, page: Page, computed_vars_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, computed_vars_url)) expect(page).to_have_url(re.compile(computed_vars_url)) upper_box = page.locator('[id="upper"]') input = upper_box.get_by_role("textbox") input.fill("upper") input.blur() expect(upper_box.get_by_role("heading")).to_have_text("UPPER")
import pytest
import re import pytest
from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def computed_vars_url() -> str: from pcweb.pages import docs return docs.vars.computed_vars.path def test_computed_vars( reflex_web_app: AppHarness, page: Page, computed_vars_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, computed_vars_url)) expect(page).to_have_url(re.compile(computed_vars_url)) upper_box = page.locator('[id="upper"]') input = upper_box.get_by_role("textbox") input.fill("upper") input.blur() expect(upper_box.get_by_role("heading")).to_have_text("UPPER")
from playwright.sync_api import Page, expect
import re import pytest from playwright.sync_api import Page, expect
from utils import get_full_url @pytest.fixture def computed_vars_url() -> str: from pcweb.pages import docs return docs.vars.computed_vars.path def test_computed_vars( reflex_web_app: AppHarness, page: Page, computed_vars_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, computed_vars_url)) expect(page).to_have_url(re.compile(computed_vars_url)) upper_box = page.locator('[id="upper"]') input = upper_box.get_by_role("textbox") input.fill("upper") input.blur() expect(upper_box.get_by_role("heading")).to_have_text("UPPER")
from reflex.testing import AppHarness
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness
@pytest.fixture def computed_vars_url() -> str: from pcweb.pages import docs return docs.vars.computed_vars.path def test_computed_vars( reflex_web_app: AppHarness, page: Page, computed_vars_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, computed_vars_url)) expect(page).to_have_url(re.compile(computed_vars_url)) upper_box = page.locator('[id="upper"]') input = upper_box.get_by_role("textbox") input.fill("upper") input.blur() expect(upper_box.get_by_role("heading")).to_have_text("UPPER")
from utils import get_full_url
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def computed_vars_url() -> str:
return docs.vars.computed_vars.path def test_computed_vars( reflex_web_app: AppHarness, page: Page, computed_vars_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, computed_vars_url)) expect(page).to_have_url(re.compile(computed_vars_url)) upper_box = page.locator('[id="upper"]') input = upper_box.get_by_role("textbox") input.fill("upper") input.blur() expect(upper_box.get_by_role("heading")).to_have_text("UPPER")
from pcweb.pages import docs
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def computed_vars_url() -> str: from pcweb.pages import docs return docs.vars.computed_vars.path def test_computed_vars( reflex_web_app: AppHarness, page: Page, computed_vars_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, computed_vars_url)) expect(page).to_have_url(re.compile(computed_vars_url))
input = upper_box.get_by_role("textbox") input.fill("upper") input.blur() expect(upper_box.get_by_role("heading")).to_have_text("UPPER")
upper_box = page.locator('[id="upper"]')
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def computed_vars_url() -> str: from pcweb.pages import docs return docs.vars.computed_vars.path def test_computed_vars( reflex_web_app: AppHarness, page: Page, computed_vars_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, computed_vars_url)) expect(page).to_have_url(re.compile(computed_vars_url)) upper_box = page.locator('[id="upper"]')
input.fill("upper") input.blur() expect(upper_box.get_by_role("heading")).to_have_text("UPPER")
input = upper_box.get_by_role("textbox")
"""Test the counter example on the main page.""" import re
from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_
import pytest
"""Test the counter example on the main page.""" import re import pytest
from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement butt
from playwright.sync_api import Page, expect
"""Test the counter example on the main page.""" import re import pytest from playwright.sync_api import Page, expect
from utils import get_full_url @pytest.fixture def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement button and click it. decrement_button
from reflex.testing import AppHarness
"""Test the counter example on the main page.""" import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness
@pytest.fixture def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement button and click it. decrement_button = counter_block.get_by_role("bu
from utils import get_full_url
"""Test the counter example on the main page.""" import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture
def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement button and click it. decrement_button = counter_block.get_by_role("button", name="Decrement") decrement_button.click() # Check that the counter is now 1. expect(counter_heading).to_have_t
def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path
"""Test the counter example on the main page.""" import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def intro_page_url() -> str:
return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement button and click it. decrement_button = counter_block.get_by_role("button", name="Decrement") decrement_button.click() # Check that the coun
from pcweb.pages import docs
"""Test the counter example on the main page.""" import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url))
expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement button and click it. decrement_button = counter_block.get_by_role("button", name="Decrement") decrement_button.click() # Check that the counter is now 1. expect(counter_heading).to_have_text("1")
counter_block = page.locator('[id="counter"]')
"""Test the counter example on the main page.""" import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view)
expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement button and click it. decrement_button = counter_block.get_by_role("button", name="Decrement") decrement_button.click() # Check that the counter is now 1. expect(counter_heading).to_have_text("1")
increment_button = counter_block.get_by_role("button", name="Increment")
"""Test the counter example on the main page.""" import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click()
# Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement button and click it. decrement_button = counter_block.get_by_role("button", name="Decrement") decrement_button.click() # Check that the counter is now 1. expect(counter_heading).to_have_text("1")
counter_heading = counter_block.get_by_role("heading")
import AppHarness from utils import get_full_url @pytest.fixture def intro_page_url() -> str: from pcweb.pages import docs return docs.getting_started.introduction.path def test_counter(reflex_web_app: AppHarness, page: Page, intro_page_url): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, intro_page_url)) expect(page).to_have_url(re.compile(intro_page_url)) counter_block = page.locator('[id="counter"]') expect(counter_block).to_be_visible() # Find increment button and click it twice. (Playwright will autoscroll the button into view) increment_button = counter_block.get_by_role("button", name="Increment") expect(increment_button).to_be_visible() increment_button.click() increment_button.click() counter_heading = counter_block.get_by_role("heading") # Check that the counter is now 2. expect(counter_heading).to_have_text(expected="2") # Find decrement button and click it.
decrement_button.click() # Check that the counter is now 1. expect(counter_heading).to_have_text("1")
decrement_button = counter_block.get_by_role("button", name="Decrement")
from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def event_argument_url() -> str: from pcweb.pages import docs return docs.events.event_arguments.path def test_lambdas( reflex_web_app: AppHarness, page: Page, event_argument_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, event_argument_url)) inputs = page.get_by_role("textbox") def check_box_color(i, initial_color, input_color, expected_color): expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", initial_color ) inputs.nth(i).fill(input_color) inputs.nth(i).blur() expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", expected_color ) check_box_color(1, "rgb(245, 168, 152)", "rgb(245, 168, 152)", "rgb(245, 168, 152)") check_box
import pytest
import pytest
from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def event_argument_url() -> str: from pcweb.pages import docs return docs.events.event_arguments.path def test_lambdas( reflex_web_app: AppHarness, page: Page, event_argument_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, event_argument_url)) inputs = page.get_by_role("textbox") def check_box_color(i, initial_color, input_color, expected_color): expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", initial_color ) inputs.nth(i).fill(input_color) inputs.nth(i).blur() expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", expected_color ) check_box_color(1, "rgb(245, 168, 152)", "rgb(245, 168, 152)", "rgb(245, 168, 152)") check_box_color(2, "rgb(60, 179, 113)", "DarkBlue", "r
from playwright.sync_api import Page, expect
import pytest from playwright.sync_api import Page, expect
from utils import get_full_url @pytest.fixture def event_argument_url() -> str: from pcweb.pages import docs return docs.events.event_arguments.path def test_lambdas( reflex_web_app: AppHarness, page: Page, event_argument_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, event_argument_url)) inputs = page.get_by_role("textbox") def check_box_color(i, initial_color, input_color, expected_color): expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", initial_color ) inputs.nth(i).fill(input_color) inputs.nth(i).blur() expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", expected_color ) check_box_color(1, "rgb(245, 168, 152)", "rgb(245, 168, 152)", "rgb(245, 168, 152)") check_box_color(2, "rgb(60, 179, 113)", "DarkBlue", "rgb(60, 179, 113)") check_box_color
from reflex.testing import AppHarness
import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness
@pytest.fixture def event_argument_url() -> str: from pcweb.pages import docs return docs.events.event_arguments.path def test_lambdas( reflex_web_app: AppHarness, page: Page, event_argument_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, event_argument_url)) inputs = page.get_by_role("textbox") def check_box_color(i, initial_color, input_color, expected_color): expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", initial_color ) inputs.nth(i).fill(input_color) inputs.nth(i).blur() expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", expected_color ) check_box_color(1, "rgb(245, 168, 152)", "rgb(245, 168, 152)", "rgb(245, 168, 152)") check_box_color(2, "rgb(60, 179, 113)", "DarkBlue", "rgb(60, 179, 113)") check_box_color(3, "rgb(222, 173, 227)", "#AEA
from utils import get_full_url
import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture
def test_lambdas( reflex_web_app: AppHarness, page: Page, event_argument_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, event_argument_url)) inputs = page.get_by_role("textbox") def check_box_color(i, initial_color, input_color, expected_color): expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", initial_color ) inputs.nth(i).fill(input_color) inputs.nth(i).blur() expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", expected_color ) check_box_color(1, "rgb(245, 168, 152)", "rgb(245, 168, 152)", "rgb(245, 168, 152)") check_box_color(2, "rgb(60, 179, 113)", "DarkBlue", "rgb(60, 179, 113)") check_box_color(3, "rgb(222, 173, 227)", "#AEADE3", "rgb(222, 173, 227)")
def event_argument_url() -> str: from pcweb.pages import docs return docs.events.event_arguments.path
import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def event_argument_url() -> str:
return docs.events.event_arguments.path def test_lambdas( reflex_web_app: AppHarness, page: Page, event_argument_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, event_argument_url)) inputs = page.get_by_role("textbox") def check_box_color(i, initial_color, input_color, expected_color): expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", initial_color ) inputs.nth(i).fill(input_color) inputs.nth(i).blur() expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", expected_color ) check_box_color(1, "rgb(245, 168, 152)", "rgb(245, 168, 152)", "rgb(245, 168, 152)") check_box_color(2, "rgb(60, 179, 113)", "DarkBlue", "rgb(60, 179, 113)") check_box_color(3, "rgb(222, 173, 227)", "#AEADE3", "rgb(222, 173, 227)")
from pcweb.pages import docs
import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def event_argument_url() -> str: from pcweb.pages import docs return docs.events.event_arguments.path def test_lambdas( reflex_web_app: AppHarness, page: Page, event_argument_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, event_argument_url))
def check_box_color(i, initial_color, input_color, expected_color): expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", initial_color ) inputs.nth(i).fill(input_color) inputs.nth(i).blur() expect(page.locator(".rt-TextFieldRoot").nth(i)).to_have_css( "background-color", expected_color ) check_box_color(1, "rgb(245, 168, 152)", "rgb(245, 168, 152)", "rgb(245, 168, 152)") check_box_color(2, "rgb(60, 179, 113)", "DarkBlue", "rgb(60, 179, 113)") check_box_color(3, "rgb(222, 173, 227)", "#AEADE3", "rgb(222, 173, 227)")
inputs = page.get_by_role("textbox")
import re
from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def scatterchart_page_url() -> str: from pcweb.pages import docs return docs.library.graphing.charts.scatterchart.path def tests_recharts( reflex_web_app: AppHarness, page: Page, scatterchart_page_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, scatterchart_page_url)) expect(page).to_have_url(re.compile(scatterchart_page_url)) input = page.get_by_placeholder("Enter a number") symbols = page.locator(".recharts-symbols") button = page.get_by_role("button", name="Compute") expect(input).to_be_visible() expect(symbols).to_have_count(45) expect(button).to_be_visible()
import pytest
import re import pytest
from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def scatterchart_page_url() -> str: from pcweb.pages import docs return docs.library.graphing.charts.scatterchart.path def tests_recharts( reflex_web_app: AppHarness, page: Page, scatterchart_page_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, scatterchart_page_url)) expect(page).to_have_url(re.compile(scatterchart_page_url)) input = page.get_by_placeholder("Enter a number") symbols = page.locator(".recharts-symbols") button = page.get_by_role("button", name="Compute") expect(input).to_be_visible() expect(symbols).to_have_count(45) expect(button).to_be_visible()
from playwright.sync_api import Page, expect
import re import pytest from playwright.sync_api import Page, expect
from utils import get_full_url @pytest.fixture def scatterchart_page_url() -> str: from pcweb.pages import docs return docs.library.graphing.charts.scatterchart.path def tests_recharts( reflex_web_app: AppHarness, page: Page, scatterchart_page_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, scatterchart_page_url)) expect(page).to_have_url(re.compile(scatterchart_page_url)) input = page.get_by_placeholder("Enter a number") symbols = page.locator(".recharts-symbols") button = page.get_by_role("button", name="Compute") expect(input).to_be_visible() expect(symbols).to_have_count(45) expect(button).to_be_visible()
from reflex.testing import AppHarness
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness
@pytest.fixture def scatterchart_page_url() -> str: from pcweb.pages import docs return docs.library.graphing.charts.scatterchart.path def tests_recharts( reflex_web_app: AppHarness, page: Page, scatterchart_page_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, scatterchart_page_url)) expect(page).to_have_url(re.compile(scatterchart_page_url)) input = page.get_by_placeholder("Enter a number") symbols = page.locator(".recharts-symbols") button = page.get_by_role("button", name="Compute") expect(input).to_be_visible() expect(symbols).to_have_count(45) expect(button).to_be_visible()
from utils import get_full_url
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def scatterchart_page_url() -> str:
return docs.library.graphing.charts.scatterchart.path def tests_recharts( reflex_web_app: AppHarness, page: Page, scatterchart_page_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, scatterchart_page_url)) expect(page).to_have_url(re.compile(scatterchart_page_url)) input = page.get_by_placeholder("Enter a number") symbols = page.locator(".recharts-symbols") button = page.get_by_role("button", name="Compute") expect(input).to_be_visible() expect(symbols).to_have_count(45) expect(button).to_be_visible()
from pcweb.pages import docs
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def scatterchart_page_url() -> str: from pcweb.pages import docs return docs.library.graphing.charts.scatterchart.path def tests_recharts( reflex_web_app: AppHarness, page: Page, scatterchart_page_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, scatterchart_page_url)) expect(page).to_have_url(re.compile(scatterchart_page_url))
symbols = page.locator(".recharts-symbols") button = page.get_by_role("button", name="Compute") expect(input).to_be_visible() expect(symbols).to_have_count(45) expect(button).to_be_visible()
input = page.get_by_placeholder("Enter a number")
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def scatterchart_page_url() -> str: from pcweb.pages import docs return docs.library.graphing.charts.scatterchart.path def tests_recharts( reflex_web_app: AppHarness, page: Page, scatterchart_page_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, scatterchart_page_url)) expect(page).to_have_url(re.compile(scatterchart_page_url)) input = page.get_by_placeholder("Enter a number")
button = page.get_by_role("button", name="Compute") expect(input).to_be_visible() expect(symbols).to_have_count(45) expect(button).to_be_visible()
symbols = page.locator(".recharts-symbols")
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def scatterchart_page_url() -> str: from pcweb.pages import docs return docs.library.graphing.charts.scatterchart.path def tests_recharts( reflex_web_app: AppHarness, page: Page, scatterchart_page_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, scatterchart_page_url)) expect(page).to_have_url(re.compile(scatterchart_page_url)) input = page.get_by_placeholder("Enter a number") symbols = page.locator(".recharts-symbols")
expect(input).to_be_visible() expect(symbols).to_have_count(45) expect(button).to_be_visible()
button = page.get_by_role("button", name="Compute")
import re
from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def server_side_events_url() -> str: from pcweb.pages import docs return docs.api_reference.special_events.path def _predicate_console_message(msg): return msg.text == "Hello World!" def _predicate_download(download): return download.suggested_filename == "different_name_logo.png" def test_server_side_events( reflex_web_app: AppHarness, page: Page, server_side_events_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, server_side_events_url)) expect(page).to_have_url(re.compile(server_side_events_url)) with page.expect_console_message(_predicate_console_message): page.get_by_role("button", name="Log", exact=True).click() page.get_by_role("button", name="Scroll").click() with page.expect_download(_predicate_download): page.get_by_ro
import pytest
import re import pytest
from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def server_side_events_url() -> str: from pcweb.pages import docs return docs.api_reference.special_events.path def _predicate_console_message(msg): return msg.text == "Hello World!" def _predicate_download(download): return download.suggested_filename == "different_name_logo.png" def test_server_side_events( reflex_web_app: AppHarness, page: Page, server_side_events_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, server_side_events_url)) expect(page).to_have_url(re.compile(server_side_events_url)) with page.expect_console_message(_predicate_console_message): page.get_by_role("button", name="Log", exact=True).click() page.get_by_role("button", name="Scroll").click() with page.expect_download(_predicate_download): page.get_by_role("button", name="Download", exact=True).cli
from playwright.sync_api import Page, expect
import re import pytest from playwright.sync_api import Page, expect
from utils import get_full_url @pytest.fixture def server_side_events_url() -> str: from pcweb.pages import docs return docs.api_reference.special_events.path def _predicate_console_message(msg): return msg.text == "Hello World!" def _predicate_download(download): return download.suggested_filename == "different_name_logo.png" def test_server_side_events( reflex_web_app: AppHarness, page: Page, server_side_events_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, server_side_events_url)) expect(page).to_have_url(re.compile(server_side_events_url)) with page.expect_console_message(_predicate_console_message): page.get_by_role("button", name="Log", exact=True).click() page.get_by_role("button", name="Scroll").click() with page.expect_download(_predicate_download): page.get_by_role("button", name="Download", exact=True).click()
from reflex.testing import AppHarness
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness
@pytest.fixture def server_side_events_url() -> str: from pcweb.pages import docs return docs.api_reference.special_events.path def _predicate_console_message(msg): return msg.text == "Hello World!" def _predicate_download(download): return download.suggested_filename == "different_name_logo.png" def test_server_side_events( reflex_web_app: AppHarness, page: Page, server_side_events_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, server_side_events_url)) expect(page).to_have_url(re.compile(server_side_events_url)) with page.expect_console_message(_predicate_console_message): page.get_by_role("button", name="Log", exact=True).click() page.get_by_role("button", name="Scroll").click() with page.expect_download(_predicate_download): page.get_by_role("button", name="Download", exact=True).click()
from utils import get_full_url
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def server_side_events_url() -> str:
return docs.api_reference.special_events.path def _predicate_console_message(msg): return msg.text == "Hello World!" def _predicate_download(download): return download.suggested_filename == "different_name_logo.png" def test_server_side_events( reflex_web_app: AppHarness, page: Page, server_side_events_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, server_side_events_url)) expect(page).to_have_url(re.compile(server_side_events_url)) with page.expect_console_message(_predicate_console_message): page.get_by_role("button", name="Log", exact=True).click() page.get_by_role("button", name="Scroll").click() with page.expect_download(_predicate_download): page.get_by_role("button", name="Download", exact=True).click()
from pcweb.pages import docs
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def server_side_events_url() -> str: from pcweb.pages import docs return docs.api_reference.special_events.path
def _predicate_download(download): return download.suggested_filename == "different_name_logo.png" def test_server_side_events( reflex_web_app: AppHarness, page: Page, server_side_events_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, server_side_events_url)) expect(page).to_have_url(re.compile(server_side_events_url)) with page.expect_console_message(_predicate_console_message): page.get_by_role("button", name="Log", exact=True).click() page.get_by_role("button", name="Scroll").click() with page.expect_download(_predicate_download): page.get_by_role("button", name="Download", exact=True).click()
def _predicate_console_message(msg): return msg.text == "Hello World!"
import re import pytest from playwright.sync_api import Page, expect from reflex.testing import AppHarness from utils import get_full_url @pytest.fixture def server_side_events_url() -> str: from pcweb.pages import docs return docs.api_reference.special_events.path def _predicate_console_message(msg): return msg.text == "Hello World!"
def test_server_side_events( reflex_web_app: AppHarness, page: Page, server_side_events_url: str, ): assert reflex_web_app.frontend_url is not None page.goto(get_full_url(reflex_web_app, server_side_events_url)) expect(page).to_have_url(re.compile(server_side_events_url)) with page.expect_console_message(_predicate_console_message): page.get_by_role("button", name="Log", exact=True).click() page.get_by_role("button", name="Scroll").click() with page.expect_download(_predicate_download): page.get_by_role("button", name="Download", exact=True).click()
def _predicate_download(download): return download.suggested_filename == "different_name_logo.png"
"""Integration tests for all titles in Reflex."""
from collections import Counter from pathlib import Path import pytest sys.path.append(str(Path(__file__).resolve().parent.parent)) @pytest.fixture def routes_fixture(): from pcweb.pages import routes yield routes def test_unique_titles(routes_fixture): assert routes_fixture is not None titles = [route for route in routes_fixture if hasattr(route, "title")] # Count occurrences of each title title_counts = Counter(titles) # Find duplicate titles duplicates = [title for title, count in title_counts.items() if count > 1] # Assert that there are no duplicates assert len(duplicates) == 0, f"Duplicate titles found: {duplicates}" print(f"Test passed. All {len(titles)} titles are unique.")
import sys
"""Integration tests for all titles in Reflex.""" import sys
from pathlib import Path import pytest sys.path.append(str(Path(__file__).resolve().parent.parent)) @pytest.fixture def routes_fixture(): from pcweb.pages import routes yield routes def test_unique_titles(routes_fixture): assert routes_fixture is not None titles = [route for route in routes_fixture if hasattr(route, "title")] # Count occurrences of each title title_counts = Counter(titles) # Find duplicate titles duplicates = [title for title, count in title_counts.items() if count > 1] # Assert that there are no duplicates assert len(duplicates) == 0, f"Duplicate titles found: {duplicates}" print(f"Test passed. All {len(titles)} titles are unique.")
from collections import Counter
"""Integration tests for all titles in Reflex.""" import sys from collections import Counter
import pytest sys.path.append(str(Path(__file__).resolve().parent.parent)) @pytest.fixture def routes_fixture(): from pcweb.pages import routes yield routes def test_unique_titles(routes_fixture): assert routes_fixture is not None titles = [route for route in routes_fixture if hasattr(route, "title")] # Count occurrences of each title title_counts = Counter(titles) # Find duplicate titles duplicates = [title for title, count in title_counts.items() if count > 1] # Assert that there are no duplicates assert len(duplicates) == 0, f"Duplicate titles found: {duplicates}" print(f"Test passed. All {len(titles)} titles are unique.")
from pathlib import Path
"""Integration tests for all titles in Reflex.""" import sys from collections import Counter from pathlib import Path import pytest sys.path.append(str(Path(__file__).resolve().parent.parent)) @pytest.fixture
def test_unique_titles(routes_fixture): assert routes_fixture is not None titles = [route for route in routes_fixture if hasattr(route, "title")] # Count occurrences of each title title_counts = Counter(titles) # Find duplicate titles duplicates = [title for title, count in title_counts.items() if count > 1] # Assert that there are no duplicates assert len(duplicates) == 0, f"Duplicate titles found: {duplicates}" print(f"Test passed. All {len(titles)} titles are unique.")
def routes_fixture(): from pcweb.pages import routes yield routes
"""Integration tests for all titles in Reflex.""" import sys from collections import Counter from pathlib import Path import pytest sys.path.append(str(Path(__file__).resolve().parent.parent)) @pytest.fixture def routes_fixture():
yield routes def test_unique_titles(routes_fixture): assert routes_fixture is not None titles = [route for route in routes_fixture if hasattr(route, "title")] # Count occurrences of each title title_counts = Counter(titles) # Find duplicate titles duplicates = [title for title, count in title_counts.items() if count > 1] # Assert that there are no duplicates assert len(duplicates) == 0, f"Duplicate titles found: {duplicates}" print(f"Test passed. All {len(titles)} titles are unique.")
from pcweb.pages import routes
"""Integration tests for all titles in Reflex.""" import sys from collections import Counter from pathlib import Path import pytest sys.path.append(str(Path(__file__).resolve().parent.parent)) @pytest.fixture def routes_fixture(): from pcweb.pages import routes yield routes def test_unique_titles(routes_fixture): assert routes_fixture is not None
# Count occurrences of each title title_counts = Counter(titles) # Find duplicate titles duplicates = [title for title, count in title_counts.items() if count > 1] # Assert that there are no duplicates assert len(duplicates) == 0, f"Duplicate titles found: {duplicates}" print(f"Test passed. All {len(titles)} titles are unique.")
titles = [route for route in routes_fixture if hasattr(route, "title")]
"""Integration tests for all titles in Reflex.""" import sys from collections import Counter from pathlib import Path import pytest sys.path.append(str(Path(__file__).resolve().parent.parent)) @pytest.fixture def routes_fixture(): from pcweb.pages import routes yield routes def test_unique_titles(routes_fixture): assert routes_fixture is not None titles = [route for route in routes_fixture if hasattr(route, "title")] # Count occurrences of each title
# Find duplicate titles duplicates = [title for title, count in title_counts.items() if count > 1] # Assert that there are no duplicates assert len(duplicates) == 0, f"Duplicate titles found: {duplicates}" print(f"Test passed. All {len(titles)} titles are unique.")
title_counts = Counter(titles)
"""Integration tests for all titles in Reflex.""" import sys from collections import Counter from pathlib import Path import pytest sys.path.append(str(Path(__file__).resolve().parent.parent)) @pytest.fixture def routes_fixture(): from pcweb.pages import routes yield routes def test_unique_titles(routes_fixture): assert routes_fixture is not None titles = [route for route in routes_fixture if hasattr(route, "title")] # Count occurrences of each title title_counts = Counter(titles) # Find duplicate titles
# Assert that there are no duplicates assert len(duplicates) == 0, f"Duplicate titles found: {duplicates}" print(f"Test passed. All {len(titles)} titles are unique.")
duplicates = [title for title, count in title_counts.items() if count > 1]
"""Integration tests for all urls in Reflex.""" import os import re
import pytest import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file:
from pathlib import Path
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path
import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file:
import pytest
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path import pytest
def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in fil
import requests
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path import pytest import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """
errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found in
url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*')
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path import pytest import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*')
for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL:
errors = []
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path import pytest import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir):
# Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" ) url = url.strip("\"\
if "__pycache__" in root: continue
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path import pytest import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories
for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" ) url = url.strip("\"\n'") try: response = requests.head( url, allow_redirects=Fals
if not ("pcweb" in root or "docs" in root or "blog" in root): continue
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path import pytest import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files:
# page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" ) url = url.strip("\"\n'") try: response = requests.head( url, allow_redirects=False, timeout=5 ) response.raise_for_status() exc
if not file_name.endswith(".py") and not file_name.endswith(".md"): continue
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path import pytest import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way
file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" ) url = url.strip("\"\n'") try: response = requests.head( url, allow_redirects=False, timeout=5 ) response.raise_for_status() except requests.RequestException as e: errors.append( f"Error access
if file_name == "page.py": continue
"""Integration tests for all urls in Reflex.""" import os import re from pathlib import Path import pytest import requests def check_urls(repo_dir): """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue
try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" ) url = url.strip("\"\n'") try: response = requests.head( url, allow_redirects=False, timeout=5 ) response.raise_for_status() except requests.RequestException as e: errors.append( f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check yo
file_path = os.path.join(root, file_name)
: """Check that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file:
for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" ) url = url.strip("\"\n'") try: response = requests.head( url, allow_redirects=False, timeout=5 ) response.raise_for_status() except requests.RequestException as e: errors.append( f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check your path ends with a /" ) except Exception as e: errors.append(f"Error reading file: {file_path} | Error: {e}") return errors @pytest
urls = url_pattern.findall(line)
f the repo. Returns: A list of errors. """ url_pattern = re.compile(r'http[s]?://reflex\.dev[^\s")]*') errors = [] for root, _dirs, files in os.walk(repo_dir): if "__pycache__" in root: continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls):
url = url.strip("\"\n'") try: response = requests.head( url, allow_redirects=False, timeout=5 ) response.raise_for_status() except requests.RequestException as e: errors.append( f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check your path ends with a /" ) except Exception as e: errors.append(f"Error reading file: {file_path} | Error: {e}") return errors @pytest.mark.skip(reason="Skip until reflex.dev index route is fixed") @pytest.mark.parametrize( "repo_dir", [Path(__file__).resolve().parent.parent], ) def test_find_and_check_urls(repo_dir): """Test that all URLs in the repo are valid and secure. Args:
if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" )
continue # Check if the root path contains the target directories if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" )
try: response = requests.head( url, allow_redirects=False, timeout=5 ) response.raise_for_status() except requests.RequestException as e: errors.append( f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check your path ends with a /" ) except Exception as e: errors.append(f"Error reading file: {file_path} | Error: {e}") return errors @pytest.mark.skip(reason="Skip until reflex.dev index route is fixed") @pytest.mark.parametrize( "repo_dir", [Path(__file__).resolve().parent.parent], ) def test_find_and_check_urls(repo_dir): """Test that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. """ e
url = url.strip("\"\n'")
if not ("pcweb" in root or "docs" in root or "blog" in root): continue for file_name in files: if not file_name.endswith(".py") and not file_name.endswith(".md"): continue # page.py has some URLs that we cannot check in this way if file_name == "page.py": continue file_path = os.path.join(root, file_name) try: with open(file_path, "r", encoding="utf-8", errors="ignore") as file: for line in file: urls = url_pattern.findall(line) for url in set(urls): if url.startswith("http://"): errors.append( f"Found insecure HTTP URL: {url} in {file_path}" ) url = url.strip("\"\n'") try:
response.raise_for_status() except requests.RequestException as e: errors.append( f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check your path ends with a /" ) except Exception as e: errors.append(f"Error reading file: {file_path} | Error: {e}") return errors @pytest.mark.skip(reason="Skip until reflex.dev index route is fixed") @pytest.mark.parametrize( "repo_dir", [Path(__file__).resolve().parent.parent], ) def test_find_and_check_urls(repo_dir): """Test that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. """ errors = check_urls(repo_dir) assert not errors, "\n".join(errors)
response = requests.head( url, allow_redirects=False, timeout=5 )
f"Found insecure HTTP URL: {url} in {file_path}" ) url = url.strip("\"\n'") try: response = requests.head( url, allow_redirects=False, timeout=5 ) response.raise_for_status() except requests.RequestException as e: errors.append( f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check your path ends with a /" ) except Exception as e: errors.append(f"Error reading file: {file_path} | Error: {e}") return errors @pytest.mark.skip(reason="Skip until reflex.dev index route is fixed") @pytest.mark.parametrize( "repo_dir", [Path(__file__).resolve().parent.parent], )
def test_find_and_check_urls(repo_dir): """Test that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. """ errors = check_urls(repo_dir) assert not errors, "\n".join(errors)
) try: response = requests.head( url, allow_redirects=False, timeout=5 ) response.raise_for_status() except requests.RequestException as e: errors.append( f"Error accessing URL: {url} in {file_path} | Error: {e}, , Check your path ends with a /" ) except Exception as e: errors.append(f"Error reading file: {file_path} | Error: {e}") return errors @pytest.mark.skip(reason="Skip until reflex.dev index route is fixed") @pytest.mark.parametrize( "repo_dir", [Path(__file__).resolve().parent.parent], ) def test_find_and_check_urls(repo_dir): """Test that all URLs in the repo are valid and secure. Args: repo_dir: The directory of the repo. """
assert not errors, "\n".join(errors)
errors = check_urls(repo_dir)
"""Test utilities for reflex-web tests."""
from reflex.testing import AppHarness def get_full_url(app_harness: AppHarness, path: str) -> str: """Properly join the app's frontend URL with a path. This ensures proper URL construction without double slashes, which is important since React Router is stricter than Next.js about URL formatting. Args: app_harness: The AppHarness instance path: The path to join (should start with /) Returns: The properly joined full URL """ if not app_harness.frontend_url: raise ValueError("App harness frontend_url is None") return urljoin(app_harness.frontend_url, path)
from urllib.parse import urljoin
"""Test utilities for reflex-web tests.""" from urllib.parse import urljoin
def get_full_url(app_harness: AppHarness, path: str) -> str: """Properly join the app's frontend URL with a path. This ensures proper URL construction without double slashes, which is important since React Router is stricter than Next.js about URL formatting. Args: app_harness: The AppHarness instance path: The path to join (should start with /) Returns: The properly joined full URL """ if not app_harness.frontend_url: raise ValueError("App harness frontend_url is None") return urljoin(app_harness.frontend_url, path)
from reflex.testing import AppHarness
# reflex-dev/templates:.deploy/temporary_db.py to create default reflex.db when deployed
rx.utils.prerequisites.check_db_initialized() or rx.Model.alembic_init() rx.Model.migrate(autogenerate=True)
import reflex as rx
from account_management_dashboard.components.account_section import ( account_category_section, ) from account_management_dashboard.components.header import header_component from account_management_dashboard.components.net_worth_graph import ( net_worth_graph_component, ) from account_management_dashboard.components.net_worth_summary import ( net_worth_summary, ) from account_management_dashboard.components.sidebar import sidebar from account_management_dashboard.components.summary_section import summary_section from account_management_dashboard.states.account_state import AccountState def index() -> rx.Component: """The main page of the financial dashboard.""" return rx.el.div( sidebar(), rx.el.main( header_component(), net_worth_summary(), net_worth_graph_component(), rx.el.div( rx.el.div( rx.foreach( AccountState.account_categories,
import reflex as rx
import reflex as rx
from account_management_dashboard.components.header import header_component from account_management_dashboard.components.net_worth_graph import ( net_worth_graph_component, ) from account_management_dashboard.components.net_worth_summary import ( net_worth_summary, ) from account_management_dashboard.components.sidebar import sidebar from account_management_dashboard.components.summary_section import summary_section from account_management_dashboard.states.account_state import AccountState def index() -> rx.Component: """The main page of the financial dashboard.""" return rx.el.div( sidebar(), rx.el.main( header_component(), net_worth_summary(), net_worth_graph_component(), rx.el.div( rx.el.div( rx.foreach( AccountState.account_categories, account_category_section, ), class_name="fl
from account_management_dashboard.components.account_section import ( account_category_section, )
import reflex as rx from account_management_dashboard.components.account_section import ( account_category_section, )
from account_management_dashboard.components.net_worth_graph import ( net_worth_graph_component, ) from account_management_dashboard.components.net_worth_summary import ( net_worth_summary, ) from account_management_dashboard.components.sidebar import sidebar from account_management_dashboard.components.summary_section import summary_section from account_management_dashboard.states.account_state import AccountState def index() -> rx.Component: """The main page of the financial dashboard.""" return rx.el.div( sidebar(), rx.el.main( header_component(), net_worth_summary(), net_worth_graph_component(), rx.el.div( rx.el.div( rx.foreach( AccountState.account_categories, account_category_section, ), class_name="flex-grow pr-0 lg:pr-8 mb-8 lg:mb-0", ), rx.el
from account_management_dashboard.components.header import header_component
import reflex as rx from account_management_dashboard.components.account_section import ( account_category_section, ) from account_management_dashboard.components.header import header_component
from account_management_dashboard.components.net_worth_summary import ( net_worth_summary, ) from account_management_dashboard.components.sidebar import sidebar from account_management_dashboard.components.summary_section import summary_section from account_management_dashboard.states.account_state import AccountState def index() -> rx.Component: """The main page of the financial dashboard.""" return rx.el.div( sidebar(), rx.el.main( header_component(), net_worth_summary(), net_worth_graph_component(), rx.el.div( rx.el.div( rx.foreach( AccountState.account_categories, account_category_section, ), class_name="flex-grow pr-0 lg:pr-8 mb-8 lg:mb-0", ), rx.el.div( summary_section(), class_name="w-full lg:w-80 flex-shrink
from account_management_dashboard.components.net_worth_graph import ( net_worth_graph_component, )
import reflex as rx from account_management_dashboard.components.account_section import ( account_category_section, ) from account_management_dashboard.components.header import header_component from account_management_dashboard.components.net_worth_graph import ( net_worth_graph_component, )
from account_management_dashboard.components.sidebar import sidebar from account_management_dashboard.components.summary_section import summary_section from account_management_dashboard.states.account_state import AccountState def index() -> rx.Component: """The main page of the financial dashboard.""" return rx.el.div( sidebar(), rx.el.main( header_component(), net_worth_summary(), net_worth_graph_component(), rx.el.div( rx.el.div( rx.foreach( AccountState.account_categories, account_category_section, ), class_name="flex-grow pr-0 lg:pr-8 mb-8 lg:mb-0", ), rx.el.div( summary_section(), class_name="w-full lg:w-80 flex-shrink-0", ), class_name="flex flex-col lg:flex-row", ),
from account_management_dashboard.components.net_worth_summary import ( net_worth_summary, )
import reflex as rx from account_management_dashboard.components.account_section import ( account_category_section, ) from account_management_dashboard.components.header import header_component from account_management_dashboard.components.net_worth_graph import ( net_worth_graph_component, ) from account_management_dashboard.components.net_worth_summary import ( net_worth_summary, )
from account_management_dashboard.components.summary_section import summary_section from account_management_dashboard.states.account_state import AccountState def index() -> rx.Component: """The main page of the financial dashboard.""" return rx.el.div( sidebar(), rx.el.main( header_component(), net_worth_summary(), net_worth_graph_component(), rx.el.div( rx.el.div( rx.foreach( AccountState.account_categories, account_category_section, ), class_name="flex-grow pr-0 lg:pr-8 mb-8 lg:mb-0", ), rx.el.div( summary_section(), class_name="w-full lg:w-80 flex-shrink-0", ), class_name="flex flex-col lg:flex-row", ), rx.toast.provider(), class_name="p-8 flex flex
from account_management_dashboard.components.sidebar import sidebar
import reflex as rx from account_management_dashboard.components.account_section import ( account_category_section, ) from account_management_dashboard.components.header import header_component from account_management_dashboard.components.net_worth_graph import ( net_worth_graph_component, ) from account_management_dashboard.components.net_worth_summary import ( net_worth_summary, ) from account_management_dashboard.components.sidebar import sidebar
from account_management_dashboard.states.account_state import AccountState def index() -> rx.Component: """The main page of the financial dashboard.""" return rx.el.div( sidebar(), rx.el.main( header_component(), net_worth_summary(), net_worth_graph_component(), rx.el.div( rx.el.div( rx.foreach( AccountState.account_categories, account_category_section, ), class_name="flex-grow pr-0 lg:pr-8 mb-8 lg:mb-0", ), rx.el.div( summary_section(), class_name="w-full lg:w-80 flex-shrink-0", ), class_name="flex flex-col lg:flex-row", ), rx.toast.provider(), class_name="p-8 flex flex-col w-full min-h-[100vh] overflow-y-auto", ), class_name="flex flex
from account_management_dashboard.components.summary_section import summary_section